Special characters
Tosca Cloud considers { } [ ] * " as special characters.
If you want to use these characters, you have to let Tosca Cloud know to treat them as part of the text string. This is called "escaping".
Base rule
To escape a special character, put it between double quotation marks ".
You can escape characters one at a time, or you can escape the entire string.
Let's say you want to insertTric*ntis as plain text into your application. So, the asterisk is part of the string and not a wildcard. In this case, you can use either Tric"*"ntis or "Tric*ntis".
Escape double quotation marks
If you want to use double quotation marks as part of a string, you need to escape twice:
-
Use double quotation marks to escape the special character ".
-
Add an additional leading double quotation mark to indicate that the subsequent " is the actual string and not the end of an escaped string.
You can escape one character at a time, or you can escape the entire string.
Let's say you want to insert {"ILoveMyTestcase"}. In this case, you need to enter "{""ILoveMyTestcase""}":
-
The " at the beginning and the end escapes the entire string, including the special characters {, }, and ".
-
The " tells Tosca Cloud to treat the subsequent " as a string.
Escape { and } in 'Define variable'
The standard test step called Define variable lets you save data, so you can reuse it later in your test case.
If this data contains { or } as part of a string, you need to escape them:
-
Use double quotation marks to escape the special character.
-
Add two additional double quotation marks: ""
You can escape the characters one at a time, or you can escape the entire string.
Let's say you want to use {Tosca} as the value of your variable. In this case, you can use either """{Tosca}""" or """{"""Tosca"""}""".
Escaping { and } in various circumstances.
In this example, your test case performs the following actions:
-
The first test step uses the standard test step Define variable. It creates a variable called MyVariable with the value {Test}. Since the value contains { and }, you need to escape them according to the special rule for those characters in this standard test step.
-
The Insert test step enters the variable value into a text box and clicks Save.
-
The Check test step verifies whether the content of the text field is now {Test}. The value contains { and }, so you need to escape them. However, because this step doesn't use the standard test step Define variable, the base rule for escaping applies.
Escape { and } in different test steps