SOAP UI Web Service Testing 102

Author: Alex Siminiuc
Date: June 28, 2011 

This second part of the SOAP UI Web Service Testing course will focus on more practical aspects and provide details on the following:

  1. Create a new project
  2. Run a web service method request
  3. Create a test case
  4. Create a test case assertion
  5. Run the test suite and get test results
  6. Other SOAP UI functionalities

 

Create a new project

    Creating a new project is very straightforward. Just open the SOAP UI app, select NEW SOAPUI project from the FILE menu and specify the project name and URL for the web service WSDL file:

     createnewprojthumb.jpg
    Click to Enlarge

     SOAP UI will get all details of the web service methods from the WSDL file and load all methods and their requests.


    Run a web service method request

      In order to run a method request, first select the method in the left pane under the project name. Then, expand the method details by clicking on the + sign displayed before the method name. This will show the default request for the method.

      • All method parameters will have sample values that need to be replaced with real values.
      • Double-click on the sample request will open the method request in the editor.
      • In the left pane of the request editor, the values of the request parameters can be added.
      • After that, the request can be executed by clicking on the green triangle.
      • The method response will show up shortly in the right pane with all method results.

       runwebsrvmeththumb.jpg
      Click to Enlarge

      Create a test case

        In the left pane of the project, below the project name, right-click on the method request and select “ADD TEST CASE”.

        createtestcasesoapthumb.jpg
        Click to Enlarge

        If the project has any existing test suites, the test case can be added to them. Otherwise, the test case can be added to a new test suite.

        createtestcasesoap2.jpg

        Create a test case assertion

          Follow the next steps for creating a test assertion for a test case:

          • Select the test suite from the project left pane.
          • Expand the test suite so that all test cases are visible.
          • Expand the test case group from the test suite and then expand the TEST STEPS section.
          • Double-click on the test case step.
          • The test case step is identical with the method request from above and will re-use all values of the method parameters.
          • Double-clicking the test step case will open the test case in the editor.
          • Run the test case and get the results.
          • Select the assertions tab

          testcaseassertsoapthumb.jpg
          Click to Enlarge

          Create a new assertion

          createnewassertsoapthumb.jpg
          Click to Enlarge

          Add the XPATH code for the assertion so that the results are validated

          addxpathcodesoapthumb.jpg
          Click to Enlarge

          After the assertion code is added, clicking on the SELECT FROM CURRENT button of the EXPECTED RESULTS section will show if the assertion passes or fails. If it passes, the assertion editor will close and the assertion will be added to the list of assertions for the current test case.

          xpathmatchconfigsoapthumnb.jpg
          Click to Enlarge

          More assertions can be added for the same test case step. The test case can have multiple steps too, each of them with its own assertions.

          testcasemultstepsthumb.jpg
          Click to Enlarge

          Run the test suite

            After creating all required test cases and their assertions, the test suite can be opened in the editor (right click in the project left pane on the test suite name and select SHOW TEST SUITE EDITOR.

            runningtestsuitesoapthumb.jpg
            Click to Enlarge

            This will open the test suite in the editor with all test cases. Clicking on the green triangle from the top left part of the editor will run all test cases with all their steps and evaluate all assertions for each test case. If at least one assertion fails, then the test case will be flagged as failed.
            Please see below the results of running a sample test suite:

            sampletestsuitesoapthumb.jpg
            Click to Enlarge 

            Other SOAP UI functionalities
            SOAP UI has a lot of other functionalities that I will try to briefly describe here:

            typesoftestcasessoapthumb.jpg
            Click to Enlarge 

             

            There are many types of steps that can be used for a test case; see below all possible types:

            1. Import test cases from a different project
            2. Export test cases in XML format
            3. Move the test case up or down in the test suite
            4. Disable a test case
            5. Use a test case for a load test
            6. Close a test case

            showtestsuiteeditorthumb.jpg
            Click to Enlarge

            It is possible to manage the test coverage and even the requirements for the test cases; however, do not expect complex functionality here:

            testsuitefunctionality.jpg

            Using the test cases created earlier, it is easy to run a load test as showed in the next screenshot

            runloadtestsoapthumb.jpg
            Click to Enlarge

             

            Now you should be able to create, manipulate, and execute test cases and load tests with SoapUI.