Starting and stopping a test recording by using test driver

Use the TestDriver API to start a recording of a solution test run, and to stop a recording. You can review the completed recording to analyze the solution entities and events in Insight Inspector.

Before you begin

  • Configure and start a development Insight Server such as cisDev. Insight Inspector is not intended for use with a production server.
  • Deploy the solution that you want to test to the development server.
  • Create a test client project by using the TestDriver API methods. See Creating automated test cases.
  • To restrict Insight Inspector access to specific users or user roles, modify the iaSolutionDeveloper authorization role in the server.xml file. See the WebSphere® Application Server Liberty profile authorization documentation.

About this task

You use the startRecording and stopRecording methods in the TestDriver API to create a recording. The recording captures solution information such as name, version, and number of events. The recording includes the solution entities that are created or updated during processing, events that are processed by the solution, events that are emitted by the solution, and errors that might occur during processing.

The size of a recording is limited to prevent degradation of server performance. A recording stops automatically when the recording size reaches the limit. The default size limit is approximately 3,500 invocations for each recording. The number of invocations is calculated by multiplying the event total by the number of agents that process each event. For example, if one event is processed by three agents, then the result is three invocations in the recording for the event.

You can change the invocations limit setting by adding the following configuration parameter to the server.xml file:
<ia_runtime maxRecordingSize="5000"/>
where the recording size is 5,000 invocations. You must restart the server to apply the modified setting. Large recordings might adversely affect server performance. In addition, scrolling and refreshing in Insight Inspector slows down, and the browser might stop working.

A recording must be stopped before you can see it in the Insight Inspector. Only the current solution recording is displayed in Insight Inspector.

Procedure

  1. Add the startRecording and stopRecording methods to the test driver class in the test client project to create a solution recording:
    1. Add the startRecording method to the test driver class. Place the startRecording method in the BeforeClass section of the Java™ class and the stopRecording method in the AfterClass section. The following example shows how to start the recording at the beginning of the testFlightMove section.
      public void testFlightMove() throws Exception {
      testDriver.startRecording();
      . . .
      }
      To create a smaller recording, or to limit the recording to specific event processing, you can place the recording methods immediately before and after the submit event coding, as shown in this example:
      public void testFlightMove() throws Exception {
      ....
      testDriver.submitEvent(anEvent);
      testDriver.stopRecording();
      ...
      }

      Each startRecording and stopRecording pair creates a recording. If the methods are placed in the Before and After sections of the Java class, which are called in every test, and there are numerous tests in the test class, then only the last test recording is available in Insight Inspector, since there is only one recording for a solution version.

    2. If you are recording all or most of the solution, be sure to add the stopRecording method at the end of the test. For example:
      public void testFlightMove() throws Exception {
      . . .
      testDriver.stopRecording();
      }
      If you call the startRecording method before a previous recording is complete, the previous recording is stopped and a new recording starts. In addition, when a new recording is started for a specific version of a solution, the previous recording is no longer available in Insight Inspector.
      Tip: Your solution might include complex agents that require a longer time to process the solution events. To make sure that all of the event processing is recorded, add a short waiting period before and after the stopRecording method.
  2. Run a JUnit test for the solution that you want to record. If the JUnit test encounters a serious error before the test calls the stopRecording method, the recording might continue even though the test is no longer running. Check the status of the test in the Eclipse console before you start Insight Inspector.

Results

An information message is added to the solution log file to indicate that a recording started. For example:
Debug recording started. [SolutionVersion: AirportSolution, 
Author: tester, Recording id: AirportSolution-0.37|2015-03-24T17:43:07.237-0400]
A similar message in the log file shows that recording stopped.
Recording stopped [solution name: AirportSolution, recording id: 
[AirportSolution-0.37|2015-03-24T17:46:16.362-0400]