DEV Community

Cover image for Should we run unit tests in the cloud before CI?
Jonathan
Jonathan

Posted on Edited on

Should we run unit tests in the cloud before CI?

Imagine if you could push your current branch to a test server and have it automatically run all of your unit tests!

You could get feedback on your entire test suite in a few minutes, rather than waiting for a lengthier CI process, which might take up to ~20 minutes (depending on the infrastructure and setup in your organisation).

Several automation test platforms now exist, to perform cloud testing on longer-running end-to-end tests. These include Selenium Grid, TestingBot and BrowserStack.

Why not extend this kind of service also to unit tests?

Advantages of cloud-based unit test execution over CI:

  • CI can be time-consuming, if it runs a full build, linting, type-checking and other operations. Cloud-based unit testing lets us isolate just the tests.
  • CI tends to be monitored on a separate web-page. Cloud-based unit testing (in theory) could be integrated directly into the developer's IDE, so it would feel similar to running the tests locally.

Advantages of cloud-based unit test execution over local:

  • When working with a very large code base, with a large number of tests, and not well de-coupled, we might want to run all the tests. An optimised cloud environment might be able to do this faster than a dev box, and without consuming resources which could cause our IDE and other tools to slow down.

So far I don't know of any platforms that actually do this, but perhaps the aforementioned automation testing platforms could be configured/tweaked to enable it.

What do you think?

Top comments (0)