Rest APIs
Tests Script

Tests Script


The tests script is a javascript script that will get executed just after the request execution has been completed. You can write tests for better coverage, also you can write javascript to perform certain operations which are needed to be performed after the response is received.


  1. How to write test cases for rest api? Learn more
// test to assert that the response code is 200 OK.
fc.test("Status code is 200", ()=> {;
  1. How to use variables in tests script? Learn more
//sample pre-request script to set the global variable just before request run
const count = fc.globals.get("increment");
fc.globals.set("increment", increment++);