Skip to content

Commit 0da5f3c

Browse files
committed
B!! make PairwiseTesting deterministic from test run order
1 parent 59bd9ac commit 0da5f3c

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

approvaltests-tests/src/test/java/org/approvaltests/combinations/PairWiseTest.testPairs.approved.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ Testing an optimized 25/400 scenarios:
2424
[2, b, P, 2.2] =>
2525
[3, c, P, 1.1] =>
2626
[4, d, P, 3.3] =>
27-
[5, c, P, 3.3] =>
27+
[5, d, P, 3.3] =>

approvaltests/src/main/java/org/approvaltests/combinations/pairwise/Case.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public static Case ofLength(int size)
3737
}
3838
return c;
3939
}
40+
public static void resetRandom()
41+
{
42+
random = new Random(5);
43+
}
4044
public String getLastKey()
4145
{
4246
return keySet().stream().reduce((ignored, o) -> o).orElse(null);

approvaltests/src/main/java/org/approvaltests/combinations/pairwise/Pairwise.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public Builder withParameters(List<OptionsForAParameter<?>> parameters)
8787
public Pairwise build()
8888
{
8989
List<Case> minimalCases = getMinimalCases(parameters);
90+
Case.resetRandom();
9091
return new Pairwise(this.parameters, minimalCases);
9192
}
9293
public static List<Case> getMinimalCases(List<OptionsForAParameter<?>> parameters)

0 commit comments

Comments
 (0)