It is convenient to run virtual services (virtual API) automatically before sending requests to it, or after your test code is built with a continuous integration system like Jenkins. This topic describes different ways to start virtual service automatically. Choose any way that suites your needs best.
The easiest way to run a virtual service automatically is, perhaps, to use the Virtual Service Runner test step. Call it at the beginning of your tests before any request is sent to your virtual service. You can also use the test step to stop virtual services, that is, you can add another instance of the Virtual Service Runner test step to the end of your test case so that it stops the service after the testing is over:
As you can see, the test step properties specify the virtual service name to run and the computer, where this service will run. The computer should be either localhost, or a remote machine with VirtServer installed.
You can run virtual services by using the virtrunner.bat (or .sh) batch script that is shipped along with ReadyAPI. You use it for running virtual services on the computer, where ReadyAPI is installed. For complete information on the script and its arguments, see VirtRunner Command Line.
ReadyAPI also includes another batch script – virtserver-cli.bat (.sh) – that helps you run a virtual service on VirtServer from your computer. See Command-Line Interface Utility (for VirtServer) for complete information.
You can also run virtual services from continuous integration systems like Jenkins or Bamboo. Almost every CI system supports running an arbitrary executable. So, to automate test runs, you can use this capability and run tests with the command-line utilities that are shipped along with ReadyAPI. See above.