CodeSV Blog!by CA Technologies, A Broadcom Company

Post Call Verification

How Can We Help?
< Back

[expand title=”Prerequisites” expanded=”true”]


Post Call Verification

CodeSV supports post execution verification. This makes it possible to check how many times a specific request was invoked. It is possible to check all possible HTTP methods using verify methods for example; verifyGet(String url). It is also possible to create complex verification’s using matchers with which you can filter only specific request matching criteria.

Post Verification Example

private static final String BASE_URL = "";
  private static final String QUERY = "?year=2016";
  private static final String URL = BASE_URL + "/{id}" + QUERY;

  public VirtualServerRule vs = new VirtualServerRule();

  public void testPostVerification() throws IOException {

    HttpClient client = HttpClientBuilder.create().build();
    HttpGet request1 = new HttpGet(BASE_URL + "/1" + QUERY);

    HttpClient client2 = HttpClientBuilder.create().build();
    HttpGet request2 = new HttpGet(BASE_URL + "/2" + QUERY);

    verifyGet(BASE_URL + "/1").invoked(1);
    verifyGet(BASE_URL + "/2").invoked(2);
    verifyGet(URL).matchesQuery("year", "2016").invoked(3);


For a complete example see: PostVerificationExample

Previous Magic Strings
Next Class Repository
Table of Contents

Comments are currently closed.