@RunWith(Parameterized.class) public class MeetingHttpApiTest extends TestBase { @Test public void testMeetingHttpApi() { TedaCaseVo tedaCaseVo = tedaCaseService.getTedaCase(tedaCaseId); String url = tedaCaseVo.getParamJsonStr(); TedaTool.record(tedaCaseVo, SwordHttp.get(url), tedaCaseService); } @Parameters public static Collection data() { return Arrays.asList(new Object[][]{{22L}, {23L}, {24L},{25L}, {26L}, {27L}}); } public MeetingHttpApiTest(Long tedaCaseId) { this.tedaCaseId = tedaCaseId; } protected Long tedaCaseId = 1L; }
其中,TestBase类:
@SpringApplicationConfiguration(classes = Application.class) @WebAppConfiguration public class TestBase { @Autowired protected TedaCaseService tedaCaseService; private TestContextManager testContextManager; @Before public void setUpContext() throws Exception { this.testContextManager = new TestContextManager(getClass()); this.testContextManager.prepareTestInstance(this); } }
idea的scala插件能自动转换Java至Scala