Nowadays, Quality Gates is a significant stage in the project delivery cycle. These checkpoints play a vital role in the development of high-quality software.
What is Quality Gate?
This is a set of predefined criteria that must be met before a software product can progress through the development lifecycle.
ReportPortal offers Quality Gates as a premium feature that accelerates the CI/CD pipeline by providing quick and continuous feedback to your CI/CD tool. There are five rules to quickly assess the build quality and understand if it can be deployed to a specific environment.
Below, you will find some tips to get the most from Quality Gates.
1. Create separate Quality Gates for different launches
For example, your project may have various automated tests such as Regression Suite, Smoke Tests, and UI Tests. And we can create different rules for these types of tests.
![Types of tests in our test automation results dashboard](https://images.ctfassets.net/1n1nntnzoxp4/27o8ih1R6oJRiNQ5dVgOeH/9b2005e3a1754f8281b1d3822f31b113/QualityGates1.png?w=1367&h=235&q=50&fm=png)
We also need to determine under what conditions the Quality Gate will be considered as Passed. It's recommended that these aspects should be discussed among several interested team members to define quality criteria more accurately. For instance, a team might decide that they agree with a failure rate of 1% if there are at least 2200 tests.
![The conditions for failing a Quality Gate](https://images.ctfassets.net/1n1nntnzoxp4/1gRoVbadRs3XvP6msyziYj/ca3670aa13d89f3e7f3f80ed514551ae/QualityGates2.png?w=1569&h=217&q=50&fm=png)
2. Gradually increase the number of rules
We suggest starting with the simplest rule, the "Amount of tests in the run", to track that all tests are running every time. Understand how it all operates before adding a new rule.
!["Amount of tests in the run" rule](https://images.ctfassets.net/1n1nntnzoxp4/77E8kKdnDSphFnk5JwGa1o/1797e5e35db2a4c059d719bb121c77ac/QualityGates3.png?w=1547&h=173&q=50&fm=png)
Further, you can enhance accuracy by selecting the "Tests with attributes" option. For instance, the following Quality Gate with the "Amount of issues in the run" rule will be Passed for the "dev" environment even if there is one Product Bug with the attribute "dev". However, for the "stage" environment, the Quality Gate with such a rule will be categorized as Failed.
!["Amount of issues in the run" rule](https://images.ctfassets.net/1n1nntnzoxp4/5Cdgaw9kfQDYVeczPMrDV1/ec17f34e96c911c9a4d03d7fa25dfab9/QualityGates4.png?w=1580&h=320&q=50&fm=png)
3. Keep track of the relevance of rules
No project is static: new test cases are created, bugs are detected, some test cases are excluded from the run, and Quality Gates should be reviewed in line with requirements.
For example, in the screenshot below Quality Gate failed because the number of tests in the launch has changed, but the Quality Gate rule was not updated.
![The relevance of Quality Gates rules](https://images.ctfassets.net/1n1nntnzoxp4/5pkfsy89mVdMqnob2dgq6v/ff36805886c369dec38191a4f108d234/QualityGates5.png?w=1557&h=208&q=50&fm=png)
![Failed Quality Gate](https://images.ctfassets.net/1n1nntnzoxp4/3v23aP0PccIRJjNXR0r0TP/56bf30e85fec5b1d70750eb2564e9097/QualityGates6.png?w=912&h=396&q=50&fm=png)
4. Make the Quality Gate a stage of the CI/CD pipeline
By using Quality Gates in the CI/CD pipeline, the decision to move to the next stage can be made automatically within seconds. For instance, if the tests are successful and the Quality Gate check is Passed, the build is deployed to the environment. This flow prevents the progression of the code if it doesn't meet the necessary criteria. Thus, there is no need to manually go through and analyze the test results – if they meet the Quality Gates, the next step in CI/CD will run automatically.
![Quality Gates in the CI/CD pipeline](https://images.ctfassets.net/1n1nntnzoxp4/3xjkSWKoANIZg0AedRMLq7/bc707aa1971fd1bce71e4554e7a90617/QualityGates7.png?w=1552&h=793&q=50&fm=png)
5. Use Quality Gates to construct test automation metrics
Just like our widgets, Quality Gate rules can also assist in developing metrics to understand the effectiveness of automation efforts.
Pass/Fail rates
Error/failure distribution
Regression test effectiveness
Defect density
Amount of issues in tests with specified attributes
Test case success rate
Failure rate of the run – to get test case success rate, subtract the percentage of failed tests from 100.
By following best practices, you can automate quality control and ensure that only high-quality code progresses, reducing bugs and improving software stability for users. Overall, Quality Gates provide a strategic and robust development stage in the software delivery cycle.