2017 October Release

Use a Token and/or the Scope for Naming ObjectsPermanent link for this heading

If you run one test several times in parallel, it might lead to problems because the test users might use the same objects. You can prevent this by giving the object a unique name. Therefore, you can use the scope and if you start several tests parallel you can use different scopes. This means each object used in the test is named: <object name> - {~scope~}.

Another possibility is that you create a token at the beginning of a test (if you want to name the objects in an even more unique way). You can for example create a token out of the time stamp and the scope. This is an example for creating a token (whose value is saved in a parameter) that combines the time stamp and the scope:

Example

<Set parameter="token" value="{~timestamp~} - {~scope~}" />

No matter if you use a token or the scope but you should use it for naming and identifying objects. These are some examples for using a token in a Fabasoft app.test test:

  • Naming objects when they are created

Example

<Execution action="Click" location="PAGES.Explore.Object List.BUTTONBAR.New" />
<Execution action="Click" location="PAGES.Explore.What do you want to create?.More" />
<Execution action="Click" location="PAGES.Explore.What do you want to create?[0].Folder" />
<Execution action="Click" location="PAGES.Explore.BUTTONBAR.Next" />
<Execution action="Set" location="PAGES.Explore.Name" value="My Folder - {~token~}" />
<Execution action="Click" location="PAGES.Explore.BUTTONBAR.Next" />

  • Rename objects after importing them

Example

<Execution action="Import" location="PAGES.Explore.Object List.BUTTONBAR.SelectTool" value="{~importdocs~}An Introduction to Fabasoft app.test.pdf" />
<Execution action="Click" location='PAGES.Explore.Object List["Name"=="An Introduction to Fabasoft app.test"]' />
<Execution action="Keypress" location="WINDOWS[0]" value="F2Key" />
<Execution action="Set" location='PAGES.Explore.Object List["Name"=="An Introduction to Fabasoft app.test"].Name' value="An Introduction to Fabasoft app.test - {~token~}" />
<Execution action="Keypress" location="WINDOWS[0]" value="ReturnKey" />

  • Selecting objects in an object list

Example

<Execution action="Click" location='PAGES.Explore.Object List["Name"=="An Introduction to Fabasoft app.test - {~token~}"]' />

Recommendation: Use the option AutoReplace when setting such token parameters to automatically replace such parameters while recording. Details see .