Context
The context changes some configuration parameters while QualityMate is executing. That being said, a Context is a boundary in which QualityMate executes with a parameter-defined environment.
When to use
Add or change parameters to a portion of the code during a script execution.
How to use
UiConfigurationManager class can be used inside a
using
declaration to apply the parameters on a code block.ConfigurationContextAttribute can be used to load a
.runsettings
file on methods and classes.
UiConfigurationManager
The UiConfigurationManager
class is used to generate a new context with user-defined parameters to use in that context. Also, you can check the user-defined parameters through the GetSetting
method.
Using the UiPlayerConfiguration class
Define a UiPlayerConfiguration
that will hold the desired parameters of the context, for example:
Use the UiConfigurationManager's CreateContext()
inside a using
declaration to apply the dictionary parameters on the code block; a .runsettings
file path can be used instead.
Each context temporally overrides its specified settings on the UiConfigurationManager. Once a context has been disposed of, the overridden values will be restored to their older state.
Configuration Context Attribute
The ConfigurationContextAttribute can be used as metadata for classes and methods to define a .runsettings
file path. This attribute will be loaded at runtime by UiTest
and will apply the respective configuration.
Class attribute
Method attribute
The .runsettings
file path location will be relative to the output folder
Last updated