I have tests which run very slow, say a test which exports a large database to test the exporting code for memory leaks.
While useful, these are not unit tests, as denoted by the unit-test tag.
A test is not a unit test if:
- It talks to the database
- It communicates across the network
- It touches the file system
- It can't run at the same time as any of your other unit tests
- You have to do special things to your environment (such as editing config files) to run it.
Tests that do these things aren't bad and are certainly worth writing. They can even be written in using unit test framework. However, it is important to be able to separate them from true unit tests so that you can keep a set of tests that you can run fast whenever you make changes, particularly in a TDD cycle where you want to go from failing test to passing test as quickly as possible.
If you are using a Makefile
you could have a check
target for true unit-tests and a livecheck
target for these slow, system tests.
How to run each test individually will depend on your framework.