Hero Background

Power Your Software Testing with AI Agents and Cloud

The Native AI-Agentic Cloud Platform to Supercharge Quality Engineering. Test Intelligently and Ship Faster.

Thought Leadership

Test Optimization for Continuous Integration

Test optimization is a must to deliver smoother processes in continuous integration. Read on to know more about it.

Last Updated on:

“Test frequently and early.” If you’ve been following my testing agenda, you’re probably sick of hearing me repeat that. However, it is making sense that if your tests detect an issue soon after it occurs, it will be easier to resolve. This is one of the guiding concepts that makes continuous integration such an effective method. I’ve encountered several teams who have a lot of automated tests but don’t use them as part of a continuous integration approach. There are frequently various reasons why the team believes these tests cannot be used with continuous integration. Perhaps the tests take too long to run, or they are not dependable enough to provide correct results on their own, necessitating human interpretation.

TL;DR

Test optimization for continuous integration means grading every test suite on value and runtime, then running each group at the cadence that matches it. Fast, high-value suites gate every build, slower ones run hourly or nightly, and suites that teach the team nothing come out of the pipeline.

  • Value and runtime grid: Plot each suite by the confidence it gives the team against the time it takes to finish. The grid shows which suites belong on every build and which ones are candidates for removal.
  • Build acceptance suites: High-value suites that finish in 15 minutes or less run on every build, and a failure there means the team treats the build as broken until it passes.
  • Unstable tests: A test that fails for no clear reason costs analysis time on every run, so it comes out of the regression pack rather than staying in and eroding trust in the results.
  • Sleep statements: A fixed sleep added to work around a slow back end becomes a permanent tax on every run. A wait that ends when the event occurs recovers that time without making the test less reliable.
  • Parallel execution: Splitting one long suite into component-based suites that run at the same time turns a weekly run into a daily one and points at the failing component sooner.

I begin my evaluation of these suites with a simple task. I start by drawing two axes on a whiteboard. The vertical axis represents the test value, while the horizontal axis represents the time it takes the suite to execute. The team and I then write the name of each test suite on a sticky note and adhere it to the proper spot on the board. The graph below depicts an example of a grid that illustrates how each test suite measures.

Here’s an example that you may adapt to your own situation:

Runing time of the test suite\ Importance of the test suite<15 Minutes<45 Minutes>45 Minutes
HighTS 1TS 5TS 3
MediumN\ATS 2N\A
LowTS 6N\ATS 4

We establish the significance of the tests on the team’s personal viewpoint; thus, we keep the options simple: Low Value, Medium Value, High Value. This viewpoint is based on the tests’ dependability, or their ability to produce correct findings each time they are run, as well as the amount of confidence the tests provide the team in the system’s quality. Some test suites, for example, are required when making a choice, but the results are inconsistent, and when they fail for no apparent reason, a person must manually re-execute those failing tests. We may still label this test suite medium, but if it worked perfectly every time it becomes “High Value”.

On the other hand, there may be a test suite that is run because it is part of a checklist, but no one understands what the findings indicate. Perhaps the original creator has left the team and nobody has taken control of that suite. That suite falls into the Low-Value category. The horizontal axis is straightforward to identify: It’s just the amount of time it takes to run the suite. Now that you’ve evaluated each suite, consider how you can improve them by making them more useful or by having them execute faster. I prefer to divide the tests for continuous integration into these categories:

  • High-value tests that run in 15 minutes or less - These tests can be executed on any build. These are used to accept the build for further testing; until these tests pass, the team should consider the build broken. Your developers will not be happy if they have to wait more than 10 minutes for the build results.
  • High-value tests that can be completed in 45 minutes or less - These tests can be run continuously. For example, you may arrange these tests to run every hour and start again as soon as they are complete. If there isn’t a new build available yet, you can wait till the next build is finished.
  • High-value tests that take more than an hour to run - These tests may be done on a daily or nightly basis, so that the outcomes are ready when your team’s business day begins.
  • Medium-Valued Tests - These tests can be performed once a week or once per release cycle.

You’ll see that I excluded tests with really no value. These should be excluded from your execution or enhanced to deliver value. Keeping test suites that don’t bring value is pointless. Based on feedback from the development teams, I established time limits of 15 and 45 minutes. They demand immediate feedback. Consider a developer who is waiting for the build results to complete successfully before leaving at lunchtime. Your timings may vary depending on your circumstances; this is only a framework to demonstrate the thinking processes behind picking tests that run with the build versus hourly.

A significant advantage of running the tests thus often is that you are expected to have very few code changes between a successful test run and a failed test run, making it easy to identify the change that prompted the test to fail. Several solutions have proven useful in enhancing existing tests for continuous integration suites. If you are still wiring a suite into a build at all, this walkthrough of automation testing in a CI/CD pipeline covers the setup the rest of this article assumes. Here are seven proven and effective methods.

Automatically initiate tests

You may have numerous test suites that are normally triggered by an employee throughout the testing phase of a project. Including these tests in the continuous integration, the suite is often as simple as a little PowerShell scripting. Performance testing, load testing, and security testing are examples of work that might be performed by an expert who is not a member of the traditional test squad and hence cannot be set for automated execution. Another benefit of doing these tests on a regular basis is that the problems that are detected are typically difficult to overcome; so, if the problem is identified sooner, the team has more time to resolve it. These tests are generally classified as Very Significant, but because they take more than an hour to complete, they are typically performed on a regular basis.

Remove uncertainty

The entire purpose of automation is to get reliable, accurate test results. When a test fails, specialists must figure out what went wrong. However, as the number of false positives and inconsistencies increases, so does the time needed to analyze mistakes. To avoid this, remove flaky tests from your regression testing pack. Furthermore, older automated tests may overlook critical verifications. Prevent this by conducting enough test planning before performing any tests. Always keep an eye on whether each exam is up to date. Ensure that the sanity and validity of automated tests are thoroughly checked across test cycles.

Unreliable tests are also the problem agentic testing is pointed at. Rather than replaying a fixed script, an agent is given the goal and works out how to reach it against the build in front of it, repairing a step whose selector has moved instead of reporting it as a defect. That keeps the renamed-element class of failure out of the queue a person has to read. Agent output is non-deterministic, so it belongs behind a review gate rather than blind trust.

Be clever with your wait times

We’ve all done it: a problematic test consistently fails because the back end didn’t respond fast enough or because a resource is still processing, so we add a sleep statement. We meant it to be a temporary solution, but that was almost a year ago. Look for those awful sleep statements and see whether you can swap them with an explicit wait that completes when the event occurs rather than after a predetermined amount of time.

Collective Ownership of Tests

Don’t delegate full automated testing initiatives to a single tester or programmer. The remainder of the team will be unable to contribute meaningfully if they are not kept up to date at all times. To properly incorporate automation into the testing infrastructure, the entire team must be on board at all times. This allows every team member to be aware of the process, communicate more clearly, and make educated decisions about how to set up and execute the appropriate tests.

Restructure the test configuration

Tests generally have a setup, then perform verification. For example, one team I worked with had a suite of UI-driven tests that took a long time to run and threw many false errors owing to timing difficulties and small UI adjustments. I helped them refactor that suite so the setup ran through API commands and only the verification went through the UI. The improved suite kept the same functional coverage, but in that engagement it ran 85% faster and produced roughly half the false errors caused by updates.

Run tests in parallel to maximize the value of each minute of execution

Virtual servers, cloud infrastructure, and services that create environments and distribute code on demand have made parallel runs far cheaper to attempt than they once were. Look at the test suites that take a while to run and see whether any of them can run simultaneously. One group I worked with had a highly important suite of 5,000 test cases that they ran rarely, because it took many hours to complete. It was a thorough examination that covered a wide range of aspects. I helped split it into roughly a dozen parallel-capable suites, which let the team run the tests daily rather than weekly and pinpoint issues faster, because the new suites were arranged by component.

Splitting a suite by hand is the manual version of what a test orchestration cloud does on its own. HyperExecute discovers the test entities in a suite and distributes them across a declared number of concurrent machines, so the split happens on every run rather than as a one-off refactor.

Make small yet effective test suites

Go for the most critical tests and combine them into a smaller, faster-running suite. These are often relatively basic tests, but they are required to validate your system for further testing. It makes absolutely no sense to advance if these tests fail. We usually call these build acceptance tests or build verification tests. If you already have these suites, that’s fantastic; just make sure they run fast.

Run tests up to 70% faster on the TestMu AI cloud grid

Author

...

David Tzemach

Blogs: 46

  • Twitter
  • Linkedin

David Tzemach is a software quality and engineering leader with 19+ years of experience in software testing, quality assurance, and large-scale R&D operations. He specializes in building QA organizations from scratch, defining quality frameworks, and implementing agile and shift-left testing practices across enterprise environments. David has served as Head of QA and QA Architect, authored multiple books on agile quality and testing, and actively contributes to the testing community through his QualityBreach platform and publications.

Reviewer

...

Aman Chopra

Reviewer

  • Linkedin

Aman Chopra is a DevOps Engineer and Community Contributor with over 7 years of experience in cloud technologies, software development, and software testing. Currently working at TestMu AI, Aman specializes in optimizing Azure cloud infrastructure, enhancing API accessibility, and integrating cloud platforms like AWS and GCP. With expertise in Git, Docker, Kubernetes, and CI/CD practices, Aman has contributed to various open-source projects and authored guides on cloud computing, containers, and CI/CD. He holds a B.Tech in Computer Science.

Add to Google preferred sources

Summarise with AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free

Test Optimization FAQs

Did you find this page helpful?

More Related Blogs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests