One of the key Qualibrate features is the ability to store information from the applications under test. Sometimes, users are interested in storing portions of large texts generated by the application, and Qualibrate gives users the ability to search parts of the text that they would like to store.
In this example, we will show you how to store the PO number from the full text displayed in an SAP status bar control. In the case of SAP applications, the code language supported is .NET (for Web applications, we use Javascript).
Example
Full Text | RMC - Standard PO 4500017748 changed |
To Store | 4500017748 |
Procedure
To store the number, we can use an advanced .NET code snippet to save only the portion needed from the full text. To do that, follow this procedure.
Open the Recorder widget
When the text you want to store appears, click the Store button in the Recording widget
Select the control where the text appears (status bar, text field, etc.)
After the “Store” step is added:
Expand the recording control
Change the User Action to “Custom”
Click the “Configuration” button
In the code editor, paste the following code:
string[] txt; string[] sep = new string[] {" "}; txt = obj.Text.Split(sep,StringSplitOptions.None); return txt[4];
Save the configuration
Click “Save” in the recording widget
Want other parts of the text?
The code above splits the text into parts divided by a space key (“ “). Each part is saved into a text array which elements can be accessed by their index (enclosed in brackets). The text from this example is composed by 6 parts, which can be accessed as follows:
Full Text | RMC - Standard PO 4500017748 changed |
RMC | txt[0] |
- | txt[1] |
Standard | txt[2] |
PO | txt[3] |
4500017748 | txt[4] |
changed | txt[5] |
Comments
0 comments
Please sign in to leave a comment.