Preparation:
First you need to understand Maven, testNG, Jenkins, tomcat, git. The source code is on Github.
If you need to execute locally, you will need to install Jenkins + Tomcat
1. Maven Project
1.1 Creating a Maven project in IDEA
new project
new project
1.2 the pom. XML
You need to add maven and Testng dependencies
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
The < version > 6.9.10 < / version >
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<! — Maven-compiler-plugin version 3.3 should be used, otherwise Jenkins cannot be tested.
< version > 3.3 < / version >
<type>maven-plugin</type>
</dependency>
1.2 testNG
Specify the use cases to execute by configuring the XML file
<? The XML version = “1.0” encoding = “utf-8”? >
<suite name=”Suite” parallel=”false”>
<test name=”Test”>
<classes>
<class name=”com.demo.test.testcase.Compare”/>
<class name=”com.demo.test.testcase.Compare_queryGhtRegwaterView”/>
</classes>
</test> <! — Test –>
<listeners>
<! Arrow plugin to implement use case failure rerun and generate test report
<listener class-name=”com.demo.arrow.TestResultListener” />
<listener class-name=”com.demo.arrow.RetryListener” />
<listener class-name=”com.demo.arrow.PowerEmailableReporter” />
</listeners>
</suite> <! — Suite –>
2 Git
Sign up on Github
2.2 Uploading local Projects to Git
Configuration in idea: file-setting-version control-github
During configuration, you can click Test to test whether the connection is normal.
Upload code:
share project on GitHub
share
Go to Github to see the project address
Github project address
3.jenkins+tomcat
3.1 installation tomcat9 + jenkins2.5
3.2 Jenkins plug-in installation
Install plugins: Email Extension Plugin,Git Plugin,Maven Integration Plugin
3.3 Global Tool Configuration
Configuration: JDK, Maven, git
Global Tool Configuration
3.4 System Configuration
Home directory
Changing the home directory can be done through: My Computer – Advanced System Settings – Environment Variables; Add JENKINS_HOME. Restart Jenkins to take effect.
Maven configuration
Git configuration
Email configuration
3.5 Creating a Project whose build type is Maven
3.5.1 Jenkins – New – Build a Maven project
Maven project
3.5.2 Source Code Configuration
Git configuration
Repository URL: GITHUB project address
Credentials: Adds credentials through Add
Add Add credentials
3.5.2 Build triggers
Configure the build trigger time by configuring the calendar.
Build trigger
3.5.3 Configuring Maven execution
build
Root POm: Build the project from pom.xml, which is configured with the TESTng XML file to execute.
<configuration>
<suiteXmlFilles>
<suiteXmlFile>testcase.xml</suiteXmlFile>
</suiteXmlFiles>
<reportsDirectory>./result/test-report</reportsDirectory>
</configuration>
3.5.4 Operation after Construction
Post-build operation
3.6 Executing a Build
start
The execution of
3.7 Execution Complete
Console output
The test results
This article is from:
https://www.jianshu.com/p/dbb46e36bda2
*** *:
Talk about test servitization
Test Platform Solution (DAP) Based on Docker Container Technology
Safety test drozer | mobile terminal security
Puppeteer-based front-end performance testing solution
Unlock the automated tests column