10 reasons why short test cases are better than bigger ones

Software testing is one of the key pillars of development and is based on best practices. One of the general assumptions is that shorter tests are better than long tests.

Why are short software tests better than long software tests?

Here are a few reasons why test cases should be short rather than long:

  1. Short tests are easier to write, review and approve.

  2. They cover maybe only one specific small feature but it is covered well and in depth.

  3. When executing the tests, people don't get lost or distracted: if you have a test that needs two days to execute the testers tend to just get lost or even might ticked the passed the last steps to get over with it.

  4. Tests are easier to fix (if they are wrong): the fix, update and re-test cycle is much faster.

  5. The total test time is shorter. If you have a test with a few hundred test steps, it might fail first after 50 steps, than after some fixes to either the product or the test, it might still fail a second time after 100 steps, then 150... the problem is that after each fix you need to start from the beginning to repeat what was done before, that's an exponential effort.

  6. You can see progress more easily; if you have 500 small tests to execute you'll see progress every hour instead of 50 big tests where you might see progress only every other day ⇒ Progress is motivating since people can see that they get to a goal.

  7. Short tests tend to be more to the point.

  8. Feature changes are easier to cover in tests (removing or updating a bunch of small test is faster than fixing and writing a big new test, ensuring it still tests everything else).

  9. You get nicer, more trustworthy statistics.

  10. Short test cases facilitate project management; if you have 100 small tests and you know that each will take between 10 and 30 minutes it's easier to guess the total time, compared to having 20 tests, each taking between 10 minutes and 4 days.

Are short software tests the holy grail or are there as well downsides to them?

Not all is perfect when you only work with short software tests. There are still some advantages to having some longer tests as well. 

Here are a few downsides to short software tests:

  1. More precise, smaller test also mean that people test less randomly - random testing means to also test unforeseen scenarios or forgotten features - what you can and can do to mitigate this is to have two kinds of tests: one are the short / detailed tests (do A,B,C,...)  and the others are target driven without details (try to get from A to Z, doing D and K).

  2. You might end up with lots of duplicated tests and you don't even know that they test the same things coming from two different angles. This can be avoided by having a) a clearly structured test directory and b) using the traceability between features and tests. 

  3. When you need to have initial setups and preparation, you will need to do it more often than if it was for one bigger test.

Software testing with MatrixALM

MatrixALM is a software tool that helps you create and maintain the full traceability in your design, from user needs to validation and verification efforts.

Some interesting features that will help you with software testing are:

  • MatrixALM gives you the possiblity to build your own traceability setup for verification as well as validation tests. With this traceability, you can ensure that all specifications have been tested without doing the same thing multiple times for no reason.

  • Multiple test cases can be linked to the same specification. But also the other way around: one test case can be linked to multiple specifications. This reduces the burden of doing double work

  • Dashboards give you an instant overview of the status of your testing at all times.

  • MatrixALM is a cloud-based, database driven tool that enables collaboration during all phases of the design process, including testing.

  • Traceability is one of the core features of MatrixALM, so we make it easy to create trace matrices from requirements up to executed test cases.

  • The platform enables you to document all information related to your design and testing, but as well makes it easy to create the documentation needed for regulatory approvals.

If you want to further explore how we can help you with creating, maintaining and documenting the development and testing of your software, don't hesitate to contact us

About the Author
Wolfgang Huber