如何在NUnit 3中使用测试套件

时间:2016-08-15 13:18:46

标签: c# nunit assert nunit-3.0

我正在使用NUnit 3并且在使用测试套件时遇到问题。我看到了这个Documentation page,但它是旧版本的,我在新文档中找不到任何内容。

这不起作用,因为[Suite]无效。

    public static void main(String[] args)     {

        WebDriver fb = new FirefoxDriver();     

        fb.get("https://www.facebook.com/");   
        fb.findElement(By.xpath("id('u_0_1')")).sendKeys("Tomprakash");
        fb.findElement(By.xpath("id('u_0_3')")).sendKeys("Sahu");
        fb.findElement(By.xpath("id('u_0_6')")).sendKeys("7869084527");
        fb.findElement(By.xpath("id('u_0_9')")).sendKeys("7869084527");
        fb.findElement(By.xpath("id('u_0_b')")).sendKeys("cs083595");
        Select date = new Select(fb.findElement(By.xpath("id('day')")));
        date.selectByVisibleText("24");
        Select month = new Select(fb.findElement(By.xpath("id('month')")));
        month.selectByVisibleText("Dec");
        Select year = new Select(fb.findElement(By.xpath("id('year')")));
        year.selectByVisibleText("1989");
        fb.findElement(By.className("_58mt")).click(); //this code is working for female
        //fb.findElement(By.className("_5k")).click(); //this code is not working for male
        fb.findElement(By.name("Create an account")).submit();
    }

}

1 个答案:

答案 0 :(得分:2)

SuiteAttribute has been removed from NUnit 3(请参阅属性表)。

您应该在命令行运行器中使用展开的Test Selection Language来控制要运行的测试组,或者以不同方式构建测试。