Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space FUNCTDEV and version SVC2021.1

...

These two capabilities are typically used in sync to ensure rapid, accurate updating. This lesson will show you how to use both capabilities to update tests.

Creating Tests Against an "Old" Version of a Service

Start by creating a set of tests for an older version of a bookstore service. We’ll later update these tests using the Change Advisor and Search and Replace capabilities.  

...

Using this assertor, we are declaring that the element price occurs exactly once in the SOAP response message. If this element is later changed in the updated version of the service, we will have to re-configure the updated test’s XML Assertor.

Performing Change Impact Analysis

To perform change impact analysis on these test assets:

...


Note that the Change Impact results do not show all changes that are in the service definition; they show only service definition changes that actually affect the tests. For example, if there were changes in operations that were not currently being tested, then no change impact results would be reported for those changes.

Creating a Change Template

When the Change Impact analysis is run, the Service Catalog view is automatically populated with information about the services and versions of the services that are being tested by the tests being analyzed.

...

  1. Rename the service and versions to something that we can better understand:
    1. In the Service Catalog, right-click the top-level service node, then choose Rename Service.
    2. Enter Bookstore as the service name.
    3. Right-click the Old Version node for the bookstore service, choose Rename Version, then replace Old Version with 1.0.



    4. Right-click the Current Version node for the bookstore service, choose Rename Version, then replace Current Version with 2.0.



      Next we want to define a change template that will define how we should update our tests so that they test the new version of the service.   
  2. Create a change template as follows:
    1. In the Service Catalog, select the nodes 1.0 and 2.0.
    2. Right-click the selection, then choose Add Change Template 1.0 -> 2.0.



    3. Enter LessonTemplate as the file name, then leave /Change Advisor Lesson as the location.



    4. Click Finish. The change template editor will open.
  3. Review the first tab of the change template that was created. Note that:



    • The Map Operations tab displays the operations defined in both WSDLs, as well as a default mapping between the different versions of the WSDL. When SOAtest first creates a change template, it creates a default mapping between the different versions, attempting to match nodes that it thinks are the same.
    • Green matches denote the fact that SOAtest is confident that the mapping it made is correct, and review is not required.
    • Yellow matches denote that SOAtest is less confident that the mapping it made is correct, and review is recommended to confirm or update the mapping.
    • Here, all operation mappings are shown in green—except for the mapping between the operation getItemById and getItemByIdentifier. It appears that this operation changed names, but that the meaning of the operation is the same. This seems like a good match.
  4. Indicate that we’ve reviewed the mapping between the operation getItemById and getItemByIdentifier by right-clicking getItemById and choosing Mark Match getItemById -> get-ItemByIdentifier as Reviewed". This will make the match turn green.



  5. Review the second (Map Schemas) tab of the change template that was created. Note that:
    • This tab displays the schemas defined for each operation. You can double-click on the editor tab to cause it to expand so that the editor is larger.
    • The addNewItemToInventory operation is marked with a red ‘X’, indicating that there are differences in the schema for that operation that need to be reviewed.



    • Other operations do not need review since SOAtest did not detect any changes in those operations in need of review. If you select each of the operations without the red 'X' icon, you’ll see that all matches are in green.
  6. Select the addNewItemToInventory operation to explore it. Note that
    • SOAtest matches the price and genre elements, but indicates that they need review
    • The operation contains a new element named amount that did not appear in the original version.



  7.  Indicate that the mapping between the price and genre elements is incorrect by selecting the price element and clicking Disconnect.



    It appears that the price element was renamed to amount, and that genre is the new element in the WSDL. 
  8. Indicate that the price element was renamed to amount by select price and amount, then clicking the Connect button.



    The genre element is a new element that appears for this operation.  In order for our tests to be updated properly, we must configure a default value for that element that will be configured in each of the updated tests. Otherwise the updated tests would send an empty value for that new element. 
  9. Configure a default value for the genre element as follows:
    1. Right-clicking genre and choose Configure Default Value for Added "genre" element.



    2.  In the dialog that opens, enter Literature in the input field, then click OK.



    3. Notice that genre now has a green ‘?’ and that all matches and unmatched nodes are now green. This indicates that we’re finished reviewing and configuring this operation.
  10. Indicate that the three parent nodes of amount have been reviewed by right-clicking the highest productInfo element and choosing Mark"productInfo" and Children as Reviewed.
  11. Save the template by clicking the Save toolbar button. At this point, our template has been defined and is ready to be applied to our tests. Double-click the change template editor tab to bring it back to normal size.

Applying the Change Template to Update Tests in Bulk

To update the tests impacted by this service change:

  1. In the Test Case Explorer, select Change Advisor Lesson.tst, then click the Refactor Using a Change Template toolbar button.



  2. Complete the wizard as follows:
    1. Complete the first page as follows, then click Next.

      Version: 1.0
      Update Parasoft assets to use service version: 2.0
      By applying the change template: LessonTemplate



    2. In the second page, leave New Location selected, then use the Workspace button to select the Change Advisor Lesson project. This will cause the updated tests to be saved in a new folder within the Change Advisor Lesson project. Note that, in some cases, you might want to overwrite your previous tests. However, this is highly discouraged unless you have the tests backed up (e.g., using a source control system). Otherwise, you will lose your original tests.



    3. Click Finish. A new folder called "Change Advisor Lesson" will be created. This folder contains the updated tests.



  3. Open the .tst file, and open the editor for Test Suite: Test Suite> Test Suite: CartService-Port> Test 2: addNewItemToInventory. Note that:
    • If you select the productInfo element, you’ll see that the value that we had configured for the price element has been transferred to the amount element, as defined in our change template. 



    • The other values that we inputted earlier have carried over to the new test. Select the genre element, and note that the value Literature appears there, as defined in our change template.



    • A new, updated environment has been added to the Environments node of the new folder, and  it has been set as the active environment.



  4. Select the new folder Change Advisor Lesson> Test Suite: Test Suite, click the Run Change Impact Analysis toolbar button, select Scan selected assets against their current service description radio button, then select Finish. Note that no changes are reported, since the new tests are now updated to test the current version of the service.

Updating Tests Using Search and Replace

Change Advisor is applicable for tests that are configured:

...