Functional, structural and mutation testing
Create a software program
triangle.rb file contains an algorithm to create a Triangle instance.
The class has several methods to verify a triangle type, etc.
Generated test data
- equivalence partitioning,
- boundary value analysis,
- category partitioning methods to generate data.
The data is stored in
Compute program complexity
Using McCabe formula compute the program complexity.
M = E - N + 2*P
As the graph shows:
E = 11
N = 9
P = 3
M = 11 - 9 + 2 * 3 = 8
Cyclomatic complexity can also be computed with the formula:
π - s + 2, where π = the number of decision points and s = the number of exit points.
π = 11
s = 3
hence the cyclomatic complexity = 11 - 3 + 2 = 10
- $ rvm install rbx-head
- $ rvm use rbx-head
- gem install mutant
More info about the gem: https://github.com/mbj/mutant
To generate mutation use the command:
$ rvm use rbx-head
$ mutant -I lib -r test_triangle '::Triangle' --rspec-dm2