Set up your tools

Visual Studio Community

https://www.visualstudio.com/vs/community

Tips:

Ensure you install the following Workloads during the installation process:

  1. ASP.NET and Web Development

  2. Azure Development

Open Tools > Get Tools and Features… from the ribbon menu at the top of Visual Studio to check that these are installed (they’ll have a blue tick next to them).

You’ll also need to add the following extensions to Visual Studio:

  1. SpecFlow for Visual Studio 2017

  2. NUnit3 Test Adapter

  3. NUnit VS Templates

You'll need to install them through the Tools > Extensions and Updates… menu in the ribbon bar at the top of Visual Studio.

Git

https://git-scm.com/download/win

Tips:

Follow the online instructions to download and install.

CHROME Browser

https://www.google.com/chrome/

Tips:

Follow the online instructions to download and install.

Postman

https://www.getpostman.com/apps

Tips:

Follow the online instructions to download and install.

Switchy Omega

Install the following extension into Chrome

https://chrome.google.com/webstore/detail/proxy-switchyomega/padekgcemlokbadohgkifijomclgjgif?hl=en

OPTIONAL (Reporting): Java 8 JDK

The Azure Reports use Java, so you must have a java development kit installed if you want to use it.

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

NOTE: You MUST install the jdk NOT the jre.

Tips:

You will need to update your computer environment variables. There are different ways of getting to the environment variables depending on your operating system version, Google ‘environment variables for java installation’ to check what you need to do for yours.

You need to set your JAVA_HOME environment variable to point at your Java 8 directory. This is something like:
C:\Program Files\Java\jdk1.8.0_131

Add the Java bin directory to your PATH environment variable:
%JAVA_HOME%\bin

OPTIONAL (reporting): INSTALL SCOOP

Scoop is a command line installer tool for windows (in our case, it’ll allow us to then install Allure for reporting). https://scoop.sh/

Copy each of the following two commands and run each of them in the powershell console:

Set-ExecutionPolicy RemoteSigned -scope CurrentUser

iex(new-object net.webclient).downloadstring('https://get.scoop.sh')

Other tools

Instructions for dependencies and plugins are provided in the manuals, or included in your repository at the end of the course


Download your Framework

Clone your repository

This is the Test Automation Framework you created on the course.

  1. Start Visual Studio.

  2. Sign in with the account you used/created on the course.

  3. Select File > Open > Open from source control. This will open the Team Explorer tab with connect selected in the drop down.

  4. Select Manage connections and choose connect to project which will open a pop up showing all of the repositories in your account

  5. Select the repository you want, and select clone.

  6. Your code will now be copied to your computer (your local repository) and will be shown in your Solution explorer. It will likely be showing you the Folder rather than the solution view, if so Click on the Solutions and Folders message at the top and select the .sln option.

  7. Go to Test > Windows > Test Explorer and then click on Run All in the Test Explorer to check everything is working ok!

    Tip:

    If Visual Studio doesn’t automatically re-import your packages from NuGet, you may need to do this manually. The easiest way is to go to Tools > NuGet Package Manager > Package Manager Console and type the following into the console that opens:

    Update-Package -reinstall

    This should fix the issues.


Upgrade to Specflow 3

The instructions for upgrading to SpecFlow 3.


Allure reports

Please note: Allure reports are not a part of the course, however it’s a powerful reporting tool and so information is provided here to help you get started. For further info if your reports aren’t working, please see the Allure reporting documentation here: https://docs.qameta.io/allure/

Generating allure reports from Visual Studio with Specflow

  1. Install a Java SDK (allure is Java based) and scoop as shown in tools section above

  2. Install the Allure command line tool:

    scoop install allure

  3. In Visual Studio, using NuGet, Install SpecFlow.Allure in the acceptance tests project.

    NOTE: If any warnings appear, say ‘Yes’ to all of them.

  4. An allureConfig.Template.json file should have been added to your project. Edit the allureConfig.json to define the directory that you want the results files to be saved in. E.g. to something like:


    C:\Users\User\Documents\allure-results

  5. Navigate to your project directory on your computer (or switch to the folders view in Visual Studio):

    C:\User\<Home Directory>\source\repos\ToolsList

  6. Copy the allureConfig.Template.json to the following directory within your project directory:

    \ToolsList.AcceptanceTests\bin\Debug

    And rename it: allureConfig.json

  7. Run tests

  8. To see the report, we need to generate it from the json results that were generated in the allure-results during the test run. Open powershell, and type:

    1. allure serve <directory-with-json-results>
      This will generate the report in a temporary folder and open it in a browser all in one command.

      e.g: allure serve C:\Users\User\Documents\allure-results

    2. Alternatively, you can use the following two commands to create the allure report in a different directory:

      1. allure generate <directory-with-json-results> -o <directory-for-generated-reports>

      2. allure open <directory-for-generated-reports>

      The first command will generate the report in a folder you specify, the second will open it in the browser. This is helpful if you want to share the results from a consistent location.

  9. If you want to remove the generated report data use the allure report clean command.

GENERATING ALLURE REPORT FROM XML

  1. Open command prompt, and type:
    allure serve <directory-with-xml-results>

NOTE: Not all XML files are compatible with allure


Additional Resources


Keep in Touch

Slack

Safebear slack invite

This is a group chat that includes some of our instructors.

We constantly want to improve our courses and keep them relevant to your job, so we hugely value your feedback.

Call or email us

EMAIL: hello@safebear.co.uk
PHONE: 02921 28 0321

Send us a message

Name *
Name