在使用JUnit4运行selenium测试之前,如何启动真正的spring启动应用程序?

在使用JUnit4运行selenium测试之前,如何启动真正的spring启动应用程序?,spring,selenium,spring-boot,junit,junit4,Spring,Selenium,Spring Boot,Junit,Junit4,对于我的单元测试,我使用以下注释: @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes=MyApplication.class) 我的问题发生在我尝试使用selenium测试GUI时。 在gui测试中,我调用了一些页面并验证html消息的内容 我不需要模拟,我需要在测试前启动应用程序。 做这件事的优雅方式是什么 注释@springbootest(classes=MyApplication.class)的真正作用是什么,

对于我的单元测试,我使用以下注释:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes=MyApplication.class)

我的问题发生在我尝试使用selenium测试GUI时。 在gui测试中,我调用了一些页面并验证html消息的内容

我不需要模拟,我需要在测试前启动应用程序。 做这件事的优雅方式是什么


注释@springbootest(classes=MyApplication.class)的真正作用是什么,它不启动应用程序,根据日志,它尝试启动应用程序。

您可以使用注释
@WebIntegrationTest
@RunWith

@SpringApplicationConfiguration
。您可以找到一个工作示例。

您可以结合使用注释
@WebIntegrationTest
@RunWith
,以及
@SpringApplicationConfiguration
。您可以找到一个工作示例。

注释WebIntegrationTest和SpringApplicationConfiguration被折旧,但解决方案有效。注释WebIntegrationTest和SpringApplicationConfiguration被折旧,但解决方案有效。