The testing process can be built in different ways. One of the effective methods to automate the testing process is continuous testing within the framework of continuous software delivery. Continuous testing allows you to stabilize and improve the quality of the code. Since Since any application begins with development, it is necessary to implement full-fledged testing in development cycles.
The basic idea of ​​continuous delivery is to build a Deployment Pipeline, allowing every change in the version control system to get into the combat environment in a standard and fully automated way.
An example of building a Deployment Pipeline on Jenkins for the first part:')
1. Creating pipeline project
1.1. “Create item” - enter the name and select the pipeline configuration
1.2. In the “GitHub project” enter the address to the repository
1.3. Select the checkbox “Interrogate SCM about changes” and set up a schedule to check the repository every minute “* * * * *”
1.4. In the “Pipeline script” field enter project steps
node{ stage 'Deploy' build 'Deploy_CHECK' stage 'Sonar_analysis' build job: 'Sonar_analysis', parameters: [string(name: 'STAND', value: 'CHECK')] stage 'Unit tests' build job: 'Unit_tests', parameters: [string(name: 'STAND', value: 'CHECK')] stage 'Deploy DEV' build 'Deploy_DEV' stage 'Unit tests' build job: 'Unit_tests', parameters: [string(name: 'STAND', value: 'DEV')] stage 'Acceptance_test' build 'Acceptance_test' stage 'Smoke_tests' build job: 'Smoke_tests', parameters: [string(name: '', value: 'DEV')] }
2. Make a change to the repository
3. Within a minute, the pipeline will see a new change in the repository and run a check.
Fig.1. An example of running checks on CHECK and DEV environments.
Fig.2. The result of performing one of the stages of checks.
Fig.3. Error detection at one of the work execution steps
An example of building a Deployment Pipeline on Jenkins for the second part:1. Creating pipeline project
1.1. “Create item” - enter the name and select the pipeline configuration
1.2. In the “GitHub project” enter the address to the repository
1.3. Select the checkbox “Interrogate SCM about changes” and set up a schedule to check the repository every minute “* * * * *”
1.4. In the “Pipeline script” field enter project steps
node{ stage 'Deploy QA' build 'Deploy_QA' stage 'Compliance tests' build job: 'chef-compliance', parameters: [string(name: 'STAND', value: 'QA')] stage 'Functional tests' build job: 'Tempest', parameters: [string(name: 'STAND', value: 'QA')] stage 'Performance tests' build 'Rally' stage 'Deploy PROD' build 'Deploy_PROD' stage 'Smoke tests PROD' build 'Smoke_tests_PROD' }
2. If merge request is closed successfully, then
2.1. Cut branch develop as release 2.2. Pipeline sees changes in the release * branch
2.3. Runs pipeline with checks
Fig.4. The process of performing the pipeline for QA and PRODUCTION environments
Fig.5. The result of a successful implementation of the pipeline with the deployment and launch of tests on QA and PRODUCTION environments
Fig.6. The result of not successfully completing the pipeline with the deployment and launch of tests on QA and PRODUCTION environments
3. If merge request is closed with failure, then
3.1. A notification is sent to the developer, who has been affected by the changes, indicating an error.