Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot test SpringBootTest集成测试无法与多个(@SpringBootApplication)配合使用_Spring Boot Test - Fatal编程技术网

Spring boot test SpringBootTest集成测试无法与多个(@SpringBootApplication)配合使用

Spring boot test SpringBootTest集成测试无法与多个(@SpringBootApplication)配合使用,spring-boot-test,Spring Boot Test,我有一个SpringBootTest集成测试,用于我正在开发的某个框架,该框架使用jpa,它是通过SpringBootApplication安装的。 我添加了对不使用jpa的框架的支持,为此我需要创建一个不使用jpa的SpringBootApplication 现在,单独运行时的测试类工作得很好,但是当我一起运行它时(运行不同Spring应用程序的不同测试类),第二顺序测试类失败,因为我似乎没有在测试类之间重置上下文 我使用以下方法将测试分类: @RunWith(SpringRunner.cla

我有一个SpringBootTest集成测试,用于我正在开发的某个框架,该框架使用jpa,它是通过SpringBootApplication安装的。 我添加了对不使用jpa的框架的支持,为此我需要创建一个不使用jpa的SpringBootApplication

现在,单独运行时的测试类工作得很好,但是当我一起运行它时(运行不同Spring应用程序的不同测试类),第二顺序测试类失败,因为我似乎没有在测试类之间重置上下文

我使用以下方法将测试分类:

@RunWith(SpringRunner.class)    
@SpringBootTest(classes = ClassA.class, webEnviornemt ... etc)
@DirtiesContext (tried all the variations)
@ActiveProfiles("testA")
public class TestsA

@RunWith(SpringRunner.class) 
@SpringBootTest(classes = ClassB.class, webEnviornemt ... etc)
@DirtiesContext (tried all the variations)
@ActiveProfiles("testB")
public class TestsB
如果A类先运行,则B类失败,反之亦然


有没有关于为什么SpringBootTest不会切换类的建议?

我没有看到@RunWithannotation@SimonMartinelli我的错。。编辑你能发布例外吗?我没有看到@RunWithannotation@SimonMartinelli我的错。。编辑你能发布例外情况吗?