执行Spring Boot应用程序的JUnit测试会在调用测试时启动应用程序的测试上下文。有没有一种方法可以在已经启动的spring boot应用程序上运行此测试,而不必为测试启动第二个应用程序上下文?例如,是否可以指示测试框架使用已经启动的现有应用程序上下文?
@SpringBootTest
@RunWith(SpringRunner.class)
public class MyAppTests {
@Autowired
public SomeService someService;
@Test
public void testInjection() th
当我开始学习如何测试一个程序时,我学到的就是用与测试程序相同的语言使用一个库或包。例如,
- if a tested program is written in Python, its testing program is also written in Python and uses `UnitTest` class in the python standard library
- if a tested program is written in C++, its testing program is also written in C++ and uses some test