2

I am trying to run nunit3 parameterized test using TestCase attribute.

My Test method looks like:

[Test]
        [TestCase("testuser")]
        public void OBA_Test(String name)
        {
            driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10000));
            driver.Navigate().GoToUrl(baseURL + somewebsite)
            // Code to test website. 
        }

Then I take the dll and try to run using

nunit3-console.exe "C:\temp\test\Selenium Testing Prod.dll" /run:"SeleniumTests.SeleniunProdTest.OBA_Test(\"testuser\")"

enter image description here

What am I doing wrong here? Any pointers ?

Ref: nunit-console does not run tests parameterized with TestCase attribute

ProgSky
  • 2,530
  • 8
  • 39
  • 65

2 Answers2

3

The message is telling you that there is no /run option recognized by the version of NUnit you are using. The /run of NUnit V2 was replaced by the enhanced /test option in NUnit 3.

Charlie
  • 12,928
  • 1
  • 27
  • 31
  • Sorry for the delay response. I used Nunit3 and it was all good. I used TestContext.Parameters.Get("variable") to get input from command line and then use --params. I am accepting your response as solution and will also post my solution. – ProgSky Jul 13 '17 at 14:14
1

I was using nunit version 2 which is missing some feature. I updated to version 3 and followed this article : http://executeautomation.com/blog/passing-parameters-to-nunit-test-via-cli-using-params/

essentially in my [Setup] I collected my command line input as :

name = TestContext.Parameters.Get("empname");

and used this in my [Test] and used --params in commandline as below:

nunit3-console.exe --params:empname=testemp "C:\temp\Debug_PROD\Selenium Testing Prod.dll"
ProgSky
  • 2,530
  • 8
  • 39
  • 65