Rename Recorded Controls

How to rename the controls that will be generated for the Test Case Generator

Find the Recorder Model file and open it with any text editor

Recorder Model

  • The Recorder Model is the one that stores the UI Tree and the Recordings.

  • The Model can be found on the Project directory in the Raw folder with the name model.json

  • Once you open the model file, we will be only working on the ComponentTree area (the UI Tree).

    {
      "$type": "UiRecorder.Model.Model, UiRecorder.Model",
      "imageAssertionCount": 0,
      "imageComponentCount": 0,
      "ComponentTree": { },
      "Suite": { }
    }

Find the Component to rename

Component

  • The Component is a representation of the UI element recorded, and is only inside the ComponentTree.

  • Once you find the component to edit its name, type and selectors, it will look like these

    {
      "$id": "2",
      "$type": "UiRecorder.Model.Component, UiRecorder.Model",
      "ControlDescriptor": 
      {
          "$type": "UiRecorder.Contracts.Models.RecorderControlDescriptor, UiRecorder.Contracts",
          "Id": "Form1",
          "Name": "FlaUI WinForms Test App",
          "Class": "WindowsForms10.Window.8.app.0.2bf8098_r9_ad1",
          "Type": "Window",
          "IsPassword": false,
          "CanReceiveText": false,
          "Properties": 
          {
              "$type": "System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.String, mscorlib]], mscorlib",
              "FrameworkType": "WinForm",
              "Index": "-1"
          },
          "Value": null
      },
      "UserDefinedProperty": 
      {
          "$type": "UiRecorder.Contracts.Models.UserDefinedProperty, UiRecorder.Contracts",
          "Name": "MyApplication",
          "Type": null,
          "Selectors": 
          [
              {
                  "Technology": "Web",
                  "Value": "body"
              },
              {
                  "Technology": "KendoWinForms",
                  "Value": "wm-app"
              }
          ]
      }
    }

This structure could change over time. But will always be inside ComponentTree

Fill the UserDefinedProperty

UserDefinedProperty

  • The UserDefinedProperties is a structure that every Component has.

  • It will store desired properties of the actual component for the generated solution.

    • Name ➔ string

    • Type ➔ string

    • Selectors ➔ List

    "UserDefinedProperty": {
        "$type": "UiRecorder.Contracts.Models.UserDefinedProperty, UiRecorder.Contracts",
        "Name": null,
        "Type": null,
        "Selectors": null
      },

Name and Type

  • To change the Name and Type just change the null for what you want inside of double quotes (").

  • If you don't know the Type which is a QualityMate Interface just leave the null, the TestCasesGeneration will fill.

    "UserDefinedProperty": {
        "$type": "UiRecorder.Contracts.Models.UserDefinedProperty, UiRecorder.Contracts",
        "Name": "MyNameForElement",
        "Type": "IButton",
        "Selectors": null
      },

Selectors

  • The selectors are a List of Selector which has Technology and Value (only CSS selector is supported in the TestCasesGenerator).

  • If we want to add a selector for the component, first add square brackets ([,]) to Selectors

    "UserDefinedProperty": {
        "$type": "UiRecorder.Contracts.Models.UserDefinedProperty, UiRecorder.Contracts",
        "Name": "MyNameForElement",
        "Type": "IButton",
        "Selectors": []
      },
  • Now we can add Selectors inside the list with curly brackets ({,}). Also, both Technology and Value inside double quotes (").

  • If you want more than one just add a comma (,).

    "UserDefinedProperty": {
      "$type": "UiRecorder.Contracts.Models.UserDefinedProperty, UiRecorder.Contracts",
      "Name": "MyNameForElement",
      "Type": "IButton",
      "Selectors": [
              {
                  "Technology": "Web",
                  "Value": "body"
              },
              {
                  "Technology": "KendoWinForms",
                  "Value": "wm-app"
              }
          ]
      },

Last updated

Was this helpful?