End events in TruClient 2.0 scripts

This topic describes the application of end events, and how to manually make changes to them.

About end events

Steps contain more than one event. A step generally starts with an action, and continues with all of the events caused by the action. For example, after a click action, there might be DOM events and network events.

TruClient scripts are asynchronous, which means that a step action does not always have to run to completion before the next step starts. To enable this, each step includes an end event that defines the point in the step execution at which the next step can start. When the end event occurs, the next step starts playing, while the current step continues in the background.

After recording, the end events are not yet defined in the recorded steps, and the End event field for each step is set to Not yet set. During the first replay of the script, the TruClient engine automatically identifies and assigns the relevant end event for each step. The end event is defined for each browser, the first time the script is replayed on that browser.

You can change the end event, if the event set automatically is not the best choice. For details, see Synchronize script steps.

Back to top

Examples of end events

Each step execution differs and may go through a different event flow. The following examples illustrate how step execution can differ:

Example 1: Getting parameters using EvaluateJS step

The step includes an Evaluate JS step with TC.getParam("ParameterName"); code. In this step there is no application related activity. Therefore, the end event is automatically set to Action completed. The remaining events in the chain are not relevant.

Example 2: Click on a search box with no auto-suggest

This step interacts with the application but it does not trigger any network or DOM activity. Therefore, the end event is automatically set to Action completed. The remaining events in the chain are not relevant.

Example 3: Click on a search button

This step interacts with the application and triggers both network and DOM activity. Therefore, the end event is automatically set to one of the events that follows Action completed. The event selected depends upon the specific application behavior.

Back to top

End events on different browsers

TruClient automatically assigns separate end events for each browser, due to differences between the browsers' behaviors. For example, for the same step, browser A may trigger an end event, while browser B does not. If the step is recorded on browser A and replayed as-is on browser B, it will time out.

Therefore, TruClient sets an automatic end event only for the browser being recorded. End events for other browsers are set when the script is first run on those browsers. If there is a transaction that includes steps with different end events on different browsers, the transaction time may differ for each of the browsers.

If you need to match run times and transaction times between browsers, check that the end events are set so that the same activities are measured. If not, manually change end events as appropriate.

Example:

End event for step 100:

  • On browser A, DOM content loaded.

  • On browser B, Step network completed.

Step 101 begins:

  • On browser A, as soon as the DOM is loaded.

  • On browser B, only after the document and all the resources are loaded.

When testing on browser B, step 101 begins later than it would begin on browser A. Therefore, the run time on browser B is longer for the same business process.

Back to top

Synchronize script steps

You may need to change a step end event when:

  • The next step is not ready to be executed because the preceding end event is incorrect.

  • The automatically set end step events cause different results in different browsers.
  • You have created a transaction that surrounds several steps. You are interested in measuring a certain aspect of the transaction more accurately. For details, see Insert transactions in TruClient 2.0 scripts.

Note: When using network-related end events in transaction steps, TruClient uses the End-of-network identification timeout setting in Runtime Settings to identify the end of network requests, and any timeout periods are reported as wasted time. If the network is slow and there is an end event timeout, increase the timeout as necessary.

The process of correcting the end events is called synchronizing the script steps. You can manually set the end event to one of the predefined types.

To synchronize the script steps:

  1. Replay the script from the TruClient Development window.

  2. Expand each Step section and check that the assigned end event is correct. If needed, change it manually by selecting an option from the End event dropdown menu. For the menu options, see Step category.

    Note: If you change an end event manually, the change is applied to all browsers, overwriting the automatic setting.

  3. Save the script and replay it again to confirm the end events.

    If the end event of a step is not reached within the defined Step timeout time (in seconds), the step returns an end event timeout error. If this error occurs, you may need to manually assign a different end event to the step that returned the error.

    You may need to replay the script several times until all steps have been accurately synchronized.

Back to top

See also: