springboot 测试

  本次测试使用的是springboot 中的测试

1.(对service 的测试)下面的测试。将会启动容器进行测试  

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.RANDOM_PORT)  // 随机端口
public class MyTest {

    @Autowired
    EquipmentFaultService service;

    @Test
    public void mytest(){
        EquipmentFaultModel equipmentFaultById = service.getEquipmentFaultById("619d79f2-6c77-42a3-b0e9-49c5ebf2fdef");
        Assert.assertNotNull(equipmentFaultById);
    }


}

2. 

猜你喜欢

转载自www.cnblogs.com/chengyangyang/p/11040563.html
今日推荐