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 {

public void test1() throws Exception {

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


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

Source: stackoverflow