1. Wiremock Intro?
    • Serves canned responses to particular requests (stubbing), and that captures incoming requests so that they can be checked later (verification).
    • External to application code which helps in the testing app in Dev and ST(System Testing) environment
    • Helps in testing negative Scenarios like network latency
    • Language Agnostic and production like testing
  2. How to differentiate Positive and Negative Scenarios?
    It could be done based on method(GET, POST, DELETE, PUT), Path(/employee, /success) and based on Parameter.

     GET /employee?name=mugil
           
     Method - GET
     Path   - /employee
     Params - name       
    

  3. How priority of Stub Response is selected when Paths overlap?
    Stub is lowest no in priority would be selected.

    	//Priority 1
    	wireMockServer.stubFor(get("/welcome")
    			.atPriority(1)
    			.willReturn(aResponse()
    		        .withBody("Welcome with Priority 1")));
    
    	//Priority 2
            wireMockServer.stubFor(get("/welcome")
    		.atPriority(2)
                    .willReturn(aResponse()
                    .withBody("Welcome with Priority 2")));
    

    Output

    Welcome with Priority 1
    
  4. What is advantage of using Wiremock as Standalone?
    • Less dependency on Environment
    • Useful for Load Testing
    • Can be used by non JVM environment
    • Can run remotely
  5. What are possible defects which could happen in application?
    1. Timeout
    2. Server Error
    3. Invalid Response