我不能让我的测试在硒上运行?

时间:2015-08-12 21:23:25

标签: java selenium testing qa

我在Java中使用selenium,但当我按"运行"时,它没有运行任何东西,控制台说"测试运行:0" 我的代码或我构建它的方式有问题吗?

我的代码示例:

public class TestSuite {
public static void count() throws InterruptedException{
driver = new FirefoxDriver...etc
}
}

由于

1 个答案:

答案 0 :(得分:1)

继续下去并不多,但有两件事:

  1. 大多数测试框架(jUnit,TestNG,... - 您使用的是哪一个?)依赖于要测试的方法上方的@Test 注释
  2. 通常那些带注释的方法不是static,但反思应该能够解决这个问题。
  3. Normaly你的测试类结构看起来应该更像这样:

    public class TestClass {
        @Test
        public void count() {
            // your actual test code
        }
    }