我有一个父项目"EqcareAutomationFramework“和一个子项目"EqcareDcbtTests”。当我以“runs测试”的形式运行测试时,我得到了以下错误,但是当我作为TestNg运行时运行良好。
***Tests: com.eqcare.integration.tests.CloseSessionTest***
> Task :EqcareAutomationFramework:compileJava UP-TO-DATE
> Task :EqcareAutomationFramework:processResources NO-SOURCE
> Task :EqcareAutomationFramework:classes UP-TO-DATE
> Task :EqcareAutomationFramework:jar UP-TO-DATE
> Task :compileJava NO-SOURCE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :compileTestJava NO-SOURCE
> Task :processTestResources UP-TO-DATE
> Task :testClasses UP-TO-DATE
> Task :runSuite NO-SOURCE
> Task :test NO-SOURCE
> Task :EqcareAutomationFramework:compileTestJava UP-TO-DATE
> Task :EqcareAutomationFramework:processTestResources NO-SOURCE
> Task :EqcareAutomationFramework:testClasses UP-TO-DATE
> Task :EqcareAutomationFramework:test
FAILURE: Build failed with an exception.
* What went wrong:
No matching tests found in any candidate test task.
Requested tests:
Test class com.eqcare.integration.tests.CloseSessionTest
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 803ms
6 actionable tasks: 1 executed, 5 up-to-date
下面是父项目"EqcareAutomationFramework"的build.gradle文件
> /* * This file was generated by the Gradle 'init' task. */ apply
> plugin: 'java' apply plugin: 'eclipse'
>
> sourceSets {
> main {
> java {
> srcDir './src'
> }
> }
> test {
> java {
> srcDirs = ["./src"]
> }
> }
> }
>
> repositories {
> mavenCentral() }
>
> dependencies {
> implementation 'org.testng:testng:7.1.0'
> implementation 'org.seleniumhq.selenium:selenium-server:3.141.59'
> implementation 'log4j:log4j:1.2.17'
> implementation 'org.apache.poi:poi:4.1.2'
> implementation 'org.apache.httpcomponents:httpclient:4.5.13'
> implementation 'commons-io:commons-io:2.8.0'
> implementation 'activation:activation:1.0.2'
> implementation 'javax.mail:mail:1.4.7'
> implementation 'com.aventstack:extentreports:3.1.5'
> implementation 'io.appium:java-client:7.4.1'
> implementation 'com.android.tools.build:gradle:2.3.0'
> implementation 'software.amazon.awssdk:aws-sdk-java:2.15.32'
> implementation 'jfree:jfreechart:1.0.13' }
>
> test{
useTestNG()
}
下面是子项目"EqcareDcbtTests"的build.gradle文件
apply plugin: 'java'
sourceSets {
main {
resources.srcDirs = ['clinic', 'patient',
'integration', 'commonUtils']
}
test{
resources.srcDirs =['clinic', 'patient',
'integration','commonUtils']
}
}
dependencies {
implementation project(':EqcareAutomationFramework')
}
project repositories {
mavenCentral()
}
task runSuite (type: Test) {
test.testLogging.showStandardStreams = true
useTestNG() {
suites 'testsuite/'+ System.getProperty('suiteName')
} }
父项目的文件夹结构:EqcareAutomationFramework
子项目的文件夹结构:EqcareDcbtProject
发布于 2021-04-15 01:45:56
您正在尝试运行一个没有测试的类。您正在尝试执行CloseSessionTest,这似乎不是一个测试类。
https://stackoverflow.com/questions/67099400
复制相似问题