I have an issue with running test classes on it's own. After updating my IntelliJ IDEA from version 2018 to 2020 i can't run tests on it's own using testNG it runs through the Gradle and don't work.
My build.gradle
plugins {
id 'io.qameta.allure' version "2.4"
id "net.ltgt.apt" version "0.15"
}
allure {
version = '2.4.1'
autoconfigure = true
aspectjweaver = true
allureJavaVersion = '2.0-BETA9'
}
apply plugin: 'java-library'
apply plugin: "io.qameta.allure"
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.1'
implementation 'org.testng:testng:6.11'
implementation 'org.seleniumhq.selenium:selenium-java:3.6.0'
implementation 'org.hamcrest:java-hamcrest:2.0.0.0'
implementation 'com.beust:jcommander:1.72'
implementation 'com.thoughtworks.xstream:xstream:1.4.8'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'ch.qos.logback:logback-classic:1.1.5'
implementation 'org.apache.poi:poi:3.17'
implementation 'org.apache.maven.plugins:maven-compiler-plugin:3.7.0'
implementation 'ru.yandex.qatools.ashot:ashot:1.5.4'
implementation 'io.rest-assured:rest-assured:4.2.0'
implementation 'org.projectlombok:lombok:1.18.16'
compileOnly 'org.projectlombok:lombok:1.18.16'
annotationProcessor 'org.projectlombok:lombok:1.18.16'
testCompileOnly 'org.projectlombok:lombok:1.18.16'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.16'
// DB
implementation("org.hibernate:hibernate-core:5.3.10.Final")
implementation("mysql:mysql-connector-java:8.0.16")
/*def excludeLog = {exclude group: 'ch.qos.logback:logback-core', 'ch.qos.logback:logback-classic'}
compile 'net.sourceforge.tess4j:tess4j:4.2.2', excludeLog*/
/*def excludeLog = {exclude group: 'ch.qos.logback:logback-core', 'ch.qos.logback:logback-classic'}*/
implementation 'net.sourceforge.tess4j:tess4j:4.3.1'
implementation group: 'org.springframework', name: 'spring-web', version: '3.0.2.RELEASE'
implementation group: 'org.postgresql', name: 'postgresql', version: '42.2.5'
//Gmail
implementation 'com.google.api-client:google-api-client:1.23.0'
implementation 'com.google.oauth-client:google-oauth-client-jetty:1.23.0'
implementation 'com.google.apis:google-api-services-gmail:v1-rev83-1.23.0'
//ftp client
implementation group: 'commons-net', name: 'commons-net', version: '3.6'
}
task testLttTestServer(type: Test) {
useTestNG() {
suites 'src/test/resources/testNG/testng-ltt-test-regression.xml'
useDefaultListeners = true
}
reports.html.enabled = false
}
task testLttProdServer(type: Test) {
useTestNG() {
suites 'src/test/resources/testNG/testng-ltt-prod-regression.xml'
useDefaultListeners = true
}
reports.html.enabled = false
}
task testKparserProdServer(type: Test) {
useTestNG() {
suites 'src/test/resources/testNG/testng-kparser-prod-regression.xml'
useDefaultListeners = true
}
reports.html.enabled = false
}
task testSeo(type: Test) {
if (project.hasProperty('jsonName')) {
systemProperty 'jsonName', "${jsonName}"
}
useTestNG() {
suites 'src/test/resources/testNG/testng-SeoUtil-test.xml'
useDefaultListeners = true
}
reports.html.enabled = false
}
task testSitecheckerDB(type: Test) {
if (project.hasProperty('pswsalt')) {
systemProperty 'pswsalt', "${pswsalt}"
}
if (project.hasProperty('pswsalt')) {
systemProperty 'pswsk', "${pswsk}"
}
useTestNG() {
suites 'src/test/resources/testNG/dbTests/testng-sitechecker-position-test.xml'
useDefaultListeners = true
}
reports.html.enabled = false
}
task testSitecheckerNotifications(type: Test) {
useTestNG() {
suites 'src/test/resources/testNG/testng-sitechecker-notifications.xml'
useDefaultListeners = true
}
reports.html.enabled = false
}
task testCopywritely(type: Test) {
useTestNG() {
suites 'src/test/resources/testNG/testng-copywritely-regression.xml'
useDefaultListeners = true
}
reports.html.enabled = false
}
task testSitecheckerNewUI(type: Test) {
useTestNG() {
suites 'src/test/resources/testNG/SCnew.xml'
useDefaultListeners = true
}
reports.html.enabled = false
}
task crawlerTest(type: Test) {
useTestNG() {
suites 'src/test/resources/testNG/sitechecker-crawling-test.xml'
useDefaultListeners = true
}
reports.html.enabled = false
}
task alxLocalhostTest(type: Test) {
if (project.hasProperty('pswsalt')) {
systemProperty 'pswsalt', "${pswsalt}"
}
if (project.hasProperty('pswsalt')) {
systemProperty 'pswsk', "${pswsk}"
}
useTestNG() {
suites 'src/test/resources/testNG/alx-test.xml'
useDefaultListeners = true
}
reports.html.enabled = false
}
task noMonitoringTest(type: Test) {
if (project.hasProperty('pswsalt')) {
systemProperty 'pswsalt', "${pswsalt}"
}
if (project.hasProperty('pswsalt')) {
systemProperty 'pswsk', "${pswsk}"
}
useTestNG() {
suites 'src/test/resources/testNG/dbTests/noMonitoringTest.xml'
useDefaultListeners = true
}
reports.html.enabled = false
}
task inProgressDomainsTest(type: Test) {
if (project.hasProperty('pswsalt')) {
systemProperty 'pswsalt', "${pswsalt}"
}
if (project.hasProperty('pswsalt')) {
systemProperty 'pswsk', "${pswsk}"
}
useTestNG() {
suites 'src/test/resources/testNG/dbTests/testng-sitechecker-inProgressDomain-test.xml'
useDefaultListeners = true
}
reports.html.enabled = false
}
task userWorkFlowTest(type: Test) {
if (project.hasProperty('pswsalt')) {
systemProperty 'pswsalt', "${pswsalt}"
}
if (project.hasProperty('pswsalt')) {
systemProperty 'pswsk', "${pswsk}"
}
useTestNG() {
suites 'src/test/resources/testNG/testng-sitechecker-prod-UserWorkFlowtest.xml'
useDefaultListeners = true
}
reports.html.enabled = false
}
I can still run any xml file using testNG without problems, but can't understand what happened with single configure class.
The problem had been resolved by changing value 'run tests' in gradle run configuration from 'gradle' to 'intelliJ'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.