简体   繁体   English

TestNG没有运行测试

[英]TestNG is not running tests

I've set up TestNG and am trying to run it, but it's not running any of my classes. 我已经设置了TestNG并试图运行它,但是它没有运行我的任何课程。 Here's the output: 这是输出:

[SuiteRunner] Created 1 TestRunners
[TestRunner] Running test GRP-test on 0  classes,  included groups:[test ] exclu
ded groups:[]
===== Invoked methods
=====
Creating C:\Users\myName\workspace\Test\test-output\Test by groups\GRP-test.ht
ml
Creating C:\Users\myName\workspace\Test\test-output\Test by groups\GRP-test.xm
l

===============================================
    GRP-test
    Tests run: 0, Failures: 0, Skips: 0
===============================================


===============================================
Test by groups
Total tests run: 0, Failures: 0, Skips: 0
===============================================

Creating C:\Users\myName\workspace\Test\test-output\testng-results.xml
[TestNG] Time taken by org.testng.reporters.XMLReporter@4e27c652: 12 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 1 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter@201075c5: 3 ms
Creating C:\Users\myName\workspace\Test\test-output\index.html
[TestNG] Time taken by org.testng.reporters.jq.Main@bb2d83d: 29 ms
Creating C:\Users\myName\workspace\Test\test-output\old\Test by groups\toc.htm
l
Creating C:\Users\myName\workspace\Test\test-output\old\Test by groups\GRP-tes
t.properties
Creating C:\Users\myName\workspace\Test\test-output\old\Test by groups\index.h
tml
Creating C:\Users\myName\workspace\Test\test-output\old\Test by groups\main.ht
ml
Creating C:\Users\myName\workspace\Test\test-output\old\Test by groups\groups.
html
Creating C:\Users\myName\workspace\Test\test-output\old\Test by groups\methods
.html
Creating C:\Users\myName\workspace\Test\test-output\old\Test by groups\methods
.html
Creating C:\Users\myName\workspace\Test\test-output\old\Test by groups\methods
-alphabetical.html
Creating C:\Users\myName\workspace\Test\test-output\old\Test by groups\methods
-alphabetical.html
Creating C:\Users\myName\workspace\Test\test-output\old\Test by groups\classes
.html
Creating C:\Users\myName\workspace\Test\test-output\old\Test by groups\reporte
r-output.html
Creating C:\Users\myName\workspace\Test\test-output\old\Test by groups\methods
-not-run.html
Creating C:\Users\myName\workspace\Test\test-output\old\Test by groups\testng.
xml.html
Creating C:\Users\myName\workspace\Test\test-output\old\index.html
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@3c8fa832: 27 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@4045acb5: 0 ms

and here's my xml: 这是我的xml:

   <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
    <suite name="Test by groups">
      <test verbose="10" name="GRP-test">
       <groups>
        <run>
          <include name="test"/>
        </run>
       </groups>

      </test> <!-- GRP-test -->
    </suite> <!-- Test by groups -->

What I'm trying to do is get my selenium tests to run. 我正在尝试做的是运行硒测试。 I've gotten them to run successfully in eclipse, but I'm moving over to the command line to make it a bit easier (irony, right?). 我已经让他们在eclipse中成功运行,但是我将移至命令行以使其稍微简单一些(讽刺,对吗?)。

Here's my command line: 这是我的命令行:

C:\Users\myName\workspace\Test>java -cp C:\Users\myName\Documents\Eclipse\li
bs\testng-6.8.jar;C:\Users\myName\workspace\Test\bin\test\* org.testng.TestNG
testng.xml

You need to add classes or package from which the groups would be picked up. 您需要添加将从中拾取组的类或包。 Just the groups tag won't work. 只是groups标签不起作用。

Adding an example from testng documentation (you can specify a package as well based on need): 从testng 文档中添加示例(您也可以根据需要指定软件包):

<test name="Test1">
  <groups>
    <run>
      <include name="functest"/>
    </run>
  </groups>
  <classes>
    <class name="example1.Test1"/>
  </classes>
</test>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM