简单案例
@RunWith(Parameterized.class)public class ParameterTest { // 2.声明变量存放预期值和测试数据 private String firstName; private String lastName; //3.声明一个返回值 为Collection的公共静态方法,并使用@Parameters进行修饰 @Parameterized.Parameters public static List
参数化在 测试controller 中的应用
@RunWith(Parameterized.class)@SpringBootTestpublic class LearnController14Test { @Autowired private WebApplicationContext wac; private MockMvc mvc; private MockHttpSession session; public Long id; public String title; public LearnController14Test(Long id, String title) { super(); this.id = id; this.title = title; } /** * 这些参数,都会测试一遍 * * @return */ @Parameterized.Parameters public static List