0

I have problem with running test. I have one test with testCaseSource(three testCase) and now then I click to run test, they run together. I want them to run one after the other, is it possible?

static object[] TestData =
{
        new object[] {"sssssssssssss"},
        new object[] {"qwqwe"},
        new object[] {"aaaaaaaaaaaaa"}
    };
    [SetUp]
    public void Initialize()
    {
        driver.Navigate().GoToUrl("http://www.google.lt");
    }


    [Test,TestCaseSource("TestData"),]
    public void TestMethod(string a)
    {
        IWebElement element = driver.FindElement(By.Name("q"));
        element.SendKeys(a);
    }

    [TearDown]
    public void Close()
    {
        driver.Close();
    }
LTU
  • 195
  • 1
  • 3
  • 18
  • It seems like there is only one test attribute(annotation), TestCaseSource annotation is acts like a data source (Parameter to the test method)... What u want to acheive here? – Aishu Jul 26 '16 at 05:56
  • I think your need the `[Test, Order(1)]` Attribute for your Tests. With the Order(i) you can specifies which test starts first in NUnit. http://stackoverflow.com/questions/6248079/how-to-order-nunit-tests – Smartis has left SO again Jul 26 '16 at 06:11
  • I want something like: 1) Open browser. 2)Enter string ("sssssssssssss"). 3) Close browser. After browser close, repeat test with different data, so 1) Open browser. 2)Enter string ("qwqwe"). 3) Close browser. and so on. – LTU Jul 26 '16 at 06:14
  • I found my error. In the SetUp I only have to write "driver = new FirefoxDriver();" and "driver.Navigate().GoToUrl("http://www.google.lt");" I have to put in the Test. – LTU Jul 26 '16 at 06:34

0 Answers0