🖋️
QualityMate
  • QualityMate
  • Getting Started
    • Introduction
    • Why QualityMate
    • Architecture
    • Supported Web Browsers
    • Glossary
  • Components
    • UI Player
      • Basic Concepts
      • UiPlayer
      • MSTest Integration
      • Samples
        • QualityMate Sample Desktop
        • QualityMate Sample Web
        • QualityMate MSTest Integration Sample Desktop
        • QualityMate MSTest Integration Sample Web
        • QualityMate Integration with Test Frameworks
        • Web Authentication Sample
      • QualityMate Project Template
    • UI Recorder
      • Basic Concepts
      • Setting Up the Recorder
      • Validating an Element
      • Generating QualityMate Solution
  • Tools
    • File Comparators
    • Image Processor
    • Project Merger
    • Test Case Generator
      • Filters
      • Rename Recorded Controls
  • Basic Concepts
    • Page Object
      • Work Guide
    • Controls
      • Control Types
        • Generic Types
        • Desktop types
        • Web Types
        • WebMap types
          • Kendo PowerBuilder
          • Kendo WinForms
          • Kendo Silverlight
      • Interactions
        • SendKeys
        • Validate
    • Selectors
      • Selectors in Code
      • Default Selector
      • Shared Selector
      • Selectors Category
        • CSS Selector
        • XPath Selector
        • Image Selector
        • Frame Selector
      • Identifying Selector
        • Identify for Windows Desktop
        • Identify for Web
  • How to Guides
    • Setting Up the Configuration
      • Parameters
      • Context
      • Loading External Data
    • Awaiting for the Application
      • Busy Loaders
      • Retries
    • Defining Controls
      • Extending Controls
      • Control Slice
      • Control Collection
    • Logging on Tests
      • QualityMate Reports
      • Logging
  • Help
    • Best Practices
      • Environment
      • Tests
      • Page Objects
      • Validations
      • Interactions
      • Image Comparisons
    • Known Issues
    • Continuous Integration
      • Agents Session
    • Upgrading QualityMate
      • From version 7 to version 8
      • Previous Versions
      • How to switch from TestFeature to UiTest
    • VS Test
      • Command Line
      • Generate Reports
  • API
    • Control Interfaces
      • IButton
      • ICheckBox
      • IComboBox
      • IControl
      • IControlSlice
      • IDateTimePicker
      • IElement
      • IGrid
      • IGroupBox
      • ILabel
      • IListBox
      • IMenu
      • INumericUpDown
      • IPageObject
      • IProgressBar
      • IRadioButton
      • IRadioButtonGroup
      • ISplitButton
      • IStatusStrip
      • ITab
      • ITextBox
      • IToggleButton
      • IToolBar
      • ITreeView
    • Behavior
      • ICheckableControl
      • IList
      • ITextControl
    • Enums
      • ClickType
      • KeyModifiers
      • MouseButton
  • Changelog
    • Changelog
      • Version 8
      • Version 7
      • Version 6
      • Version 5
      • Version 4
      • Version 3
Powered by GitBook
On this page
  • Change the inheritance from TestFeature to UiTest.
  • Change from RunScenario to Execute method
  • Change how to get the Page Objects
  • Change the way a configuration is modified before Execution
  • Change the UiPlayer managers to WebManager
  • Complete examples for comparison

Was this helpful?

  1. Help
  2. Upgrading QualityMate

How to switch from TestFeature to UiTest

Change the inheritance from TestFeature to UiTest.

Before:

public class MyTest : TestFeature 
{    
}

After:

public class MyTest : UiTest 
{    
}

Change from RunScenario to Execute method

Before:

this.RunScenario(given => this.FirstStep(), then => this.SecondStep());

After:

this.Execute(this.TestCaseSteps);

The Execute method receives a delegate, this means that it can be a lambda or another method with an UiExecutionController as a parameter. If you have multiple steps in RunScenario these can be passed to a new method like this:

public void TestCaseSteps(UiExecutionController controller)
{
    this.FirstStep(controller);
    this.SecondStep(controller);
}

Change how to get the Page Objects

Now the methods need to explicitly receive an UiExecutionController as a parameter. This object is used to call the GetPageObject method. As follows:

Before:

private void FirstStep()
{
    MyPageObject myPageObject = this.GetView<MyPageObject>();
    myPageObject.ListBox.ClickItem("item2");
}

After:

private void FirstStep(UiExecutionController controller)
{
    MyPageObject myPageObject = controller.GetPageObject<MyPageObject>();
    myPageObject.ListBox.ClickItem("item2");
}

A common pattern was to use a property to get the Page Object as follows:

public class MyTest : TestFeature
{
    private MyPageObject MyPageObject => this.GetView<MyPageObject>();
}

This pattern is no longer supported because, with the new architecture, QualityMate can run more than one UiPlayer at the same time. An UiExecutionController is created on every Execute call and you need to explicitly get the PageObjects from it.

Change the way a configuration is modified before Execution

Before:

this.ConfigurationManager.CreateContext(new Dictionary<string, string>
{
    [ParameterName.Technology] = Technology.DesktopWinForms.ToString(),
    [ParameterName.Application] = AssetPaths.WinAppPath,
});

this.RunScenario(given => this.FirstStep(), then => this.SecondStep());

After:

Dictionary<string, string> newConfiguration = new Dictionary<string, string>
{
    [ParameterName.Technology] = Technology.DesktopWinForms.ToString(),
    [ParameterName.Application] = AssetPaths.WinAppPath,
};

this.Execute(this.TestCaseSteps, this.newConfiguration);

If all the configuration is in the .runsettings it is not necessary to pass the configuration on the Execute method.

this.Execute(this.testCaseSteps;)

Change the UiPlayer managers to WebManager

Before:

this.UiPlayer.NavigationManager;
this.UiPlayer.AlertManager;
this.UiPlayer.BrowserManager;

After:

controller.WebManager.Navigation;
controller.WebManager.Alert;
controller.WebManager.Browser;

Complete examples for comparison

TestFeature example:

[TestClass]
public class MyTest: TestFeature
{
    private void ChangeConfiguration()
    {
        this.ConfigurationManager.CreateContext(new Dictionary<string, string>
        {
            [ParameterName.Technology] = Technology.DesktopWinForms.ToString(),
            [ParameterName.Application] = AssetPaths.WinAppPath,
        });
    }

    [TestMethod]
    public void MyTestMethod()
    {
        this.ChangeConfiguration();
        this.RunScenario(given => this.FirstStep(), then => this.SecondStep());
    }

    private void FirstStep()
    {
        MyPageObject myPageObject = this.GetView<MyPageObject>();
        myPageObject.ListBox.ClickItem("item2");
        
    }

    private void SecondStep()
    {
        MyPageObject myPageObject = this.GetView<MyPageObject>();
        myPageObject.ListBox.Validate(self => self.SelectedItem == "item2");
    }
}

UiTest example:

[TestClass]
public class MyTest: UiTest
{
    private UiPlayerConfiguration newConfiguration = new UiPlayerConfiguration
            {
                Technology = Technology.DesktopWinForms,
                Application = AssetPaths.WinAppPath,
            };

    [TestMethod]
    public void FirstStep_SecondStep()
    {
        this.Execute(this.TestCaseSteps, this.newConfiguration);
    }

    private void TestCaseSteps(UiExecutionController controller)
    {
        this.FirstStep(controller);
        this.SecondStep(controller);
    }

    private void FirstStep(UiExecutionController controller)
    {
        MyPageObject myPageObject = controller.GetPageObject<MyPageObject>();
        myPageObject.ListBox.ClickItem("item2");
    }

    private void SecondStep(UiExecutionController controller)
    {
        MyPageObject myPageObject = controller.GetPageObject<MyPageObject>();
        myPageObject.ListBox.Validate(self => self.SelectedItem == "item2");
    }
}
PreviousPrevious VersionsNextVS Test

Last updated 4 years ago

Was this helpful?