无法在TestNG中运行测试用例

时间:2016-08-23 11:30:58

标签: eclipse testng testng-eclipse

我无法在我的eclipse IDE中运行测试用例。当我运行一个或多个测试用例时,我收到以下消息。谁能告诉我解决方案?

 [RemoteTestNG] detected TestNG version 6.8.9
    [RemoteTestNG] Invoked with -serport 57601 -protocol json -d F:\encoreworks\maininterface\test-output C:\Users\Admin\AppData\Local\Temp\testng-eclipse--1595370957\testng-customsuite.xml 
    [BaseMessageSender] Waiting for Eclipse client on localhost:57601
    [BaseMessageSender] Received a connection from Eclipse on localhost:57601
    [BaseMessageSender] Connection established, starting reader thread
    [BaseMessageSender] ReaderThread waiting for an admin message
    [JsonMessageSender] Sending message [GenericMessage suiteCount:1 testCount:1]
    [BaseMessageSender] ReaderThread received admin message:>ACK
    [BaseMessageSender] Received ACK:>ACK
    [BaseMessageSender] Received ACK:>ACK
    [TestNG] Running:
      C:\Users\Admin\AppData\Local\Temp\testng-eclipse--1595370957\testng-customsuite.xml

    [JsonMessageSender] Sending message [SuiteMessage suite:Default suite starting methodCount:0]
    [JsonMessageSender] Sending message [TestMessage suite:Default suite testName:Default test passed:0 failed:0]
    [BaseMessageSender] Received ACK:>ACK
    [BaseMessageSender] Received ACK:>ACK
    [BaseMessageSender] Received ACK:>ACK
    [BaseMessageSender] Received ACK:>ACK
    [JsonMessageSender] Sending message [TestMessage suite:Default suite testName:Default test passed:0 failed:0]
    [BaseMessageSender] Received ACK:>ACK
    [BaseMessageSender] Received ACK:>ACK
    [JsonMessageSender] Sending message [SuiteMessage suite:Default suite ending methodCount:0]

    ===============================================
    Default suite
    Total tests run: 0, Failures: 0, Skips: 0
    ===============================================

    [BaseMessageSender] Received ACK:>ACK
    [BaseMessageSender] Received ACK:>ACK

2 个答案:

答案 0 :(得分:1)

我面临类似的问题。升级testng,eclipse,没有任何帮助。最后,我可以解决这个问题。适用于我的解决方案如下:
Maven中提到的Testng版本: 6.8.7
Eclipse TestNG插件版本: 6.11
Eclipse版本: Neon.3版本(4.6.3)

转到Eclipse> Project Explorer>右键单击项目名称>转到Build Path>配置生成路径>打开项目的属性窗口>搜索testng>展开testng>出现Maven选项>单击Maven>取消选中“ Properties( TestNG CLI参数)“选项> eclipse setting screenshot>申请

如果使用的是Eclipse LUNA版本,请执行以下步骤: 转到Eclipse>项目资源管理器>右键单击项目名称>转到构建路径>配置构建路径>项目属性窗口打开>搜索并单击testng>启用项目特定的testng复选框

答案 1 :(得分:0)

我遇到了同样奇怪的问题,并通过编译项目并再次运行测试来解决它。

讲述整个故事: 在我的maven项目中,我删除了" target"文件夹并尝试运行测试。它现在失败了"无法读取类上的方法...无法解析类引用...."。

因此,通过使用" package" -goal执行Maven,我意识到我的pom.xml出现故障(maven-compiler-plugin中的目标版本不是1.8)。修复此问题后,我的Maven构建运行没有问题。随着新目标折叠中的新类,TestNG再次运行。