MUTATION TESTING

NO MORE FAIRY TALES

SPEAKER

{
	"name": "ng-henry-ruhs",
	"description": "Senior Frontend Engineer at Avantgarde Labs",
	"version": "1.9.82",
	"license": "GPL-3.0",
	"keywords":
	[
		"CMS Founder",
		"Frontend Architect",
		"JavaScript Evangelist",
		"WPO Expert",
		"GitHub Fanboy"
	],
	"website": "https://redaxmedia.com",	
	"twitter": "https://twitter.com/redaxmedia",
	"github": "https://github.com/redaxmedia"
}

MUTATION TESTING

OVERVIEW

WHY IT MATTERS

HYPOTHESIS

BASIC CONCEPTS

IN PRACTICE

CONLUSIONS WE DRAW

MUTATION TESTING

WHY IT MATTERS

1. Measure Quality

2. Uncover Gaps

3. Detect Faults

4. Uncover Ambiguities

5. Improve Stability

MUTATION TESTING

HYPOTHESIS

1. Competent Programmer

2. Coupling Effect

MUTATION TESTING

BASIC CONCEPTS

1. Mutators

2. Mutants

3. Mutation Score

MUTATION TESTING

IN PRACTICE

"Let's kill a hord of mutants"


npm install stryker-cli

INSTALL

module.exports = config =>
{
	config.set(
	{
		mutator: 'typescript',
		packageManager: 'npm',
		reporters:
		[
			'clear-text'
		],
		testRunner: 'mocha',
		testFramework: 'mocha',
		tsconfigFile: 'tsconfig.json',
		mochaOptions:
		{
			opts: 'tests/mocha.opts'
		},
		mutate:
		[
			'src/**/*.ts'
		]
	});
};

stryker init

CONFIGURE


stryker run

RUN

Ran 0.64 tests per mutant on average.
--------------------|---------|----------|-----------|------------|----------|---------|
File                | % score | # killed | # timeout | # survived | # no cov | # error |
--------------------|---------|----------|-----------|------------|----------|---------|
All files           |  100.00 |       54 |         0 |          0 |        0 |      36 |
 common.service.ts  |  100.00 |       33 |         0 |          0 |        0 |      21 |
 crud.module.ts     |  100.00 |        2 |         0 |          0 |        0 |       0 |
 crud.service.ts    |  100.00 |       12 |         0 |          0 |        0 |       8 |
 delete.service.ts  |  100.00 |        1 |         0 |          0 |        0 |       1 |
 get.service.ts     |  100.00 |        2 |         0 |          0 |        0 |       2 |
 patch.service.ts   |  100.00 |        1 |         0 |          0 |        0 |       1 |
 post.service.ts    |  100.00 |        1 |         0 |          0 |        0 |       1 |
 put.service.ts     |  100.00 |        1 |         0 |          0 |        0 |       1 |
 request.service.ts |  100.00 |        1 |         0 |          0 |        0 |       1 |
--------------------|---------|----------|-----------|------------|----------|---------|

"Time for a live demo"

MUTATION TESTING

CONCLUSIONS WE DRAW

1. Evaluates testing quality

2. Extremely time consuming

3. Highest level of stability

4. Slow execution time

"Ask your question now"


process.exit();

THANK YOU

MUTATION TESTING

By Henry Ruhs

MUTATION TESTING

No more fairy tails

  • 284
Loading comments...

More from Henry Ruhs