我正在使用 Oracle 数据库对我的应用程序进行自动化测试,并且我想在某些步骤之间重置/重新创建数据库。
重置 Oracle 数据库的最佳/最快方法是什么?
我正在使用 Spring Rest Docs 来记录我的 REST API。我在集成测试中使用mockMVC,并且想记录以下 JSON 响应:
GET /api/v1/customers/3b658b39-4264-4995-99d8-90a1672a75a7
{
"id": "3b658b39-4264-4995-99d8-90a1672a75a7",
"name": "Foo",
"nickname": "Bar",
"phones": [
{
"id": "6ca3a963-bacb-4770-a470-5902b4a17b77",
"alias": "Personal Phone 1",
"countryCode": "55",
"areaCode": "34",
"number": "99999-9999"
},
{
"id": "f3a3726b-b5f8-4652-a044-7bf3d95a37de",
"alias": "Personal Phone 2",
"countryCode": "55",
"areaCode": "34",
"number": "88888-8888"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我如何记录上面的电话列表?您可以使用以下代码片段,该代码片段使用 Spring REST 文档来记录此 API 操作:
this.mockMvc.perform(
get("/api/v1/customers/3b658b39-4264-4995-99d8-90a1672a75a7")
.accept(APPLICATION_JSON))
.andExpect(status().isOk())
.andDo(document("customer").withResponseFields(
fieldWithPath("id").description("Unique identifier"),
fieldWithPath("name").description("Customer full name"),
fieldWithPath("nickname").description("How the customer wants to be called")));
Run Code Online (Sandbox Code Playgroud)