Skip to main content

Comments

8 comments

  • Mario Steiner

    Update: Thanks @matusnovak for sharing a workaround with the community. Follow the steps below:

    I am assuming you have the following dependency in your csproj file:

    <PackageReference Include="SpecRun.SpecFlow" Version="3.3.41" />

    Create a file named Default.srprofile right next to your csproj file (maybe a root directory of your project) with the following contents:

    <?xml version="1.0" encoding="utf-8"?>
    <TestProfile xmlns="http://www.specflow.org/schemas/plus/TestProfile/1.5">
    	<Settings projectName="HotelBookingTests" />
    	<Execution stopAfterFailures="3" testThreadCount="1" testSchedulingMode="Sequential" />
    	<Report>
    		<Template name="../../../Templates/CucumberJson.cshtml" outputName="Report.json"/>
    	</Report>
    	<TestAssemblyPaths>
    		<TestAssemblyPath>Example.dll</TestAssemblyPath>
    	</TestAssemblyPaths>
    </TestProfile>

    This profile specifies that the report shall be created as Report.json with the CucumberJson.cshtml template.

    To get the template, download the following package: https://www.nuget.org/packages/SpecRun.Runner/ and extract it as a zip file. No need to install it at all, just open with some zip manager, 7-Zip will do just fine.

    The CucumberJson.cshtml is in the templates folder within the NuGet package.

    You will need to create a folder named Templates in your project, right next to your Default.srprofile file and put the JSON template in that folder.

    That's all. After that all I did was to run the tests (In Visual Studio: Test -> Run all tests) and it created the test report as a JSON file. It should also work with .NET Core.

    I don't understand why the JSON template is hidden in such way, why not just provide it within SpecFlow documentation? One does not automatically assume that they need to extract the nuget package.

    0
  • Sergio Freire

    Great work Mario Steiner. Let me also share a tutorial for Xray on Jira server/DC that exemplifies precisely this. It's a bit old but I think it's in line with what you shared.

     

    0
  • Hammer, Luke (Contractor)

    Will this work with .Net 6???

    0
  • Manoj Narikadapu

    Thanks @Mario Steiner

    But I am getting conflict here, When I create specflow nunit project by default SpecFlow.NUnit is part of csproj

    But you are suggestion to add  SpecRun.SpecFlow this makes the conflict and getting build error

    0
  • Павел Левчук

    I was able to workaround the limitation by using Pickles - the open source Living Documentation Generator (picklesdoc.com)

    dotnet pickles --output-directory=/app/TestResults --link-results-file=./TestResults/TestResults.{framework}.{project}.xml --documentation-format=cucumber --test-results-format=xunit2 --excludeTags=ignore

    1
  • hi Павел Левчук 

     

    could you share a solution?

    0
  • Aaron Jiang

    Hi Павел Левчук ,is that mean you can generate the JSON report when finish the test using Pickles - the open source Living Documentation Generator (picklesdoc.com)

    0
  • Nurperi Nuralieva

    Pickles can generate cucumber json, but I have scenario outlines with examples, and pickles cannot deal with it. Looks like the only way is transformation from xml to cucumberjson, or speckflow json to cucumber json. 

    0

Please sign in to leave a comment.

Powered by Zendesk