Skip to content

Commit 354050d

Browse files
committed
Add skipped attribute to skip a failling test
1 parent 37b7079 commit 354050d

5 files changed

Lines changed: 70 additions & 3 deletions

File tree

src/MDAT/MDAT.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Company>MESS</Company>
1111
<PackageProjectUrl>https://github.com/MTESSDev/mdAT</PackageProjectUrl>
1212
<RepositoryUrl>https://github.com/MTESSDev/mdAT</RepositoryUrl>
13-
<Version>1.2.3</Version>
13+
<Version>1.2.4</Version>
1414
<Description>Markdown Auto-Tests for .net 6+, based on MSTestsV2 DataSource.</Description>
1515
</PropertyGroup>
1616

src/MDAT/MarkdownTest.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ private List<object[]> LoadMarkdownFile(MethodInfo testMethod)
7171
if (string.IsNullOrWhiteSpace(doc))
7272
continue;
7373

74+
if (fbc.Arguments is { } && fbc.Arguments.Contains("skipped", StringComparison.InvariantCultureIgnoreCase))
75+
continue;
76+
7477
var values = ExtractTest(testMethod, doc, Path.GetDirectoryName(ParsedPath)!);
7578

7679
displayNames.Add(values.GetHashCode(), "_" + string.Join("_", headings.Where(s => !string.IsNullOrWhiteSpace(s))));
7780

78-
if (fbc.Arguments is { }
79-
&& fbc.Arguments.Contains("selected", StringComparison.InvariantCultureIgnoreCase))
81+
if (fbc.Arguments is { } && fbc.Arguments.Contains("selected", StringComparison.InvariantCultureIgnoreCase))
8082
toSelected.Add(values);
8183
else
8284
to.Add(values);

src/MDATTests/MDATTests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
<ItemGroup>
1212
<None Remove="Tests\test-justme.md" />
13+
<None Remove="Tests\test-skip.md" />
1314
<None Remove="Tests\test.md" />
1415
<None Remove="Tests\test.yaml" />
1516
</ItemGroup>
@@ -29,6 +30,9 @@
2930

3031

3132
<ItemGroup>
33+
<Page Include="Tests\test-skip.md">
34+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
35+
</Page>
3236
<Page Include="Tests\test-justme.md">
3337
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
3438
</Page>

src/MDATTests/MarkdownTestAttributeTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,17 @@ public async Task Md_Justme(int val1, int val2, string expected)
6464
}
6565

6666

67+
/// <summary>
68+
/// Test skip
69+
/// </summary>
70+
[TestMethod]
71+
[MarkdownTest("~/Tests/test-skip.md")]
72+
public async Task Md_Skip(int val1, int val2, string expected)
73+
{
74+
_ = await Verify.Assert(() => Task.FromResult(Utils.Calculer(val1, val2)), expected);
75+
}
76+
77+
6778
private async Task Md2(ObjectOrException<IEnumerable<FormulaireWebFRW1DO>> formList)
6879
{
6980
await Task.Delay(1);

src/MDATTests/Tests/test-skip.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Demo tests
2+
## Cas 1.0
3+
``````yaml skipped
4+
val1: 1
5+
val2: 2
6+
expected: eeeeee
7+
``````
8+
9+
### Cas 1.1
10+
``````yaml --skipped
11+
val1: 212
12+
val2: 2444
13+
``````
14+
15+
#### Cas 1.2.2
16+
``````yaml
17+
val1: 000000000
18+
val2: 000000000
19+
expected: 0
20+
``````
21+
22+
#### Cas 1.2.2.1
23+
``````yaml (skipped)
24+
val1: 212
25+
val2: 2444
26+
expected: 23242353f25
27+
``````
28+
29+
##### Cas 1.2.2.2.1
30+
``````yaml [skipped]
31+
val1: 212
32+
val2: 2444
33+
expected: 222222222222222222222222
34+
``````
35+
36+
###### Cas 1.2.3.4.5.6
37+
``````yaml .skipped.
38+
val1: 9999
39+
expected: xtw22
40+
``````
41+
42+
### Cas x
43+
``````yaml skipped
44+
dsdsfde
45+
``````
46+
47+
### Cas y
48+
``````yaml skipped
49+
regeg
50+
``````

0 commit comments

Comments
 (0)