Skip to main content

Preferences Contexts

Introduction

Preferences contexts ensure that correct Application-Under-Test preferences are configured before test execution. This can be particularly useful when preferences which control the behavior of pop-up dialogs are being set in your AUT. The well-known example, while not completely relevant to test execution, is the Confirm Exit dialog, which has the “Always exit without prompt” checkbox.

The Preferences Context editor displays tree of all available preferences and allows modifying/removing some of their values.

Context name. This name is automatically synced with file system name. Symbols in name which are not allowed in file names are replaced with underscore character.
Comma-separated list of arbitrary hierarchical tags, i.e. resourcePerspective, jira/PC-1352, windows-only
Use this button to open tag selection dialog with list of tags from another test resources
Make a snapshot of AUT preferences and copy them into this context
Applies preferences to AUT. If Clear preferences option is on, clears existing AUT preferences first
Arbitrary plain text associated with a context
Click this button to clear current AUT preferences first
Pretty much the same as Eclipse's standard Project/FileSystem import wizards, but imported resources go directly inside Preferences context, not inside RCPTT workspace.
You can manually add a preference into a context with this button
Removes selected preference(s) from a context
List of preferences which should be applied. You can change the value of any preference.

Example

In UML Lab when a user saves an UML diagram for the first time, the dialog popup appears which asks whether to turn automatic code generation on or off. Based on user input, it modifies its internal property com.yattasolutions.codegen.GenerateCodeOnSave and also sets com.yattasolutions.umllab.dontshow.generateCodeOnSave to true.

Thus, if a test case is recorded for the first time, clicking on any option on the dialog popup is recorded as well, but later this dialog does not appear and, as a result, execution fails since it cannot find the specified dialog. There are two ways to ensure that test always passes in this case:

  • Create preferences context with dontshow.generateCodeOnSave set to false
  • Create preferences context with dontshow.generateCodeOnSave set to true and remove script lines responsible for this dialog in the Test Editor

Interaction with Workspace context

Project-specific preferences are associated with Eclpse workspace projects. Preferences context with such preferences will fail if associated projects are not present in the workspace. Therefore Preferences context may depend on workspace context to set projects up. To prevent this, either:

  • manually remove corresponding project preference nodes from Preference context
  • or use a paired workspace context.
    • Ensure that your preference context runs after the workspace context (i.e. the preference context is placed below the workspace context in the Contexts section of the Test Editor or Group context).

Back to the top