跳转至
本文阅读量

1. Spring Testing

1.1 使用 Rest Assured 进行集成测试

1.1.1 使用路径参数

@Test
public void test_NumberOfCircuits_ShouldBe20_Parameterized() {

    String season = "2017";
    int numberOfRaces = 20;

    given().
        pathParam("raceSeason",season).
    when().
        get("http://ergast.com/api/f1/{raceSeason}/circuits.json").
    then().
        assertThat().
        body("MRData.CircuitTable.Circuits.circuitId",hasSize(numberOfRaces));
}

1.2 Spring Test 中用于测试场景的注解

@BootstrapWith @ContextConfiguration @WebAppConfiguration @ContextHierarchy @ActiveProfiles @TestPropertySource @DynamicPropertySource @DirtiesContext @TestExecutionListeners @RecordApplicationEvents @Commit @Rollback @BeforeTransaction @AfterTransaction @Sql @SqlConfig @SqlMergeMode @SqlGroup

1.2.1 可以记录 Application Event

1.3 参考