Setting up to use Allure

Install a Java SDK (allure is Java based)

Update the environment variables (For getting to and updating the environment variables, it differs depending on system used so google it to find out how for your version of windows):

  • add a JAVA_HOME

  • In your environment variables, update the PATH to add the line: %JAVA_HOME%\bin 

Install allure

In Visual Studio, using NuGet, Install SpecFlow.Allure

Update your Allure.Config.json to indicate the file to put the Allure report in

Copy the Allure.Config.json to the directory: ..\ToolsList.AcceptanceTests\bin\Debug

Run tests

Open command prompt, and type:
allure serve filePathToAllureResults

NOTE: Default value for the allure.directory in allureConfig.json is "allure-results", default working directory in NUnit 3.* is the working directory of console runner.  If the config isn’t updated to define a folder for the results, the results will be saved somewhere like:
C:\User\AppData\Local\Temp\allure-results




Generating Allure report from xml

Where an XML file has been generated and you want to convert it to an allure report

Open command prompt, and type:
allure generate filePathToXMLFile

allure open filePathToGeneratedAllureResults

NOTE: Not all XML files are compatible with allure

 

App.Config

<?xml version="1.0" encoding="utf-8"?>

<configuration>

<configSections>

<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />

</configSections>

<appSettings>

<add key="browser" value="chrome" />

<add key="url" value="http://toolslist.safebear.co.uk:8080" />

</appSettings>

<specFlow>

<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->

<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->

<unitTestProvider name="NUnit" />

<plugins>

<add name="Allure" type="Runtime" />

</plugins>

<stepAssemblies>

<stepAssembly assembly="Allure.SpecFlowPlugin" />

</stepAssemblies></specFlow>

<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

<dependentAssembly>

<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />

<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />

</dependentAssembly>

<dependentAssembly>

<assemblyIdentity name="TechTalk.SpecFlow" publicKeyToken="0778194805d6db41" culture="neutral" />

<bindingRedirect oldVersion="0.0.0.0-2.4.0.0" newVersion="2.4.0.0" />

</dependentAssembly>

</assemblyBinding>

</runtime>

</configuration>

 

Allure.Config.json

{

"allure": {

"directory": "allure-results",

"links": [

"{link}",

"{issue}",

"{tms}"

]

},

"specflow": {

"stepArguments": {

"convertToParameters": "true",

"paramNameRegex": "",

"paramValueRegex": ""

},

"grouping": {

"suites": {

"parentSuite": "^parentSuite:?(.+)",

"suite": "^suite:?(.+)",

"subSuite": "^subSuite:?(.+)"

},

"behaviors": {

"epic": "^epic:?(.+)",

"story": "^story:?(.+)"

},

"packages": {

"package": "^package:?(.+)",

"testClass": "^class:?(.+)",

"testMethod": "^method:?(.+)"

}

},

"labels": {

"owner": "^owner:?(.+)",

"severity": "^(normal|blocker|critical|minor|trivial)"

},

"links": {

"issue": "^issue:(\\d+)",

"tms": "^tms:(\\d+)"

}

}

}


Install Scoop: Copy all of the following command and paste it into Powershell

Set-ExecutionPolicy RemoteSigned -scope CurrentUser iex(new-object net.webclient).downloadstring('https://get.scoop.sh')

 

Install Chocolatey: Copy all of the following command and paste it into Powershell

Set-ExecutionPolicy AllSigned -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))