It is estimated that you have been bored with hundreds of web page Click tests. At least I did this before. So, let's automate your web testing. In this article, we will use Cucumber + Watir to complete automated testing, starting with the simplest example, we can reconstruct a complete automated testing framework step by step.
(1) Relationship between Cucumber
Refer:
Http://www.radekw.com/blog/2009/03/27/automation-frameworks/
Http://robotframework.googlecode.com/svn/wiki/publications/Quality_Matters_Q1_2009_Collino.pdf
Recentlyi researched stored testing frameworks in order to choose one to use at work. ispent few days practically testing the following frameworks:
· Robot framework
· Fitnesse
· Cucumber
Ichose robot framew
I am not responsible for any misleading information that has been exposed to automated testing for a short time.
Now that we have selenium, an open-source automated tool, why should we write another framework on our own?
Selenium is an automated tool and can certainly be used in testing, but it is not tailored for testing. Of course, we do not need any
Selenium is a good automated testing framework for multiple platforms and browsers. Selenium provides two operating modes-core and remote control (RC). In addition, thoughtworks also provides Firefox's add-on -- selenium IDE and RC mode extension selenium grid for
organizing it into a test Suite for performing tests. In fact, the testing of 3 search engines, because of homogeneity, can also be combined into a test, using different input parameters to specify the search engine to be tested. This is considered to be three components, just to illustrate how to organize multiple test modules in a selenium+testng environment.From top to bottom, the test scenario described in the previous paragraph can be decomposed
: Allows multiple test tasks to be run concurrently and in different environments, dramatically speeding up the functional testing of Web applications.
The idealized use of selenium to write test case is to perfect the test script by selenium the IDE record script, through Firebug to help locate the page element, and then through the selenium RC. The
Self.assertisnone (result,msg="%s is not none"%(result))def test09 (self):#Determine if a parameter does not contain another parameterPrint"Execute test Case 09") result =‘123‘ Self.assertisnotnone (Result,msg= " %s is None "%def TearDown (self): U No post-conditions can be written Passprint ( " end ... ") # Passif __name__ = = __main__ ": Unittest.main () Ps:unittest executes the setup, executes the test case test* (the test case is executed in the name order), and finally executes the tear
Before saying that I wrote a selenium automation framework, and then study the lower RF, I think the RF based on the keyword-driven framework is more easy to get started, of course, do some of the more cumbersome verification, it seems not too flexible, It's better to write a few lines of Python's benefits (or maybe you haven't mastered it yet), but overall, ther
Full Stack Engineer Development Manual (author: Shangpeng)
The Python tutorials all solution needs Environment browser (firefox/chrome/ie. Python Selenium Selenium IDE (if using Firefox) FireBug, Firepath (if using Firefox) chromedriver, Iedriverserver, Phantomjs.exe IDE (Pycharm/sublime/eclipse.. )
1, browsers suggest using Firefox or Chrome, do not use the latest version, to use the early two to three ver
1. The entire framework directory is as follows:Constant: Store some constants, such as the URL of the test, and the elements that some PR methods need to use;Errorpicture: Used to store errors during automatic operation;Framework: Classes and methods for storing some basic;Pages: a page class for storing pageobject;Publicmethod: Used to store some PR methods;Question: Used to store some problems encountere
positioning of the page, and the method encapsulated by the business operation code associated with those elements.4. Code reuse, which reduces the amount of test script code.5. Clear hierarchy, while supporting the development of multiple writing automation scripts, such as how many pages each person writes, does not affect others.6. It is recommended that both the page class and the business logic approach give a meaningful name to make it easy for others to quickly write scripts and maintain
test whether it can work properly, only a few statements: # Test Selenium installation, selenium can open Chrome browser from selenium import Webdriverbrowser = Webdriver. Chrome () browser.get ("https://www.baidu.com/") print (Browser.title) browser.quit ()At this point, how to open the browser and automatically access the Baidu Web site, then the installation
Architecture
This framework is created using ant, testng and selenium.Through this framework, a user is able to create an automatic test case which can be run later by executing a single command. The uses of different frameworks are as follows:Selenium: this framework is needed for recording a testcase, exporting it into Java, and executing it on a browserTestng
operation interface to manipulate page elements.On the other hand, Webdriver can interact with the system bottom and send the action signal directly. such as what keys to press, where to move the mouse and so on. Visible selenium2.0 is much more powerful than 1.0. Here is a brief talk about Webdriver:Webdriver My understanding:He's kind of an API, a specification.A variety of browser vendors refer to this specification to give the selenium the inter
SeleniumIsWebOfAutomated TestingTools, andOthersCompared with the automated tools, the main features of the tool are cross-platform and cross-browser.SupportedWindows, Linux, Mac, supporting IE, FF, Safari, opera, chrome, etc.Another feature is the support for distributedTest CasesTo distribute test cases to different test machines, which is equivalent to the distribution machine function.
For the principles, architecture, and usage of selenium, refer
调试十分困难。 Because the page may have a lazy load situation. Although the page has been rendered, there may be ajx lazy loading. Some elements need to wait until the AJAX call is complete before they can be displayed. At this point, you need to add a wait mechanism on the page./** * 用于等待某个元素出现,软等待 * @param by */public boolean wait(final By by){ new WebDriverWait(driver, 10).until(new ExpectedConditionFor example, you want to find an element that id= "name":if (wait(By.id("name"))) xxx;else
Previous Test framework: http://www.cnblogs.com/tobecrazy/p/4553444.htmlWith Jenkins sustainable integration: http://www.cnblogs.com/tobecrazy/p/4529399.htmlUse log4j 2:http://www.cnblogs.com/tobecrazy/p/4557592.html in the test frameworkTo start with the grid, selenium grid is a framework for executing test cases with different platforms (Windows, Linux, Android
Previous Test framework: http://www.cnblogs.com/tobecrazy/p/4553444.htmlWith Jenkins sustainable integration: http://www.cnblogs.com/tobecrazy/p/4529399.htmlUse log4j 2:http://www.cnblogs.com/tobecrazy/p/4557592.html in the test frameworkTo start with the grid, selenium grid is a framework for executing test cases with different platforms (Windows, Linux, Android
selenium sub-version 1 and version 2, where the installation is version 2 of the selenium. 650) this.width=650; "src=" Https://code.csdn.net/assets/ico_fork.svg "alt=" derived to My Code slice "width=" "height=" "/>"#-*-coding:utf-8-*-fromseleniumimportwebdriverfrom selenium.common.exceptionsimporttimeoutexceptionfrom selenium.webdriver.support.uiimportwebdriverwait#availablesince2.4.0 importtime#createane
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.