Back to QMetry All Products Help Page
Test using Specflow
Specflow by default generates the output results in Specflow JSON format. QMetry can consume it as Cucumber JSON format. The following solution will generate the output result in Cucumber JSON format in parallel and the result could imported to QMetry.
Make the following changes in your Specflow Project to generate result file format as Cucumber JSON
Step 1 : Add Dependencies
https://www.nuget.org/packages/SpecNuts/ https://www.nuget.org/packages/SpecNuts.Json/
Step 2 : Add the below code in .cs of feature file
[BeforeTestRun] public static void BeforeTestRun() { SpecNuts.Reporters.Add(new JsonReporter()); SpecNuts.Reporters.FinishedReport += (sender, args) => { String pathName = "specflow_cucumber.json"; System.IO.File.WriteAllText(pathName, args.Reporter.WriteToString()); Console.WriteLine("Result File: " + System.IO.Directory.GetCurrentDirectory().ToString() + System.IO.Path.DirectorySeparatorChar + pathName); }; }
Step 3 : Open Text Explorer in Visual Studio by Test > Windows > Test Explorer -> Choose Run All
Step 4 : In Visual Studio console, select show output from Test and open Report File as path given in Console
Step 5 : The generated output result file will be in Cucumber JSON format with the name "specflow_cucumber.json". To know how to import the Cucumber JSON file into QMetry, read Test using Cucumber.
Back to QMetry All Products Help Page