• markdown 语法好像有点问题

  • 作业1
    测试了一下腾讯位置服务的一个接口:https://lbs.qq.com/webservice_v1/guide-search.html

    1. resource目录下 restAssured/tecentMap.json 文件内容:

      {
      "definitions": {},
      "$schema": "http://json-schema.org/draft-07/schema#",
      "$id": "http://example.com/root.json",
      "type": "object",
      "title": "The Root Schema",
      "required": [
      "status",
      "message",
      "count",
      "request_id",
      "data",
      "region"
      ],
      "properties": {
      "status": {
      "$id": "#/properties/status",
      "type": "integer",
      "title": "The Status Schema",
      "default": 0,
      "examples": [
      0
      ]
      },
      "message": {
      "$id": "#/properties/message",
      "type": "string",
      "title": "The Message Schema",
      "default": "",
      "examples": [
      "query ok"
      ],
      "pattern": "^(.*)$"
      },
      "count": {
      "$id": "#/properties/count",
      "type": "integer",
      "title": "The Count Schema",
      "default": 0,
      "examples": [
      1498
      ]
      },
      "request_id": {
      "$id": "#/properties/request_id",
      "type": "string",
      "title": "The Request_id Schema",
      "default": "",
      "examples": [
      "103027025214226e9daf2981482ff51cd1e69665722f"
      ],
      "pattern": "^(.*)$"
      },
      "data": {
      "$id": "#/properties/data",
      "type": "array",
      "title": "The Data Schema",
      "items": {
      "$id": "#/properties/data/items",
      "type": "object",
      "title": "The Items Schema",
      "required": [
      "id",
      "title",
      "address",
      "tel",
      "category",
      "type",
      "location",
      "ad_info"
      ],
      "properties": {
      "id": {
      "$id": "#/properties/data/items/properties/id",
      "type": "string",
      "title": "The Id Schema",
      "default": "",
      "examples": [
      "960925119577066318"
      ],
      "pattern": "^(.*)$"
      },
      "title": {
      "$id": "#/properties/data/items/properties/title",
      "type": "string",
      "title": "The Title Schema",
      "default": "",
      "examples": [
      "北京奥林匹克公园"
      ],
      "pattern": "^(.*)$"
      },
      "address": {
      "$id": "#/properties/data/items/properties/address",
      "type": "string",
      "title": "The Address Schema",
      "default": "",
      "examples": [
      "北京市朝阳区北辰东路15号"
      ],
      "pattern": "^(.*)$"
      },
      "tel": {
      "$id": "#/properties/data/items/properties/tel",
      "type": "string",
      "title": "The Tel Schema",
      "default": "",
      "examples": [
      "010-84992008"
      ],
      "pattern": "^(.*)$"
      },
      "category": {
      "$id": "#/properties/data/items/properties/category",
      "type": "string",
      "title": "The Category Schema",
      "default": "",
      "examples": [
      "旅游景点:国家级景点"
      ],
      "pattern": "^(.*)$"
      },
      "type": {
      "$id": "#/properties/data/items/properties/type",
      "type": "integer",
      "title": "The Type Schema",
      "default": 0,
      "examples": [
      0
      ]
      },
      "location": {
      "$id": "#/properties/data/items/properties/location",
      "type": "object",
      "title": "The Location Schema",
      "required": [
      "lat",
      "lng"
      ],
      "properties": {
      "lat": {
      "$id": "#/properties/data/items/properties/location/properties/lat",
      "type": "number",
      "title": "The Lat Schema",
      "default": 0.0,
      "examples": [
      40.01142
      ]
      },
      "lng": {
      "$id": "#/properties/data/items/properties/location/properties/lng",
      "type": "number",
      "title": "The Lng Schema",
      "default": 0.0,
      "examples": [
      116.393599
      ]
      }
      }
      },
      "ad_info": {
      "$id": "#/properties/data/items/properties/ad_info",
      "type": "object",
      "title": "The Ad_info Schema",
      "required": [
      "adcode",
      "province",
      "city",
      "district"
      ],
      "properties": {
      "adcode": {
      "$id": "#/properties/data/items/properties/ad_info/properties/adcode",
      "type": "integer",
      "title": "The Adcode Schema",
      "default": 0,
      "examples": [
      110105
      ]
      },
      "province": {
      "$id": "#/properties/data/items/properties/ad_info/properties/province",
      "type": "string",
      "title": "The Province Schema",
      "default": "",
      "examples": [
      "北京市"
      ],
      "pattern": "^(.*)$"
      },
      "city": {
      "$id": "#/properties/data/items/properties/ad_info/properties/city",
      "type": "string",
      "title": "The City Schema",
      "default": "",
      "examples": [
      "北京市"
      ],
      "pattern": "^(.*)$"
      },
      "district": {
      "$id": "#/properties/data/items/properties/ad_info/properties/district",
      "type": "string",
      "title": "The District Schema",
      "default": "",
      "examples": [
      "朝阳区"
      ],
      "pattern": "^(.*)$"
      }
      }
      }
      }
      }
      },
      "region": {
      "$id": "#/properties/region",
      "type": "object",
      "title": "The Region Schema",
      "required": [
      "title"
      ],
      "properties": {
      "title": {
      "$id": "#/properties/region/properties/title",
      "type": "string",
      "title": "The Title Schema",
      "default": "",
      "examples": [
      "北京市"
      ],
      "pattern": "^(.*)$"
      }
      }
      }
      }
      }
    2. java 代码部分

      @Test
      void testJsonSchemaValidator() {
      ResponseBodyExtractionOptions responseBodyExtractionOptions =
      given()
      .queryParam("key","d84d6d83e0e51e481e50454ccbe8986b")
      .queryParam("boundary","region(北京,0)")
      .queryParam("keyword","公园")
      .when()
      .get("https://apis.map.qq.com/ws/place/v1/search")
      .then().extract().body()
      ;

      String json = responseBodyExtractionOptions.asString();
      System.out.println(json);
      assertThat(json, matchesJsonSchemaInClasspath("restAssured/tecentMap.json"));
      }



    **作业2**
    ```java
    @Test
    void testFilter() {
    given()
    .filter((requestSpecification, responseSpecification, context) -> {
    Response response = context.next(requestSpecification,responseSpecification);
    ResponseBuilder responseBuilder = new ResponseBuilder().clone(response);
    String decodeContent = new String(
    Base64.getDecoder().decode(response.getBody().asString().trim()));
    responseBuilder.setBody(decodeContent);
    return responseBuilder.build();
    })
    .when().get("http://101.132.159.87:8080/user.json")
    .then().log().all()
    .body("name", equalTo("seveniruby"))
    .body("external_profile.external_corp_name", equalTo(""))
    .body("external_profile.external_corp_name", is(""))
    .body("address", containsString("北京"))
    ;
    }
  • 最近遇到一个奇怪的问题。项目组APP启动的时候那个welcome页面load出来很慢,观察到跟网络环境有关系,网络比较差的时候,容易load比较久。我尝试直接开启飞行模式,打开的时候,welcome页反而很快就出来了。这个要怎么个思路去定位呢?

  • +1

  • 留言关注话题~ 目前连接了12台左右,再多几台也会莫名其妙地offline

  • 留言申请开通专栏嘛?

  • 我们也是用这个作流量复制。

  • TTF 贡献者榜单上线! at September 16, 2019
    Author only
  • 要不要组队去?