мое весеннее загрузочное приложение создано Gradle, и я использую TestNG и allure для тестирования и составления отчетов.Когда я использую gradlew clean test
для тестирования и пытаюсь сгенерировать отчет о тестировании с помощью gradlew allureServe
в терминале IDEA, я получаю java.lang.IllegalStateException: Failed to load ApplicationContext
.Мой файл build.gradle:
buildscript {
ext {
springBootVersion = "2.1.1.RELEASE"
springCloudVersion = 'Finchley.RELEASE'
lombokVersion = "1.18.2"
}
repositories {
jcenter()
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "http://maven.zoom.us/content/groups/public" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'java'
id 'maven'
id "io.qameta.allure" version "2.7.0"
}
repositories {
mavenLocal()
maven {
url = 'http://repo.maven.apache.org/maven2'
}
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-data-redis:2.1.1.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-web:2.1.1.RELEASE'
compile 'org.projectlombok:lombok:1.18.4'
compile("io.lettuce:lettuce-core:5.1.3.RELEASE")
compile("org.redisson:redisson:3.10.2")
compile group: 'io.qameta.allure', name: 'allure-testng', version: '2.9.0'
compile("org.springframework.boot:spring-boot-configuration-processor:2.1.1.RELEASE")
compile("org.apache.commons:commons-pool2:2.4.2")
compile("io.github.resilience4j:resilience4j-ratelimiter:0.13.2")
testCompile("org.testng:testng:6.11")
testCompile 'org.springframework.boot:spring-boot-starter-test:2.1.1.RELEASE'
}
group = 'xxx'
version = '0.0.1-SNAPSHOT'
description = 'xxx'
sourceCompatibility = '1.8'
allure {
version = '2.9.0'
autoconfigure = true
aspectjweaver = true
useTestNG {
version = '2.9.0'
}
}
test {
useTestNG {
suites 'src/test/resources/api.xml'
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
и контрольный пример выглядят так:
@SpringBootTest(classes = RedisdemoApplication.class)
public class SimpleControllerImplTest extends AbstractTestNGSpringContextTests {
@Autowired
private RedissonClient redissonClient;
@Test
public void testRedisson() {
RBucket bucket = redissonClient.getBucket("bucket");
System.out.println(bucket.isExists());
}
@Test
public void testInvoke() {
System.out.println("testInvoke");
}
@Test
public void testCalculateAverageTime() {
System.out.println("testCalculateAverageTime");
}
}
Что-то, что я настроил неправильно?Пожалуйста, помогите мне, спасибо.