简体   繁体   English

测试NG。 无法运行单个测试方法

[英]TestNG. can't run a single test method

I have Selenium+Eclipse+Java Project+Eclipse TestNG plugin.我有 Selenium+Eclipse+Java Project+Eclipse TestNG 插件。 For example, my code is:例如,我的代码是:

public class TestClass {

@Test
public void test1() throws Exception {
    ...
    }

//@Test
public void test2() throws Exception {
    ...
    }

When i run TestClass as TestNG, both tests are executed.当我将 TestClass 作为 TestNG 运行时,两个测试都被执行。 I can't understand why test2 is executed also.我不明白为什么 test2 也被执行。 Because there is a comment "//" before @Test annotations.因为@Test 注解前有一个注解“//”。

Any ideas?有任何想法吗? thanks in advance提前致谢

首先,您应该清理类文件,然后再次编译项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM