如果 XML 在 intellij 中是 运行,则构建工作正常,但命令行 运行 出错
Build works if XML is run in intellij, but command line run gets error
if i 运行 test.xml in intellj - 一切正常,测试成功 运行ned.
但如果我尝试 运行 在命令行中使用此代码“mvn clean compile”进行测试
我收到这样的错误:
[ERROR] symbol: class IInvokedMethod
[ERROR] location: class core.Web.RetryMethods.RetryListenerClass
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/Web/RetryMethods/RetryListenerClass.java:[63,68] cannot find symbol
[ERROR] symbol: class ITestResult
[ERROR] location: class core.Web.RetryMethods.RetryListenerClass
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/api/DataForAPI.java:[5,1] package org.testng does not exist
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/api/DataForAPI.java:[77,96] cannot find symbol
[ERROR] symbol: class ITestResult
[ERROR] location: class core.TestRail.api.DataForAPI
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/TestRailMethods/TestCases.java:[7,1] package org.testng does not exist
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/TestRailMethods/TestCases.java:[8,1] package org.testng.internal does not exist
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/TestRailMethods/TestCases.java:[58,46] cannot find symbol
[ERROR] symbol: class ISuite
我可以在这里做什么?
我已经尝试更新 testng jar,但这没有帮助。
P.S。
删除范围标记后的错误:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.436 s
[INFO] Finished at: 2021-03-30T09:38:25+03:00
[INFO] Final Memory: 30M/279M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project automation: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\Vartotojas\Desktop\Automatiniai testia\automation\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_212\jre\bin\java" -javaagent:C:\Users\Vartotojas\.m2\repository/org/aspectj/aspectjweaver/1.9.2/aspectjweaver-1.9.2.jar -jar C:\Users\VARTOT~1\
AppData\Local\Temp\surefire2399529717162338559\surefirebooter2518614099656505245.jar C:\Users\Vartotojas\AppData\Local\Temp\surefire2399529717162338559 2021-03-30T09-38-22_595-jvmRun1 surefire440322083299018669
4tmp surefire_04103581849292117664tmp"
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_212\jre\bin\java" -javaagent:C:\Users\Vartotojas\.m2\repository/org/aspectj/aspectjweaver/1.9.2/aspectjweaver-1.9.2.jar -jar C:\Users\VARTOT~1\
AppData\Local\Temp\surefire2399529717162338559\surefirebooter2518614099656505245.jar C:\Users\Vartotojas\AppData\Local\Temp\surefire2399529717162338559 2021-03-30T09-38-22_595-jvmRun1 surefire440322083299018669
4tmp surefire_04103581849292117664tmp"
您在 pom 文件中添加 TestNG
依赖项时,似乎添加了 <scope>test</scope>
。
这会导致与 TestNG 相关的 classes 在 class 路径中仅对您的测试可见(即,驻留在 src/test/java
中的所有 Java 代码)
如果删除它,那么与 TestNG 相关的 classes 将在 src/main/java
和 src/test/java
)
的 class 路径中可见
if i 运行 test.xml in intellj - 一切正常,测试成功 运行ned.
但如果我尝试 运行 在命令行中使用此代码“mvn clean compile”进行测试
我收到这样的错误:
[ERROR] symbol: class IInvokedMethod
[ERROR] location: class core.Web.RetryMethods.RetryListenerClass
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/Web/RetryMethods/RetryListenerClass.java:[63,68] cannot find symbol
[ERROR] symbol: class ITestResult
[ERROR] location: class core.Web.RetryMethods.RetryListenerClass
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/api/DataForAPI.java:[5,1] package org.testng does not exist
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/api/DataForAPI.java:[77,96] cannot find symbol
[ERROR] symbol: class ITestResult
[ERROR] location: class core.TestRail.api.DataForAPI
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/TestRailMethods/TestCases.java:[7,1] package org.testng does not exist
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/TestRailMethods/TestCases.java:[8,1] package org.testng.internal does not exist
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/TestRailMethods/TestCases.java:[58,46] cannot find symbol
[ERROR] symbol: class ISuite
我可以在这里做什么? 我已经尝试更新 testng jar,但这没有帮助。
P.S。 删除范围标记后的错误:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.436 s
[INFO] Finished at: 2021-03-30T09:38:25+03:00
[INFO] Final Memory: 30M/279M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project automation: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\Vartotojas\Desktop\Automatiniai testia\automation\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_212\jre\bin\java" -javaagent:C:\Users\Vartotojas\.m2\repository/org/aspectj/aspectjweaver/1.9.2/aspectjweaver-1.9.2.jar -jar C:\Users\VARTOT~1\
AppData\Local\Temp\surefire2399529717162338559\surefirebooter2518614099656505245.jar C:\Users\Vartotojas\AppData\Local\Temp\surefire2399529717162338559 2021-03-30T09-38-22_595-jvmRun1 surefire440322083299018669
4tmp surefire_04103581849292117664tmp"
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_212\jre\bin\java" -javaagent:C:\Users\Vartotojas\.m2\repository/org/aspectj/aspectjweaver/1.9.2/aspectjweaver-1.9.2.jar -jar C:\Users\VARTOT~1\
AppData\Local\Temp\surefire2399529717162338559\surefirebooter2518614099656505245.jar C:\Users\Vartotojas\AppData\Local\Temp\surefire2399529717162338559 2021-03-30T09-38-22_595-jvmRun1 surefire440322083299018669
4tmp surefire_04103581849292117664tmp"
您在 pom 文件中添加 TestNG
依赖项时,似乎添加了 <scope>test</scope>
。
这会导致与 TestNG 相关的 classes 在 class 路径中仅对您的测试可见(即,驻留在 src/test/java
中的所有 Java 代码)
如果删除它,那么与 TestNG 相关的 classes 将在 src/main/java
和 src/test/java
)