Continuous integration is a development practice that advocates that team members need to integrate their work frequently, and each integration is verified by automated construction (including compilation, construction, and automated testing), so as to find integration errors as soon as possible. Keeping the software under development in a working state allows products to iterate quickly while maintaining high quality.
Jenkins is a continuous integration tool developed based on Java, open source and free, official website: https://jenkins.io/
App automation test execution strategy
Automated testing is mainly used for regression testing, and we can formulate execution strategies: such as fixed every day, and regular execution after the development code is updated, which requires integration with Jenkins.
Problems with Jenkins integrated App automation testing:
App automation requires the use of a real machine or an emulator, and Jenkins is generally deployed on a server. It is obviously impossible to connect a real machine or an emulator to the server.
solution:
-
Apply for a local computer dedicated to automated testing, deploy an automated testing environment, and connect to a local real machine/simulator
-
Deploy Jenkins on the company server (internal server or Alibaba Cloud/Tencent Cloud server)
-
Use the Jenkins master-slave mode to send the task to the corresponding local computer and execute the task on the local computer
If you want to learn automated testing, here I recommend a set of videos for you. This video can be said to be the number one automated testing tutorial on the entire network at station B. At the same time, the number of people online has reached 1,000, and there are notes to collect and share with you. Dashen Technical Exchange: 798478386
It should be noted that the local execution computer needs to configure the environment of JDK+Maven+Android SDK+Git, and needs to link to the device through adb.
Jenkins master-slave mode (master-slave) uses:
Add Node node
Manage Jenkins -> Manage Nodes and Clouds -> New Node
It should be noted that the Launch method must open the remote connection port of jenkins, otherwise the slave machine cannot connect to the Jenkins service. This connection uses the JNLP4 protocol, which is a long connection protocol encapsulated on the basis of WebSocket + TLS. It can be turned on in the security settings panel of jenkins: enter the Jenkins home page -> security panel
Connect slave slave
Both ways can connect to the slave slave
In the task configuration, select the corresponding slave slave machine to build
Possible problem 1:
D:\jenkins-slave\workspace\jenkins_maven_demo>mvn clean test
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init D:\jenkins-
slave\workspace\jenkins_maven_demo
Solution: Configure the tool path on the slave node:
Possible problem 2:
mvn not found
There is no maven in the environment variable of the Jenkins slave node. Solution: Copy the PATH environment variable on the slave machine to here: