assertAll()实现1个用例中多个断言

 

1.导入

import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;

 

2.代码示例

assertAll("返回值校验:",
  ()->assertEquals("0",response.path("errcode").toString()),
  ()->assertEquals("created",response.path("errmsg"))
);

 

注:此方法可实现1个用例中包含多个断言,遇到断言失败仍然会继续下一个断言

posted @ 2020-07-20 21:25  bky2020bky  阅读(2138)  评论(0编辑  收藏  举报