TestNG not running tests in testing suite

前端 未结 15 2184
北荒
北荒 2021-02-19 21:16

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:25

    In my case, the test was accidentally marked as "enabled = false" inside the @Test(...). Make sure the value for you is marked as "true".

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

    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:29

    In my case, the @Test annotation was imported automatically by IDE as import org.junit.Test.

    After changing it to import org.testng.annotations.Test the tests got picked up correctly.

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

    There were two problems in the code:
    1. This was because, my @Test method was calling another method which will return a Boolean. Once I commented the same @Test and the method, the whole testNG xml started working.
    2. Second mistake was , I was using the below ,that was a wrong assignment of Poi Classes. Workbook WB = new XSSFWorkbook(FIS); Sheet WSh= WB.getSheetAt(1); I changed the above to below: XSSFWorkbook WB = new XSSFWorkbook(FIS); XSSFSheet WSh= WB.getSheetAt(1); After both of those above corrections, the script started working.

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

    Apparently, TestNG is wrong regarding generating the XML file for the testing suite.

    Even though following their instructions to the letter, my tests were not running. I ended up with this testng.xml file and my tests, started to run:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
    <suite name="TestingSuite" parallel="none">
      <test name="Test1">
        <classes>
          <class name="tests.Page1"/>
        </classes>
      </test>
        <test name="Test 2">
            <classes>
                <class name="tests.Page2"/>
            </classes>
        </test>
    </suite>
    
    0 讨论(0)
  • 2021-02-19 21:37

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

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