Quite often, developers and QA engineers create virtual APIs on their computers, but run them on a remote machine, typically, on some server in a local network. This approach lets you decrease the workload on the computers, where you create virtual APIs (virtual services), and it is helpful should the virtual API be available 24×7.
To run a virtual service on a remote computer, use VirtServer – a server-side tool specifically designed for running virtual APIs. VirtServer effectively runs multiple virtual APIs, supports the remote control and administering, and allows multi-user access to virtual services.
This topic explains how to run virtual services on remote machines with VirtServer.
Requirements
VirtServer requires a separate license. To use VirtServer from ReadyAPI, you need a ReadyAPI Virtualization license. If you do not have it, request it on our website.
A possible alternative is to save your virtual services to a Web application archive file and run this file on a Tomcat or another servlet container. See Deploying Virtual Service In WAR Format.
Running From ReadyAPI
To run virtual services on VirtServer, you need to perform the following actions:
-
Install VirtServer on a remote computer and activate its license there. Run VirtServer and create a user account in it.
-
Deploy your virtual service to a remote machine. If needed, change the port that the service will use on VirtServer after the deployment (it is possible that VirtServer has another virtual API that is using the same port).
Note: As of ReadyAPI 3.44.0, you can deploy multiple instances of a single VirtService through drag and drop on the ReadyAPI APIs (Virtual) Screen. Each instance will automatically be tagged with its copy number and have a unique deployment ID. -
Run the virtual service and test it.
See VirtServer Tutorial for a step-by-step description.
Note that you can perform steps 2 and 3 in ReadyAPI from your ReadyAPI Virtualization project editor:
Compatibility of ReadyAPI and VirtServer versions
VirtServer 3.0 introduces new security settings.
If VirtServer’s compatibility mode is turned off, you cannot connect to it by using ReadyAPI prior to 3.0. Update your ReadyAPI installation or ask your VirtServer administrators to turn on the compatibility mode.
Running From VirtServer Web Interface
You can also run a virtual service on VirtServer through the VirtServer web interface:
-
Open the VirtServer web interface in a browser. The URL to use looks like this –
https://virtserver-ip-or-name:9090/virtserver
Port 9090 is used by default.
-
Log in to VirtServer, and then click the button in the Status column for your service:
Note that the virtual service must already be on the VirtServer computer.
You cannot deploy virtual services by using the web interface of VirtServer, you can only manage them.
Running From Client-Side Command Line
ReadyAPI includes a virtserver-cli.bat command-line utility. You run it on your client computer and use it to deploy virtual services to the remote VirtServer, and to start, stop and perform other actions with virtual services on that remote VirtServer. For complete information on the utility and its command-line arguments, see VirtServer – Command-Line Interface Utility.
Running From Test Case
You can start virtual services on a VirtServer computer from your functional tests. To do this:
-
Add the Virtual Service Runner test step to the beginning of your test case. It will run before any request is sent to the virtual service.
-
Specify the VirtServer address in the step properties and the virtual service to be run:
Note: As you can see, the Virtual Service Runner test step can also stop virtual services. That is, you can call it at the end of your tests to stop virtual services, if they are not needed.
For more information on automation of virtual service runs, see About Automating Virtual Service Runs.
See Also
Running Virtual Services
Deploying Virtual Service In WAR Format