Example: TestServer Recipe in Java

Test recipes can be written in Java using our lightweight client libraries from IntelliJ, NetBeans, or Ecllipse.
 

Status Code Check

To validate that the HTTP status code of a simple GET request is 200, you can compose a code-based test recipe as follows:

junit-sample-statuscode.PNG
 

JSON Content Validation

To provide input data to a service and assert that the structured content contains a specific value for a response element, you can simply add the 'addQueryParameter' and 'assertJsonContent' methods. There are many other useful methods to our client library as referenced in our documentation.

junit-sample-jsonassert.PNG

 

Back To All Features
Questions? Email us at sales@smartbear.com or call: U.S. +1 617-684-2600, EMEA +353 91-398300
 

Sign up for a free 14-day trial

 
 

By submitting this form, you agree to our Terms of Use