Skip to content
Advertisement

TestNG. can’t run a single test method

I have Selenium+Eclipse+Java Project+Eclipse TestNG plugin. 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. I can’t understand why test2 is executed also. Because there is a comment “//” before @Test annotations.

Any ideas? thanks in advance

Advertisement

Answer

First, you should clean the class files, then compile the project again

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement