Continuous integration - App automation test integration practice

1. The benefits of continuous integration for app automation testing

1. Reduce errors and manual tasks
2. Identify and resolve integration challenges early
3. Shorter lead times

2. Environmental preparation

1. The code under test (stored in the code warehouse)
2. Jenkins node machine and operating environment

3. Jenkins node mount

Blog address: https://blog.csdn.net/YZL40514131/article/details/130142810?spm=1001.2014.3001.5501

Fourth, the configuration of the node environment

1、JDK

C:\Users\Lenovo>java -version
java version "11.0.18" 2023-01-17 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.18+9-LTS-195)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.18+9-LTS-195, mixed mode)

2. Simulator

3. SDK environment

insert image description here
insert image description here

4. Python3 environment

C:\Users\Lenovo>python
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

5. allure-commandline tool

C:\Users\Lenovo>where allure
D:\allure-commandline-2.13.2\allure-2.13.2\bin\allure
D:\allure-commandline-2.13.2\allure-2.13.2\bin\allure.bat

6. allure plug-in

insert image description here

5. Run the code to be tested locally (to ensure that there is no problem with the code)

Pycharm pulls the code to execute
the command line to run the code and generate a report

6. Export of library files

pip freeze > requirements.txt

7. Run code configuration on Jenkins

1. Specify the node to run

Specify the windows node to run UI automation. Linux is not suitable for running UI automation. Linux needs to install a browser, and there is no interface to run scripts. Running UI automation can only run in headless mode

Create a node (you need to ensure that the remote working directory exists)
insert image description here
and ensure that the node is already connected

insert image description here
insert image description here
insert image description here

2. Source configuration

insert image description here

3. Build configuration

python3 -m venv venv
call D:\env\appium_env\Scripts\activate            激活虚拟环境
pip install -i https://mirrors.aliyun.com/pypi/simple -r requirements.txt         安装依赖

python -m pytest weixin_project\app_po\cases\test_demo.py -vs --alluredir=weixin_project\app_po\results --clean-alluredir

insert image description here

4. Post-build configuration

The relative path setting of allure report setting
is consistent with the results python -m pytest weixin_project\app_po\cases\test_demo.py -vs --alluredir=./results --clean-alluredirin
insert image description here


Special note: You also need to check the tool location and set the directory of Allure Commandline (you can check it through C:\Users\Lenovo>where allure) in Run Node->Configure Slave Node->Node Properties

insert image description here
insert image description here

8. Building Web Automation Tests

insert image description here

1. Test report generation

insert image description here

2. Console output

insert image description here

3. Workspace file

insert image description here

Guess you like

Origin blog.csdn.net/YZL40514131/article/details/130310491