Skip to content

Commit f7c618f

Browse files
committed
Add ReqnrollFormatters.Standard example
1 parent ac1519b commit f7c618f

File tree

7 files changed

+151
-0
lines changed

7 files changed

+151
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@attachment
2+
Feature: Attachments
3+
4+
A short summary of the feature
5+
6+
Scenario: A scenario with an attachment
7+
When the step generates an attachment
8+
And the step generates a test output
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Feature: Basics
2+
3+
This is the description of the **"basics" feature**.
4+
5+
* It includes scenarios to show *basic examples* for formatters.
6+
* This description is displayed as [Markdown](https://en.wikipedia.org/wiki/Markdown) in the formatter output.
7+
8+
@basic
9+
Scenario: Passing scenario
10+
Given the first parameter is "foo bar"
11+
And 42 is the second parameter
12+
When I do something
13+
Then the scenario passes
14+
15+
Scenario: Failing scenario
16+
When I do something
17+
Then the scenario fails
18+
19+
Scenario Outline: Outline with multiple examples
20+
Given the first parameter is "<param>"
21+
And <other param> is the second parameter
22+
When I do something
23+
Then the scenario <result>
24+
Examples:
25+
| param | other param | result |
26+
| foo bar | 12 | passes |
27+
| baz | 23 | fails |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
11+
<PackageReference Include="Reqnroll.MsTest" Version="3.0.0-local" />
12+
<PackageReference Include="MSTest.TestAdapter" Version="3.9.3" />
13+
<PackageReference Include="MSTest.TestFramework" Version="3.9.3" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<None Update="sample-image.png">
18+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
19+
</None>
20+
</ItemGroup>
21+
22+
</Project>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using Reqnroll;
2+
3+
namespace ReqnrollFormatters.Standard.StepDefinitions;
4+
5+
[Binding]
6+
public sealed class ProjectStepDefinitions(IReqnrollOutputHelper outputHelper)
7+
{
8+
[When("I do something")]
9+
public void WhenIDoSomething()
10+
{
11+
}
12+
13+
[Then("the scenario fails")]
14+
public void ThenTheScenarioFails()
15+
{
16+
throw new Exception("simulated error");
17+
}
18+
19+
[Given("the first parameter is {string}")]
20+
public void GivenTheFirstParameterIs(string firstParam)
21+
{
22+
}
23+
24+
[Given("{int} is the second parameter")]
25+
public void WhenIsTheSecondParameter(int secondParam)
26+
{
27+
}
28+
29+
[Then("the scenario passes")]
30+
public void ThenTheScenarioPasses()
31+
{
32+
}
33+
34+
[When("the step generates an attachment")]
35+
public void WhenTheStepGeneratesAnAttachment()
36+
{
37+
outputHelper.AddAttachment("sample-image.png");
38+
}
39+
40+
[When("the step generates a test output")]
41+
public void WhenTheStepGeneratesATestOutput()
42+
{
43+
outputHelper.WriteLine("this is a text" + Environment.NewLine + "this is a second line");
44+
}
45+
46+
[BeforeScenario("@attachment")]
47+
public void BeforeAttachmentScenario()
48+
{
49+
outputHelper.WriteLine("before attachment scenario hook executed");
50+
}
51+
52+
[AfterScenario("@attachment")]
53+
public void AfterAttachmentScenario()
54+
{
55+
outputHelper.WriteLine("after attachment scenario hook executed");
56+
}
57+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://schemas.reqnroll.net/reqnroll-config-latest.json",
3+
4+
"formatters": {
5+
"html": {
6+
"outputFilePath": "reqnroll_report.html"
7+
},
8+
"messages": {
9+
"outputFilePath": "reqnroll_report.ndjson"
10+
}
11+
}
12+
}
745 Bytes
Loading
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36203.30 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReqnrollFormatters.Standard", "ReqnrollFormatters.Standard\ReqnrollFormatters.Standard.csproj", "{463D753E-74D1-4373-AE79-D824EEE8EFBE}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{463D753E-74D1-4373-AE79-D824EEE8EFBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{463D753E-74D1-4373-AE79-D824EEE8EFBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{463D753E-74D1-4373-AE79-D824EEE8EFBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{463D753E-74D1-4373-AE79-D824EEE8EFBE}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {DFB98AEE-90F4-496E-B220-9BE327331C7D}
24+
EndGlobalSection
25+
EndGlobal

0 commit comments

Comments
 (0)