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的环境即可。

猜你喜欢

转载自blog.csdn.net/m0_67393157/article/details/124404814