Skip to content

Commit

Permalink
Correct Pairwise output order (#828) 94be103
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanKilleen committed Nov 7, 2023
1 parent efa11ae commit 58dabd3
Show file tree
Hide file tree
Showing 3 changed files with 361 additions and 361 deletions.
4 changes: 2 additions & 2 deletions articles/nunit/writing-tests/attributes/pairwise.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ <h2 id="example">Example</h2>
}
</code></pre>
<p>For this test, NUnit currently calls the method six times, producing the following output:</p>
<pre><code class="lang-none">a + y
a - x
<pre><code class="lang-none">a - x
a + y
b - y
b + x
c - x
Expand Down
2 changes: 1 addition & 1 deletion index.json
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@
"articles/nunit/writing-tests/attributes/pairwise.html": {
"href": "articles/nunit/writing-tests/attributes/pairwise.html",
"title": "Pairwise | NUnit Docs",
"keywords": "Pairwise The PairwiseAttribute is used on a test to specify that NUnit should generate test cases in such a way that all possible pairs of values are used. This is a well-known approach for combatting the combinatorial explosion of test cases when more than two features (parameters) are involved. Example Using the Combinatorial attribute, the following test would be executed 12 (3x2x2) times. With Pairwise it is executed only enough times so that each possible pair is covered.. [Test, Pairwise] public void MyTest( [Values(\"a\", \"b\", \"c\")] string a, [Values(\"+\", \"-\")] string b, [Values(\"x\", \"y\")] string c) { Console.WriteLine(\"{0} {1} {2}\", a, b, c); } For this test, NUnit currently calls the method six times, producing the following output: a + y a - x b - y b + x c - x c + y Note that this is not the optimal output. The pairs (-, x) and (+, y) appear twice. NUnit uses a heuristic algorithm to reduce the number of test cases as much as it can. Improvements may be made in the future. Limitations When used on a generic method the programmer must ensure that all possible combinations of arguments are valid. When multiple parameters use the same generic type (e.g.: T) this may not be possible and the attribute may generate invalid test cases. See Also Sequential Attribute Combinatorial Attribute"
"keywords": "Pairwise The PairwiseAttribute is used on a test to specify that NUnit should generate test cases in such a way that all possible pairs of values are used. This is a well-known approach for combatting the combinatorial explosion of test cases when more than two features (parameters) are involved. Example Using the Combinatorial attribute, the following test would be executed 12 (3x2x2) times. With Pairwise it is executed only enough times so that each possible pair is covered.. [Test, Pairwise] public void MyTest( [Values(\"a\", \"b\", \"c\")] string a, [Values(\"+\", \"-\")] string b, [Values(\"x\", \"y\")] string c) { Console.WriteLine(\"{0} {1} {2}\", a, b, c); } For this test, NUnit currently calls the method six times, producing the following output: a - x a + y b - y b + x c - x c + y Note that this is not the optimal output. The pairs (-, x) and (+, y) appear twice. NUnit uses a heuristic algorithm to reduce the number of test cases as much as it can. Improvements may be made in the future. Limitations When used on a generic method the programmer must ensure that all possible combinations of arguments are valid. When multiple parameters use the same generic type (e.g.: T) this may not be possible and the attribute may generate invalid test cases. See Also Sequential Attribute Combinatorial Attribute"
},
"articles/nunit/writing-tests/attributes/parallelizable.html": {
"href": "articles/nunit/writing-tests/attributes/parallelizable.html",
Expand Down
Loading

0 comments on commit 58dabd3

Please sign in to comment.