Example: Logging measurements to the results database
In this example, you use a background test and the log measurement action to act as a custom probe for the system under test.
About this task
This example gathers data about the bytes sent and received by the system. While this data can also be gathered by a probe, this example shows you how to gather the information manually.
Creating a measurement test
About this task
Procedure
- From the Test Factory perspective, create a test that is named byteMonitor ( ).
-
Add a Run Command action to the test and open it.
-
Switch to the Store tab and store the two numbers into separate tags that are called
BytesSent
andBytesReceived
. - Close the test action.
-
Check that the test is working as expected. Add a normal Log action, and use that action to log the values that are captured in the
BytesReceived
andBytesSent
tags to the console. Then, run the test, and check that it works. If it does not, check the preceding steps to make sure that everything was entered correctly.
Logging measurements to the results database
About this task
Procedure
- From the Test Factory, delete or disable the Log action. Then, add a Log Measurement action ( ) after the Run Command.
-
Now set up the Log Measurement action. First, you indicate what data you want to capture. Click Add in the Counters section to add a value to monitor. A new empty row is added to the table of data values.
-
Save and close the
byteMonitor
Test.
Adding a background test to a performance test
Before you begin
Procedure
- Create a copy of a performance test, and call it customLogging.
-
Edit the customLogging Test, and right-click the Performance Test label on the left side of the editor; you see the options for adding load-generating and background tests. Add a background test.
- On the Execution tab for the Background Test, select byteMonitor for the Test Path field. Make sure that Terminate on failure is not selected
- Switch to the Engines tab, and then click Add. There is only one engine available, as before. Select it.
-
Save the customLogging test, and run it in the Test Lab perspective. View the results in the Results Gallery. From the Results Gallery, select the customLogging test, and then click Analyze. The counters can be found in the Log Values section. There is one each for Bytes Sent and Bytes Received. Select them both.
In most cases, the charts look similar, though not quite the same. You might want to put the data onto two separate axes to get a better view of your data.