根据这个问题,我创建了一个批处理文件,并为其创建了一个计划任务。但是,它不会在预定时间运行。我尝试执行注释testng.xml行的脚本,并在bin和lib的路径中看到一个空格。
这可能是原因吗?有什么想法吗。
这是我的剧本:
set ProjectPath=C:\Users\workspace\RestAssured
echo %ProjectPath%
set classpath=%ProjectPath%\bin;%ProjectPath%\Lib\*
echo %classpath%
java org.testng.TestNG %ProjectPath%\testng.xml
用以下类引发的系统NotFoundExcure:
错误:无法找到或加载主类组织。testng。TestNG
原因:java。lang.ClassNotFoundException:org。testng。TestNG
以下是错误日志:
C:\用户\eclipse-workspace\重新保证
C:\用户\eclipse-workspace\重新保证
C:\Users\eclipse workspace\RestAssured\bin;C:\Users\eclipse workspace\restassed\lib*
C:\用户\eclipse-workspace\重新保证
C:\Users\eclipse workspace\RestAssured\testng。xml
错误:无法找到或加载主类组织。testng。TestNG
原因:java。lang.ClassNotFoundException:org。testng。TestNG
生成步骤“执行Windows批处理命令”将生成标记为失败
以下是TestNG的详细内容:
> ...
... TestNG 6.9.6 by C??dric Beust (cedric@beust.com)
...
[TestRunner] Running the tests in 'Rep' with parallel mode:tests
[RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector@3857f613 priority: 10
[TestClass] Creating TestClass for [ClassImpl class=com.root.com.RepZmap]
[TestClass] Adding method RepZmap.ZmapTest()[pri:0, instance:null] on TestClass class com.root.com.RepZmap
[XmlMethodSelector] Including method com.root.com.sendEmailReport()
[XmlMethodSelector] Including method com.root.com.startTest()
[XmlMethodSelector] Including method com.root.com.endReport()
[XmlMethodSelector] Including method com.root.com.initializeValues()
[XmlMethodSelector] Including method com.root.com.reportHeader()
[XmlMethodSelector] Including method com.root.com.getResult()
[TestClass] Creating TestClass for [ClassImpl class=com.root.com.RepMir112]
[TestClass] Adding method RepMir112.MirTest()[pri:0, instance:null] on TestClass class com.root.com.RepMir112
[TestClass] Creating TestClass for [ClassImpl class=com.root.com.RepMir113]
[TestClass] Adding method RepMir113.Mir113Test(java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:null] on TestClass class com.root.com.RepMir113
[XmlMethodSelector] Including method com.root.com.ZmapTest()
[XmlMethodSelector] Including method com.root.com.MirTest()
[XmlMethodSelector] Including method com.root.com.Mir113Test()
[TestNG] Running:
C:\Users\mhuntik\eclipse-workspace\RestAssured\testng.xml
[SuiteRunner] Created 1 TestRunners
[ThreadUtil] Starting executor timeOut:2147483647ms workers:1 threadPoolSize:5
[[SuiteWorker]] Running XML Test 'Rep' in Parallel
[TestRunner] Running test Rep on 3 classes, included groups:[] excluded groups:[]
===== Test class
com.root.com.RepZmap
@BeforeClass RepZmap.initializeValues()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5]
@BeforeMethod RepUtils.reportHeader(java.lang.reflect.Method)[pri:0, instance:com.root.com.RepZmap@5fd4f8f5]
@Test RepZmap.ZmapTest()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5]
@AfterMethod RepUtils.getResult(org.testng.ITestResult)[pri:0, instance:com.root.com.RepZmap@5fd4f8f5]
======
===== Test class
com.root.com.RepMir112
@BeforeClass RepMir112.initializeValues()[pri:0, instance:com.root.com.RepMir112@6631f5ca]
@BeforeMethod RepUtils.reportHeader(java.lang.reflect.Method)[pri:0, instance:com.root.com.RepMir112@6631f5ca]
@Test RepMir112.MirTest()[pri:0, instance:com.root.com.RepMir112@6631f5ca]
@AfterMethod RepUtils.getResult(org.testng.ITestResult)[pri:0, instance:com.root.com.RepMir112@6631f5ca]
======
===== Test class
com.root.com.RepMir113
@BeforeClass RepMir113.initializeValues()[pri:0, instance:com.root.com.RepMir113@5ace1ed4]
@BeforeMethod RepUtils.reportHeader(java.lang.reflect.Method)[pri:0, instance:com.root.com.RepMir113@5ace1ed4]
@Test RepMir113.Mir113Test(java.lang.String, java.lang.String, java.lang.String)[pri:0, instance:com.root.com.RepMir113@5ace1ed4]
@AfterMethod RepUtils.getResult(org.testng.ITestResult)[pri:0, instance:com.root.com.RepMir113@5ace1ed4]
======
[Invoker 1303063064] Keeping method RepUtils.startTest()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5] for class null
[Invoker 1303063064] Invoking @BeforeTest RepUtils.startTest()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5]
[Invoker 1303063064] Keeping method RepZmap.initializeValues()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5] for class [TestClass name=class com.root.com.RepZmap]
[Invoker 1303063064] Invoking @BeforeClass RepZmap.initializeValues()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5]
[Invoker 1303063064] Keeping method RepUtils.reportHeader(java.lang.reflect.Method)[pri:0, instance:com.root.com.RepZmap@5fd4f8f5] for class [TestClass name=class com.root.com.RepZmap]
[Invoker 1303063064] Keeping method RepUtils.getResult(org.testng.ITestResult)[pri:0, instance:com.root.com.RepZmap@5fd4f8f5] for class [TestClass name=class com.root.com.RepZmap]
[Invoker 1303063064] Keeping method RepUtils.reportHeader(java.lang.reflect.Method)[pri:0, instance:com.root.com.RepZmap@5fd4f8f5] for class [TestClass name=class com.root.com.RepZmap]
[Invoker 1303063064] Invoking @BeforeMethod RepUtils.reportHeader(java.lang.reflect.Method)[pri:0, instance:com.root.com.RepZmap@5fd4f8f5]
[Invoker 1303063064] Invoking com.root.com.RepZmap.ZmapTest
--------- Sending IPs To Receiver --------------------
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.poi.openxml4j.util.ZipSecureFile$1 (file:/C:/Users/mhuntik/eclipse-workspace/RestAssured/lib/fillo-1.18.jar) to field java.io.FilterInputStream.in
WARNING: Please consider reporting this to the maintainers of org.apache.poi.openxml4j.util.ZipSecureFile$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[Invoker 1303063064] Keeping method RepUtils.getResult(org.testng.ITestResult)[pri:0, instance:com.root.com.RepZmap@5fd4f8f5] for class [TestClass name=class com.root.com.RepZmap]
[Invoker 1303063064] Invoking @AfterMethod RepUtils.getResult(org.testng.ITestResult)[pri:0, instance:com.root.com.RepZmap@5fd4f8f5]
log4j:WARN No appenders could be found for logger (freemarker.cache).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[Invoker 1303063064] Keeping method RepMir112.initializeValues()[pri:0, instance:com.root.com.RepMir112@6631f5ca] for class [TestClass name=class com.root.com.RepMir112]
[Invoker 1303063064] Invoking @BeforeClass RepMir112.initializeValues()[pri:0, instance:com.root.com.RepMir112@6631f5ca]
[Invoker 1303063064] Keeping method RepUtils.reportHeader(java.lang.reflect.Method)[pri:0, instance:com.root.com.RepMir112@6631f5ca] for class [TestClass name=class com.root.com.RepMir112]
[Invoker 1303063064] Keeping method RepUtils.getResult(org.testng.ITestResult)[pri:0, instance:com.root.com.RepMir112@6631f5ca] for class [TestClass name=class com.root.com.RepMir112]
[Invoker 1303063064] Keeping method RepUtils.reportHeader(java.lang.reflect.Method)[pri:0, instance:com.root.com.RepMir112@6631f5ca] for class [TestClass name=class com.root.com.RepMir112]
[Invoker 1303063064] Invoking @BeforeMethod RepUtils.reportHeader(java.lang.reflect.Method)[pri:0, instance:com.root.com.RepMir112@6631f5ca]
[Invoker 1303063064] Invoking com.root.com.RepMir112.MirTest
--------- Sending IPs To Receiver --------------------
[Invoker 1303063064] Keeping method RepUtils.getResult(org.testng.ITestResult)[pri:0, instance:com.root.com.RepMir112@6631f5ca] for class [TestClass name=class com.root.com.RepMir112]
[Invoker 1303063064] Invoking @AfterMethod RepUtils.getResult(org.testng.ITestResult)[pri:0, instance:com.root.com.RepMir112@6631f5ca]
[Invoker 1303063064] Keeping method RepMir113.initializeValues()[pri:0, instance:com.root.com.RepMir113@5ace1ed4] for class [TestClass name=class com.root.com.RepMir113]
[Invoker 1303063064] Invoking @BeforeClass RepMir113.initializeValues()[pri:0, instance:com.root.com.RepMir113@5ace1ed4]
[Invoker 1303063064] Keeping method RepUtils.reportHeader(java.lang.reflect.Method)[pri:0, instance:com.root.com.RepMir113@5ace1ed4] for class [TestClass name=class com.root.com.RepMir113]
[Invoker 1303063064] Keeping method RepUtils.getResult(org.testng.ITestResult)[pri:0, instance:com.root.com.RepMir113@5ace1ed4] for class [TestClass name=class com.root.com.RepMir113]
[Invoker 1303063064] Keeping method RepUtils.endReport()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5] for class null
[Invoker 1303063064] Invoking @AfterTest RepUtils.endReport()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5]
===== Invoked methods
RepUtils.startTest()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5] 1607792885
RepZmap.initializeValues()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5] 1607792885
RepUtils.reportHeader(java.lang.reflect.Method)[pri:0, instance:com.root.com.RepZmap@5fd4f8f5]public void com.root.com.RepZmap.ZmapTest() throws java.lang.Throwable 1607792885
RepZmap.ZmapTest()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5] 1607792885
RepUtils.getResult(org.testng.ITestResult)[pri:0, instance:com.root.com.RepZmap@5fd4f8f5][TestResult name=ZmapTest status=FAILURE method=RepZmap.ZmapTest()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5] output={null}] 1607792885
RepMir112.initializeValues()[pri:0, instance:com.root.com.RepMir112@6631f5ca] 1714550218
RepUtils.reportHeader(java.lang.reflect.Method)[pri:0, instance:com.root.com.RepMir112@6631f5ca]public void com.root.com.RepMir112.MirTest() throws java.lang.Throwable 1714550218
RepMir112.MirTest()[pri:0, instance:com.root.com.RepMir112@6631f5ca] 1714550218
RepUtils.getResult(org.testng.ITestResult)[pri:0, instance:com.root.com.RepMir112@6631f5ca][TestResult name=MirTest status=FAILURE method=RepMir112.MirTest()[pri:0, instance:com.root.com.RepMir112@6631f5ca] output={null}] 1714550218
RepMir113.initializeValues()[pri:0, instance:com.root.com.RepMir113@5ace1ed4] 1523457748
RepUtils.endReport()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5] 1607792885
=====
Creating C:\Users\mhuntik\eclipse-workspace\RestAssured\test-output\Repute\Rep.html
Creating C:\Users\mhuntik\eclipse-workspace\RestAssured\test-output\Repute\Rep.xml
FAILED: ZmapTest
java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET
at io.restassured.config.EncoderConfig.<init>(EncoderConfig.java:61)
at io.restassured.config.RestAssuredConfig.<init>(RestAssuredConfig.java:41)
at io.restassured.RestAssured.<clinit>(RestAssured.java:420)
at com.root.com.RepZmap.ZmapTest(RepZmap.java:44)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:773)
at org.testng.TestRunner.run(TestRunner.java:623)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:39)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:391)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
FAILED: MirTest
java.lang.NoClassDefFoundError: Could not initialize class io.restassured.RestAssured
at com.root.com.RepMir112.MirTest(RepMir112.java:44)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:773)
at org.testng.TestRunner.run(TestRunner.java:623)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:39)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:391)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
SKIPPED: Mir113Test
java.lang.RuntimeException: java.lang.NoClassDefFoundError: jxl/Workbook
at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:162)
at org.testng.internal.Parameters.handleParameters(Parameters.java:430)
at org.testng.internal.Invoker.handleParameters(Invoker.java:1276)
at org.testng.internal.Invoker.createParameters(Invoker.java:992)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1082)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:773)
at org.testng.TestRunner.run(TestRunner.java:623)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:39)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:391)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: jxl/Workbook
at com.root.com.RepMir113.getExcelData(RepMir113.java:36)
at com.root.com.RepMir113.createSourceIPs(RepMir113.java:57)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:136)
... 16 more
Caused by: java.lang.ClassNotFoundException: jxl.Workbook
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 24 more
===============================================
Rep
Tests run: 3, Failures: 2, Skips: 1
===============================================
[Invoker 2014461570] Keeping method RepUtils.sendEmailReport()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5] for class null
[Invoker 2014461570] Invoking @AfterSuite RepUtils.sendEmailReport()[pri:0, instance:com.root.com.RepZmap@5fd4f8f5]
Mail sent successfully...
===============================================
Repute
Total tests run: 3, Failures: 2, Skips: 1
===============================================
你真的有名为“Lib”的目录吗?我期待“lib”出现,因为windows是区分大小写的操作系统。
从任务计划程序运行批处理文件不适用于. bat文件中的java命令。如果我手动运行. bat文件,它的工作良好。 这是我试图安排的简单. bat文件
问题内容: 我有一个批处理文件,它将搜索一个Java进程并将其杀死。当bat文件在命令提示符下运行时,脚本可以正常工作。但是,当我尝试在任务计划程序中执行时,它不起作用。 我选择了“无论用户是否登录都运行”选项 我的批处理文件如下所示: 我还尝试了此链接中提到的所有内容 批处理手动运行,但不在计划任务中运行 还有其他建议。 注意:我还有另一个批处理文件来存档文件,该文件可以在任务计划程序中使用相同
我在任务计划程序中计划了一个批处理文件。如果我从CMD手动运行此批处理文件,它将很好地完成所有工作,大约需要20分钟。但是,如果我在任务计划程序中计划它,它在开始运行时立即完成,并显示结果是“成功完成”。(VBS 没有运行...)此批处理文件将调用 2 个 vbs 脚本来运行。我不确定任务计划程序是否有问题,或者只是批处理文件在那里得到错误的代码。 我在日志文件中得到了错误信息 我只从任务调度器得
我希望我所有的课程都按顺序进行。下面是我的testng xml文件: 我试过在套房里用姓名标签来做:
我从昨天开始就在努力解决这个问题,我创建了一个批处理文件——一个简单的文件——它将尝试读取windows计划任务的日志,并基于对正确的“最后结果”的搜索将0或1记录到日志文件中。批处理文件运行良好。但是我想安排这个批处理文件每两分钟运行一次, 所以我创建了一个运行此批处理文件的计划任务;当我强制启动计划任务时,我在任务调度程序历史记录中没有看到任何错误,但同时我的Batch文件没有被执行。 我尝试
我有以下testng.xml文件。我希望testng按顺序运行这些测试。我不想将这些测试中的每一个分开到一个新文件中。 我在套件级别上尝试了parallel=“tests”、“classes”、“methods”和thread count=1的组合,但都没有成功。