# 问题如下
这个最近修改了各种类型的报告,再一次修改中不知道怎么了,就出现以下问题:
右键 testng.xml 文件 run as 是可以成功的,但在 build.xml 使用 ant 的方法就不行,具体报错在最后,报错的那行我也标记出来了,已经搞了两天了。
<target name="test">
<testng classpathref="ant-appium.classpath"
outputdir="test-results"
haltonfailure="true"
useDefaultListeners="false"
-----76行--- listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter">
<xmlfileset dir="." includes="testng.xml"/>
<sysproperty key="org.uncommons.reportng.title" value="Xiaomi Test Report"/>
</testng>
</target>
上面是 build.xml 的运行的代码
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="none" preserve-order="true" >
<parameter name="username" value="13812349876" />
<parameter name="" value="4558" />
<parameter name="param" value="param" />
<test name="Test">
<classes>
<class name="com.XiaomiTestCase.XiaoMiSmoke"/>
<include name="testLogin"/>
<include name="testMyWallet"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
这个是 testng.xml 文件
Buildfile: E:\测试文档\appium测试工程\ant-appium\build.xml
test:
[testng] java.io.FileNotFoundException: E:\测试文档\appium测试工程\ant-appium\testng.xml (ϵͳ�Ҳ���ָ�����ļ���)
[testng] at java.io.FileInputStream.open0(Native Method)
[testng] at java.io.FileInputStream.open(FileInputStream.java:195)
[testng] at java.io.FileInputStream.<init>(FileInputStream.java:138)
[testng] at java.io.FileInputStream.<init>(FileInputStream.java:93)
[testng] at org.testng.xml.Parser.parse(Parser.java:167)
[testng] at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:311)
[testng] at org.testng.TestNG.run(TestNG.java:1030)
[testng] at org.testng.TestNG.privateMain(TestNG.java:1364)
[testng] at org.testng.TestNG.main(TestNG.java:1333)
[testng] Usage: <main class> [options] The XML suite files to run
[testng] Options:
[testng] -configfailurepolicy Configuration failure policy (skip or
[testng] continue)
[testng] -d Output directory
[testng] -dataproviderthreadcount Number of threads to use when running
[testng] data providers
[testng] -excludegroups Comma-separated list of group names to
[testng] exclude
[testng] -groups Comma-separated list of group names to be
[testng] run
[testng] -junit JUnit mode
[testng] Default: false
[testng] -listener List of .class files or list of class
[testng] names implementing ITestListener or
[testng] ISuiteListener
[testng] -methods Comma separated of test methods
[testng] Default: []
[testng] -methodselectors List of .class files or list of class
[testng] names implementing IMethodSelector
[testng] -mixed Mixed mode - autodetect the type of
[testng] current test and run it with appropriate runner
[testng] Default: false
[testng] -objectfactory List of .class files or list of class
[testng] names implementing ITestRunnerFactory
[testng] -parallel Parallel mode (methods, tests or classes)
[testng] -port The port
[testng] -reporter Extended configuration for custom report
[testng] listener
[testng] -suitename Default name of test suite, if not
[testng] specified in suite definition file or source code
[testng] -suitethreadpoolsize Size of the thread pool to use to run
[testng] suites
[testng] Default: 1
[testng] -testclass The list of test classes
[testng] [TestNG] [ERROR] No test suite found. Nothing to run
[testng] -testjar A jar file containing the tests
[testng] -testname Default name of test, if not specified in
[testng] suitedefinition file or source code
[testng] -testnames The list of test names to run
[testng] -testrunfactory, -testRunFactory The factory used to create tests
[testng] -threadcount Number of threads to use when running
[testng] tests in parallel
[testng] -usedefaultlisteners Whether to use the default listeners
[testng] Default: true
[testng] -log, -verbose Level of verbosity
[testng] -xmlpathinjar The full path to the xml file inside the
[testng] jar file (only valid if -testjar was
[testng] specified)
[testng] Default: testng.xml
BUILD FAILED
\ant-appium\build.xml:76: No tests were run
Total time: 598 milliseconds