gradle 6.8.1不使用junit执行测试

mrfwxfqh  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(176)

最近将cucumber软件包升级到6.8.1,从此不再执行测试。下面是我的gradle文件

plugins {
    id 'java'
}

group 'org.mytest'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

/*
sourceSets {main.java.srcDir "src/test"}*/

repositories {
    mavenCentral()
}
dependencies {
    //cucumber
    testImplementation 'io.cucumber:cucumber-java:6.8.1'
    testImplementation 'io.cucumber:cucumber-junit:6.8.1'
    implementation group: 'io.cucumber', name: 'cucumber-testng', version: '6.9.0'
    implementation group: 'io.cucumber', name: 'cucumber-picocontainer', version: '6.8.1'

    //logger
    implementation group: 'log4j', name: 'log4j', version: '1.2.17'
    //selenium
    implementation group: 'org.seleniumhq.selenium', name: 'selenium-chrome-driver', version: '3.14.0'
    implementation group: 'org.seleniumhq.selenium', name: 'selenium-remote-driver', version: '3.14.0'
    implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.14.0'
    implementation group: 'org.seleniumhq.selenium', name: 'selenium-server', version: '3.14.0'

    //reporting
    // https://mvnrepository.com/artifact/tech.grasshopper/extentreports-cucumber6-adapter
    implementation group: 'tech.grasshopper', name: 'extentreports-cucumber6-adapter', version: '2.1.0'
    // https://mvnrepository.com/artifact/com.aventstack/extentreports
    implementation group: 'com.aventstack', name: 'extentreports', version: '5.0.4'

}
/*jar {
    from configurations.compile.collect { zipTree it }
    manifest.attributes "Main-Class": "MainJarvish"
}*/
test {
    reports {
        junitXml.enabled = true
        html.enabled = false
    }
    testLogging {
        events 'passed', 'failed', 'standardError'
        showStandardStreams = true
    }
    systemProperty 'env', System.getProperty('env')
    systemProperty "cucumber.options", System.getProperty("cucumber.options")
}

这是我的runner文件,它不执行runner文件中的测试。还附加了相同的文件结构。当我将cucumber升级到6.8.1时,它开始显示出问题。另外,我使用的是旧的依赖关系。请导游。

package runners;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import managers.FileReader;
import org.apache.log4j.PropertyConfigurator;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(

        features = "classpath:features",glue = "stepDefinations",
        plugin = {"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:",
                "junit:target/cucumber-results.xml",
                "rerun:target/rerun.txt"},
            tags="@Smoke",
        monochrome = true,
        publish = true
)
public class TestRunner {

}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题