Skip to content

Create, Update and Deploy Virtual Service Before any Test from the Class

sachinmaske edited this page Oct 20, 2022 · 1 revision

This example describes Creating and Updating a virtual service at the class level.

Below annotation defines rules to create virtual service before any test from class.

@ClassRule
public static VirtualServiceClassScopeRule clazzRule = new VirtualServiceClassScopeRule();

The scope of this annotation starts from the execution of the first step until the completion of the last step.

@DevTestVirtualServer(deployServiceToVse = "VSE",groupName="V3UpdateTest", protocol = "http")
/**
     * Create, Update and Deploy VS with new RRPair
     */
    @DevTestVirtualServicesV3 (
        value = {@DevTestVirtualServiceV3(
                serviceName = "vsV3_Deploy",
                port = "24778",
                workingFolder = "v3/rrpair",
                inputFile2 = "operation-8-req.txt",
                inputFile1 = "operation-8-rsp.txt"
        ),
        @DevTestVirtualServiceV3(
                serviceName = "vsV3_Deploy",
                workingFolder = "v3/rrpair",
                inputFile2 = "operation-9-req.txt",
                inputFile1 = "operation-9-rsp.txt",
                type = VirtualServiceV3Type.UPDATE
        )}
    )
public class VirtualServiceV3ClassScopeTest {
    @Rule
    public VirtualServiceClassScopeRule rules = new VirtualServiceClassScopeRule();

     @Test
    public void vsV3_Deploy(){
        ResponseParser op8Response = HttpUtils.GET(HttpUtils.URL_FORMAT, "http", "localhost",
                "24778","import/test/operation-8");
        ResponseParser op9Response = HttpUtils.GET(HttpUtils.URL_FORMAT, "http", "localhost",
                "24778", "import/test/operation-9");
        assert (op8Response!=null);
        assert (op8Response.getValue("$.TCEntry[0].termsType").equals("Operation 8 terms"));
        assert (op9Response != null);
        assert (op9Response.getValue("$.TCEntry[0].termsType").equals("Operation 9 terms"));
    }
}

Getting Started

Code Library

Core Functionality

Version 1.4.0

Annotation DevTestVirtualServiceV3

Version 1.3.2

Acknowledgments

Clone this wiki locally