End events
This topic describes the application of end events in your TruClient scripts, 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 engine automatically identifies and assigns the relevant end event for each step. The end event is defined the first time the script is replayed.
You can change the end event, if the event set automatically is not the best choice. For details, see Synchronize script steps.
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.
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 scripts.
Note: When using network-related end events in transaction steps, the End-of-network identification timeout setting in Runtime Settings is used to identify the end of network requests. 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:
-
Replay the script from the Development window.
-
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.
-
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.
See also: