TestNG not running tests in testing suite

前端 未结 15 3354
礼貌的吻别
礼貌的吻别 2021-02-19 20:51

I\'m trying to run a testing suite using XML and TestNG, but I\'m always getting the same message using both: Eclipse and the command line:

[TestNG] Running:
  /         


        
相关标签:
15条回答
  • 2021-02-19 21:26

    This can also happen when there is groups usage in suite.xml and @BeforeXXX annotations have missing alwaysRun = true.

    @BeforeTest(alwaysRun = true)
    public void setUp() throws IOException {
    }
    
    0 讨论(0)
  • 2021-02-19 21:31

    I had the same problem and here is my results: In my project I had test file in

    src/test/java/com/temporary/core
    

    and in the same time I had resources for the test in

    src/test/resources/com/temporary/Core
    

    As I found, testng tried to find test file in the second directory.

    When I renamed directory with resources from Core to tcore, the problem was fixed.

    0 讨论(0)
  • 2021-02-19 21:32

    You could also check imports for imported Test annotation, should be:

    import org.testng.annotations.Test;
    @Test
    public myTest(){ ... }
    

    and not for example:

    import org.junit.Test;
    
    0 讨论(0)
  • 2021-02-19 21:32

    I had done all possible solution that everyone shared here and still does not work.

    Heard someone mentioned creating a new workspace.

    So I started a new workspace and recreated the whole TestNG suite & methods.

    It worked!

    Most probably my other TestNg stuff in my previous workspace could have conflicted with the recent Testng setup.

    So starting a new workspace solved!

    0 讨论(0)
  • 2021-02-19 21:36

    if the @Test method is public boolean() with return type as true/flase it doesnot execute.. strange but worked in my-case.

    0 讨论(0)
  • 2021-02-19 21:37

    I had to change my method access modifier to public from private to get it working .

    0 讨论(0)
提交回复
热议问题