SpringBootTest單元測試報錯

@RunWith(SpringRunner.class)
@SpringBootTest(classes = { DataRulesApplication.class })
@EnableAutoConfiguration
//@SpringBootTest(classes = { DataRulesApplication.class })
public class HuaboAddressTest extends AbstractTestNGSpringContextTests {


    @Autowired
    private HuaboAddressServiceImpl johnyService;

    @Test
    public void queryState() {
        //johnyService.resetAllDistricts();
        long startTime = System.currentTimeMillis();
        //    johnyService.resetAllDistricts();
        //  johnyService.batchUpdate2();
        //  johnyService.batchupdate3();
        //johnyService.resetAllDistricts();
        johnyService.updateBatch();
        long endTime = System.currentTimeMillis();
        System.out.println("執行時間:" + (endTime - startTime));

//        long startTime = System.currentTimeMillis();
//        johnyService.select1();
//        long endTime = System.currentTimeMillis();
//        System.err.println("執行時間1:"+(endTime-startTime));
//        startTime = System.currentTimeMillis();
//        johnyService.select2();
//        endTime = System.currentTimeMillis();
//        System.err.println("執行時間2:"+(endTime-startTime));
    }

    @Test
    public void check() {


    }

    @Test
    public void register() {
    }

    @Test
    public void detail() {
    }

    @Test
    public void queryCategory() {

    }


}

其實只需要在setting中設置運行test的環境即可。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章