In this tutorial, we will create a NUnit Test Case in C#, using Selenium's WebDriver for browser automation.


The test case opens a Google page, searches for a given keyword and checks the results returned by Google.

Note: The ChromeDriver must be on the path.

using System;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

namespace SeleniumTests
    public class WdriverTest
    private IWebDriver driver;

    public void SetupTest()
        driver = new ChromeDriver();
    public void TeardownTest()
        catch (Exception)
        // Ignore errors if unable to close the browser
    [Test, Property("Requirement", "CALC-1")]
    public void GoogleTest()
        // Open Google search engine.
        // Assert Title of page.
        Assert.AreEqual("Google", driver.Title);
        // Provide search term as "Selenium OpenQA"
        IWebElement query = driver.FindElement(By.Name("q"));
        query.SendKeys("Selenium OpenQA");
        //Assert.AreEqual("Selenium OpenQA - Google Search",driver.Title);
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true
  "testRunner": "nunit",
  "dependencies": {
        "NUnit": "3.5.0",
        "dotnet-test-nunit": "3.4.0-beta-2",
        "Selenium.WebDriver.ChromeDriver": "2.27.0",
        //"Selenium.Firefox.WebDriver": "0.13.0",
        //"Selenium.WebDriver": "3.0.1"
        "CoreCompat.Selenium.WebDriver": "2.54.0-beta002" 
  "frameworks": {
    "netcoreapp1.1": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.1.0"
      "imports": "dnxcore50"

After successfully running the Test Case and generating the NUnit XML report (e.g., TestResult.xml), it can be imported to Xray via the REST API or the Import Execution Results action within the Test Execution.

NUnit's Test Case is mapped to a Generic Test in Jira, and the Generic Test Definition field contains the name of the namespace, class, and the method name that implements the Test case.

The Execution Details of the Generic Test contains information about the context, which in this case corresponds to the Test case method itself.