Breaking Tests into Groups

Explore the different ways to break long-running tests into groups.

Integration tests do not need to run quickly, and for good reason. Integration tests will typically need to deal with I/O, which is not exactly fast or predictable. Skipping or excluding the longer-running tests will be necessary if you want to keep the wait for test feedback as low as possible when developing some new logic or feature.

There are three ways to break long-running tests into groups or exclude them when running fast-running unit tests.

Running specific directories, files, or tests

We can specify specific files, directories, and even individual tests when using the test command. This option will not permanently break our tests up into different groups that can be run separately, but outside of using our IDE, it presents the easiest way to target individual tests.

  • To run all the application tests for the Shopping Baskets module, we would use the following command:

Get hands-on with 1400+ tech skills courses.