QM1185 – Rational Performance Tester Tips & Tricks June, 2011

Demo Notes

Rational Performance Tester Version 8.2 (8.2.0.3)

Data Correlation -- Find and Fix Test Playback Errors For Dynamic Data

  1. Here is a what the first sign of trouble might look like:
    The Event Log shows failures in the form of unexpected response codes.
  2. If you look at the messages you may see something like:

    What it means is that the server returned something unexpected. When RPT tried to automatically retrieve dynamic data to use in the next request to be sent to the server it instead could not find the data it expected.
  3. A common reason why this response is not correct is because the request sent to the server was incorrect. Try to find some data that was not correlated that needed to be. One approach is to use the View button to see substitutions and Datapool Candidates.
  4. When you press this button look for possible data that might be dynamic. Datapool “candidates”, shown in green, are possibilities. Any of these green data candidates that you did not enter with the keyboard are strong possibilities.
  5. Often, it is not that easy. You always want to start with the first error and fix it before proceeding to the next error. When there is a failure on a request/response pair, focus on looking for finding dynamic data in a recent, previous response. In addition to looking at datapool candidates, compare the contents of the previous response from when the test was recorded with the contents from this playback that failed. Start with the test.

    Click on the Response Content tab and then press Copy to Clipboard.
  6. Now right-click on the results in the Performance Test Runs view, and choose Display Test Log.
  7. Click on the Events tab, then expand events to find the response desired. As before, click on the Response Content tab and then press Compare to Clipboard.

    Look for gray shaded areas that highlight data that was different in the recent playback as compared to what was seen when the test was recorded.

This data is a strong candidate for a field that needs data correlation.

  1. If the “id” 757021785 appears in the request that failed then that data needs to be correlated. Select the request that failed in the test editor. Note that the id in question appears in the Test Data section. Select it, press the Substitute button then choose Select Data Source.
  2. You will be asked if you want to turn on the “Include Potential Matches” option. Choose Yes.
  3. Click the check box beside the content that is the response from the previous request that contains the reference location for the dynamic data then press the Select button.
  4. RPT offers to name the reference site. Enter your own name for the site if you wish then press OK. Save the test.
  5. Playback the test, making sure the request that failed previously now passes before moving on to fix any problems farther down in the test.

Customize Report Starting From Default Report

  1. Here is the RPT default report:

  2. Let’s say you don’t like all the tabs and want a new default report. Start with Manage Reports (look for icon at top right of Performance Test Runs view).
  3. Expand HTTP Reports.
  4. Select Performance Report and Edit.

  5. Insert or remove tabs as desired.
  6. Press Finish, then Close.
  7. Now the default report is as you customized it.

Demo – Customize New Default Report from Scratch

  1. Manage Reports (look for icon at top right of Performance Test Runs view), which is the same circled icon as in the previous demo.
  2. Press Create.
  3. Name your report: My Default Report.
  4. Press Insert.
  5. Name your tab: Page Response.
  6. Choose Custom Tab (1 graphic) then press Next.
  7. Name title for graph: Average Page Response Time.
  8. Choose Line Chart and Next.
  9. Press Add then choose Page Performance Counter.
  10. Expand Response Time and select Average Response Time For All Pages For Run and press Add. Press Finish.

  11. To make this report the default choose Window > Preferences > Test > Performance Test Reports > Default Report.
  12. Unselect Determine default report based on protocols in test .
  13. Select My Default Report, press Apply, and OK.

  14. Now when you right-click on a run and select Display Default Report you will get My Default Report.

Reports – Restore Defaults

  1. Choose Window > Preferences > Test > Performance Test Reports > Default Report.
  2. Click Restore Defaults.
  3. Now the Display Default Report is restored as it was before any customizations.

Debug Custom Code

  1. Record a visit to google. Search for “ibm”. Stop recording.
  2. Select the google and search pages and place them in a loop for five iterations.

  3. Open the page for the search results. Click on Response 200 – OK. Right-click while inside the Content window and select Create Field Reference.
  1. Select the ibm – Google Search page. Press Add and select Custom Code.

  2. Under Arguments click Add. Expand the data source for the search result page. Check Reference: Entire “Content” field under Arguments.

  3. Click on Generate Code.
  4. Insert the following code into the exec() method:
    ITestLogManager history = tes.getTestLogManager();
    if (args.length > 0) {
    if (args[0].indexOf(“Invester Relations”) != -1) {
    history.reportMessage(“First page failed. Bail loop!”);
    tes.getLoopControl().continueLoop();
    }
    }
  5. Fix the double quotes so they are straight and the compiler quits complaining.

  6. To set a breakpoint, click anywhere on the args[0].index line. Then, move the pointer to the left-most portion of the text editor window and double-click with the pointer horizontally on the same line. A blue button should appear in this left-most portion of the window indicating the breakpoint is set.

  7. Press Ctrl-S to save the Custom Code.
  8. Press Ctrl-S to save the test.
  9. Create a new schedule by right-clicking on the project name in the Test Navigator and pressing New > Schedule. Name the schedule: eg. Schtest.
  10. Specify number of users to run: 1.
  11. Click on User Group 1, then press Add > Test. Select the googleibm test and press OK. Your schedule this look like this one:

  12. Select the User Group, choose Run this group on the following locations, then press Add and choose Add New.

  13. Use a special name because it will be used to pause execution for debugging: eg, debuglocation.
  14. Specify the host name to use the local computer: localhost.
  15. Enter a deployment directory, eg c:\mydeploy and select the O/S: eg Windows. Then, press Finish.

  16. Right-click on the newly created location, debuglocation, in the Test Navigator and select Open. Then, click the Attributes tab, followed by Add.

  17. In the New Property windows, specify a property name RPT_VMARGS and give the property the following values, each separated by a space
    -Xdebug
    -Xnoagent
    -Djava.compiler=NONE
    -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
  18. Press Ctrl-S to save the location.
  19. With the schedule open in the schedule editor start execution by pressing the Run button.
  20. Because the schedule is using the special debuglocation it will pause at the beginning to allow you to attach to the execute process using the debugger. You must wait ten to forty seconds before you will be able to successfully connect. However, you must also successfully connect within about one minute or so or the workbench will decide the execution has failed.
  21. Select Window > Open Perspective > Other > Debug.
  22. Select Run > Debug…
  23. Right-click on Remote Java Application and select New.
  24. Press the Debug button to try and attach to the running schedule. If you are successful, a list of running threads will appear in the Debug window. Execution should pause at the debug breakpoint.
  25. The first time through you need to provide the source location so you can see your Custom Code Java.
  26. Press Edit Source Lookup Path then press Add.

  27. Select Workspace Folder and press OK.
  28. Expand testproj, select source and press OK as needed. The debugger should be stopped now at the breakpoint in your Custom Code Java source.

1