Attention: this project was formerly known as SpecFlow.Reporting. This is not an offical SpecFlow package and the name clashed with some of the official SpecFlow packages/namespace. Therefor it was renamed to SpecResults.
All previous published versions of SpecFlow.Reporting are still available on NuGet.org, alltough they aren't listed anymore.
SpecResults was created to get better feedback from your automated SpecFlow testsuite. With unit tests most times reporting is only interesting for developers and testers. But when practicing BDD, the output of your automated tests might be valuable for the whole development team, management and pherhaps even end-users.
SpecResults makes it easy to extend SpecFlow by creating reporters which can write output in all kinds of formats and can even be enriched with additional data.
Add one or more reporters to your SpecFlow project, for example:
- Json: reports in json format example
- Plain Text: reports in plain text format example
- Xml: reports in xml format example
- WebApp: writes an interactive, responsive, client-side web application, in which users can browse and search features, scenarios and steps example
Work in progress:
- Xml.NUnit: less technical reporting in NUnit's xml output format
Make your existing StepDefinitions class inherit from SpecResults.ReportingStepDefinitions
Initialize and add the reporter(s) in [BeforeTestRun] and register on one of the events to get notified when something gets reported:
[Binding] public class StepDefinitions : ReportingStepDefinitions { [BeforeTestRun] public static void BeforeTestRun() { Reporters.Add(new JsonReporter()); Reporters.Add(new XmlReporter()); Reporters.Add(new PlainTextReporter()); Reporters.FinishedReport += (sender, args) => { Console.WriteLine(args.Reporter.WriteToString()); }; } }
Create a new project and add the SpecResults package
Add a class which inherits from SpecResults.Reporter and implement the WriteToStream method:
namespace SpecResults.MyFormat { public class MyFormatReporter : SpecResults.Reporter { public override void WriteToStream(Stream stream) { // // TODO: Serialize this.Report to the stream // } } }
- Xml.MsTest
- Docx
- Xlsx
- ...