2. Deploying a Virtual Service

Applies to VirtServer 3.12.1, last modified on June 17, 2022

1. Create a Virtual Service

Before running your virtual service (or virtual API) on VirtServer, you need to create the virtual service. You do this in ReadyAPI Virtualization. For detailed information on steps to perform, see Getting Started With ReadyAPI Virtualization.

In this tutorial, you can use a virtual service from Virtualization Sample Project. It is installed along with ReadyAPI and is located in the <ReadyAPI>\tutorials directory. Open this project in ReadyAPI and expand the APIs (Virtual) node. You will see two virtual services in the Local Virtual Services section of the ReadyAPI Virtualization panel (see the image below).

2. Deploy the Virtual Service

After you created your virtual service (or opened from the file), you can deploy (that is, upload) it to VirtServer:

  1. In ReadyAPI, select the APIs (Virtual) node in the Navigator panel on the left. You will see the VirtServer panel in the central part of the product window:

    API testing with ReadyAPI: VirtServer panel of the ReadyAPI Virtualization editor
  2. Select your VirtServer for connection. To do this, click the drop-down arrow and choose the desired VirtServer:

    API testing with ReadyAPI: Selecting VirtServer (VirtServer discovery)

    If the Local VirtServer discovery check box is selected, ReadyAPI automatically searches for VirtServers available in your local network.

    If this check box is clear, or if VirtServer is absent from the list, click the button and specify your VirtServer working protocol, IP address, and port in the subsequent dialog.

  3. Connect to your VirtServer. To do this, specify the name and password of the user you created on VirtServer on Step 1 of this tutorial, and click Connect:

    API testing with ReadyAPI: Connecting to VirtServer

    You will see the virtual services running on selected VirtServer. In our example, there are no services on VirtServer yet:

    API testing with ReadyAPI: No virtual services on VirtServer so far
  4. Drag your virtual service from the Local Virtual Services section at the top of the editor to the VirtServer section:

    API testing with ReadyAPI: Deploying virtual service to VirtServer

    You will see the service in the VirtServer section:

    API testing with ReadyAPI: Deployed virtual service
    If you got a NullPointerException error while deploying a virtual service, update your ReadyAPI and VirtServer versions. This issue could happen in versions 1.5.0 or earlier; it was fixed in version 1.6.0.

3. Changing the Virtual Service Port Number

A virtual service uses a certain port. You specify this port in the service properties on the right of the editor (see below).

You may need to change the port number for the virtual service after you deployed it to VirtServer. This is needed if the port you use for the service on your computer is busy on VirtServer by some other virtual service or processes.

To change the port for the virtual service on VirtServer:

  1. Select the virtual service in the VirtServer section of the editor.

  2. Stop the service if you have already run it by accident.

  3. Change the port number in the service properties on the right of the editor, and click Change port. Alternatively, you can click Auto-assign a free port to command VirtServer to select a port for your service automatically:

    API testing with ReadyAPI: Setting port number for a virtual service on VirtServer

Now, you are ready to start your virtual service and run tests against it.

Prev     Next

See Also

Creating Virtual Services
Preparing Virtual Service Before Deploying

Highlight search results