You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
package base;
|
|
|
|
|
|
|
|
|
|
import cn.jlw.web.WebApplication;
|
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
|
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
import org.springframework.test.context.ActiveProfiles;
|
|
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
import org.springframework.test.web.servlet.MockMvc;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <p>
|
|
|
|
|
* 测试基类,个人技术有限,目前没办法完全拆分成单个模块
|
|
|
|
|
* </p>
|
|
|
|
|
*
|
|
|
|
|
* @author mlx
|
|
|
|
|
* @date 2022/9/24
|
|
|
|
|
* @modified
|
|
|
|
|
*/
|
|
|
|
|
@SpringBootTest(classes = {WebApplication.class}, webEnvironment = SpringBootTest.WebEnvironment.MOCK)
|
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
|
|
@AutoConfigureMockMvc
|
|
|
|
|
@ActiveProfiles("test")
|
|
|
|
|
//@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB
|
|
|
|
|
public class BaseTest {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
protected MockMvc mvc;
|
|
|
|
|
}
|