In front of the basic figure of webdriver+ TestNG's test environment deployment, here's a simple example of combining Ant and Jenkins.
First, write the test script in Eclipse .
The process of writing automated test cases is skipped, and use case design is a very important process, followed by a separate summary. 1. Introduction of test Object
Here to test a Web application as shown below, including three module information additions and deletions, login log out, etc.
2. Write and tune test scripts
(1) First create a personal API package to encapsulate some common functions, create a test class to inherit this class
(2) I do not have a module of the test script placed in a Java file, respectively, to complete a search and delete the process
(3) Configuring the Test.xml file
When you create a new testng class, you boot an XML configuration file that is testng to execute the test code.
A method represents a test case, only the test method (4) that executes the include tag executes the test script
Right-click the Test.xml file to TestNG Suite and get the following results:
23 test cases were executed, all through
(5) Viewing the HTML test report
TestNG The test results are output to the Set Test-output folder, you can open the index.html and emailable-report.html to view the test results.
Open is this:
That is true:
second, build the test with the automated build tool ant (1) Install and configure environment variables
The process is simple and does not record. Configured to enter ant-v at the command line, the installation is successful when the version information appears
(2) The project root directory creates the Build.xml file and configures the relevant information, as shown in the following figure:
(3) The command line enters the directory where the project is located, enter the Ant Run command to perform the build
appears as a result, the configuration ant succeeds
Third, install and configure Jenkins
(1) Download Jenkins.war package, copy to server D packing directory, command line execute java-jar jenkins.war command to start Jenkins
The following diagram appears (installation) started successfully
(2) Install plug-in
jenkins--"System Management--" plug-in management install ant plugin,html Publisher reporter,svn publisher Plugin and other needed plug-ins, associated plug-ins will also be installed automatically (3) Create a new job
Click New-"Enter job Name: Test--" tap to build an automated style software project
(4) Configuring the job
Configure the test script in SVN, provided that the server has an SVN server and the test script commits to the server
Configuration Build--"Add build Step--" Invoke int, Premise: Server successfully installed Ant
Configure the storage path for HTML test reports to view reports directly in the browser
Basic configuration complete, of course, can also configure other such as: Mail report, timed execution test, and so on, don't get it first
Complete the configuration, save Four, perform the test (1) Select the new Job project, click Build Now
(2) View test report
Here basically completed this automated test demo ...
The next areas to be studied:
1, through the reportng to optimize the testng test report
2, each class script will start a Chromedriver instance, and at the same time, how to let it in turn after quit and then create
3, many other aspects of optimization <-_-> + + + <-_->