Skip to main content

Run tests in CI pipelines

In a CI pipeline, you can run a variety of tests, such as integration tests, functional tests, and unit tests.

Run tests in a CI pipeline

To run tests in CI pipelines, you can use Run steps or a Run Tests steps. The major difference between these two options is that you must use the Run Tests step if you want to enable Test Intelligence.

Improve test times

These Harness CI features can improve test times:

  • Test Intelligence: Test Intelligence speeds up your test cycles by running only the unit tests required to confirm the quality of the code changes that triggered a build. You must use the Run Tests step to enable Test Intelligence.
  • Parallelism: You can use parallelism with either the Run or Run Tests steps to speed up test times. For more information, go to Speed Up CI Test Pipelines Using Parallelism.
  • Step groups: You can use step groups to organize and condense pipelines that run a lot of tests.

You might also try these test optimization practices:

  • Use mock services in your unit tests, rather than setting up and connecting to third-party services. Mockups can often test your code as well as fully-running services but with fewer resources.
  • Avoid integration tests in your build pipelines when possible. You might want to move these to a separate Pipeline.
  • Look for obsolete tests that you can delete.
  • Look for unnecessary sleep statements in your unit test code.
  • Order your tests so that the tests most likely to fail come first.

Test results

After a pipeline that includes tests runs, you can view the test results in Harness.