Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between regression testing and mutation testing?

Just wonder what the difference is. I need some concise explanation.The wikipedia is a bit too verbose for me.

like image 601
Hongxu Chen Avatar asked Dec 05 '22 17:12

Hongxu Chen


2 Answers

Regression testing is actually a test suite that is supposed to test as much functionality of your application as possible.

The idea is that, when you make a change to your application as required for bug fixing or new functionality, regression testing will hopefully catch any problems (or regressions) with your changes.

It's called regression since the vast majority of tests have been added due to previous bugs hence, if they find a problem, you have regressed to a previous state (in which the problem once again exists).

In other words, regression testing tests your application.


Mutation testing is actually introducing small errors (called mutations) into your application (errors that are not supposed to fix bugs or provide new functionality) to see if your test suite picks them up.

The idea is that, if your test suite doesn't pick up the mutations, it is deficient and should have more test cases added.

In other words, mutation testing tests your test suite rather than your application.

like image 106
paxdiablo Avatar answered Jan 06 '23 17:01

paxdiablo


Different purposes. Imagine you have a product, say version 1.0, with a bug #123. In version 1.01 of your application you solve that bug but adding a new feature you introduce a new bug, say #124. Now you have this situation:

  • Version 1.0: bug #123
  • Version 1.01: bug #123 solved, new bug #124.

Now imagine you release the brand new version 2.0. If, fixing the bug #124 or adding a new feature your bug #123 is active again then you have a regression.

  • Version 1.0: bug #123
  • Version 1.01: bug #123 solved, new bug #124.
  • Version 2.0: bug #123 active (REGRESSION!), bug #124 solved.

Regression testing is to find this kind if issues.

Muation testing is a "test" for tests. Imagine you have a test suite, how can you be sure your tests will find errors? You may want to introduce a small change (yes, a bug!) in your code to see if your tests will find it. This is mutation testing.

like image 41
Adriano Repetti Avatar answered Jan 06 '23 19:01

Adriano Repetti