TestNG. can’t run a single test method

Tags: , , ,



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

Answer

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



Source: stackoverflow