-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to create md based report #10
Comments
This feature should be available in v3.3.0. For more details please review readme section https://github.com/cezarypiatek/NScenario#exporting-scenario-transcription |
Brilliant. Thanks a lot. |
Cezary,
I created also a IClassFixture for setting up the plumbing for the md reporting as follows
So, my test class derives uses that fixture:
Now, unfortunately I cannot combine both output in console and output in md. I guess it must be something trivial, but I cannot find it :) All the best to you and our Ukrainian friends. |
I'm not an expert in XUnit but I think you cannot use I've added overload to Please try the following solution: [CollectionDefinition("NScenarioCollection")]
public class NScenarioCollection : ICollectionFixture<NScenarioReporting>
{
// This class has no code, and is never created. Its purpose is simply
// to be the place to apply [CollectionDefinition] and all the
// ICollectionFixture<> interfaces.
}
public class NScenarioReporting : IDisposable
{
public MarkdownFormatterOutputWriter ReportWriter { get; } = new MarkdownFormatterOutputWriter(title: "Sample tests with NScenario");
public NScenarioReporting()
{
}
public void Dispose()
{
// clean-up code
ReportWriter.Save("Report.md");
ReportWriter.ExportToHtml("Report.html");
}
}
[Collection("NScenarioCollection")]
public class Tests
{
private readonly IScenarioOutputWriter scenarioOutputWriter;
public Tests(ITestOutputHelper output, NScenarioReporting mdSetup)
{
scenarioOutputWriter = new ComposeScenarioOutputWriter(new IScenarioOutputWriter[]
{
mdSetup.ReportWriter,
new StreamScenarioOutputWriter(new XUnitOutputAdapter(output))
});
}
[Fact]
public async Task should_present_basic_scenario()
{
var scenario = TestScenarioFactory.Default(scenarioOutputWriter);
await scenario.Step("This is the first step", () =>
{
// Here comes the logic
});
await scenario.Step("This is the second step", () =>
{
// Here comes the logic
});
await scenario.Step("This is the third step", () =>
{
// Here comes the logic
});
}
} Not sure how this behaves when tests are run in parallel.... |
If i understand you correctly, combining both outputs (md and console) works seamless when using NUnit? |
I'm using NUnit+NScenario on a daily basis and it works fine. Test scenario transcriptions exported to HTML are later referenced in TeamCity as Report Tab https://www.jetbrains.com/help/teamcity/including-third-party-reports-in-the-build-results.html - very useful ;) |
HI Cezary, |
For smooth communication with the business stakeholders, it could be useful to be able to generate from the test output a .md file per scenario. A build server task could publish then the md material to a place where it has valuable meaning for stakeholders.
The text was updated successfully, but these errors were encountered: