Units
A unit represents an actionable component in your model, such as log in or purchase. You combine units to create a model for testing.
Unit overview
Each unit represents an action in your application. You create units for each action, and then build a model showing the possible flows between these units. To automate testing, each unit should correspond with a test in your Git repository.
Units can be created in the following ways.
Method | Details |
---|---|
Manual creation | Create units in MBT, and then connect them with scripts in your Git repository. |
Import from file |
Import a model from a BPMN or JSON file. For details, see Import a BPMN file. |
FT Design | Use Functional Testing Design to write test scripts for your units. For details, see Create a unit in Design. |
A unit can be assigned to multiple MBT models and tests. If you modify a unit, the change is applied to all related tests and models.
Create a unit
This section describes how to create and configure a unit. The instructions on configuring units are also relevant for auto-discovered units.
To create and configure a unit:
-
Select a model folder in the MBT repository pane, or create a new model folder. This structure enables you to organize your MBT models and units in a way that is meaningful to you.
-
In the Units tab, click + Unit.
-
In the Details tab, enter the unit's name, and fill any other fields that are relevant. We recommend that you configure the details described in the following table.
Field Description Automation status Specify whether the test covering this unit is automated in your CI server.
When you create an MBT test that covers this unit, the test indicates what percentage of the test's units are automated, helping you optimize your automation strategy.
Repository path If the unit has a corresponding test script in Git, enter the path to the test script in the repository that is defined in MBT settings.
Do not enter the full path to the test script, but only the relative path inside the repository. For example, if a test is located inside <Git repository URL>/UFTtests/Action1, the Repository path is UFTtests/Action1:ActionName.
Note: When you use auto-discovery to populate units, each unit is automatically assigned a test runner on creation based on its Git URL. You can then see the unit's runner using the optional Test runner field. This helps ensure that all units in a path use the same test runner.
Testing tool type Define the testing tool that will be uses to run the automated script. Priority You can add the Priority field if needed.
If you choose High or Low priority, this is indicated on the unit's card and in the preview pane.
Phase Select the unit's phase. MBT uses phases to represent the current state of an item. As you work on items, advance them from phase to phase.
When you set a model's phase to Ready, the icon representing the model changes color.
-
(Optional) In the Parameters tab, click + Unit Parameter to create input or output parameters for the unit.
For example, you could have a unit whose function is to search for a book. The input parameter is the book title, and the output is the book's internal item ID. This parameter can then be the input parameter in the next unit in your model, which takes the item ID as input, and generates a price as its output parameter.
-
For each parameter, define the following:
-
Type. Enter either Input or Output.
-
Name. Enter a name for the parameter.
-
Default value is optional.
-
-
When parameters are used in a UFT One action or Selenium test, the following are required:
-
The parameter name must be identical in MBT and in the testing tool. To rename a parameter, click on the parameter name and edit as needed.
-
The order of the parameters in the unit must be identical in MBT and in the testing tool. To reorder parameters, select a parameter and click Up or Down in the toolbar.
-
-
Create a unit in Design
Functional Testing Design FT Design enables you to create codeless tests and run them in the cloud. For details, see Create a script.
In this workflow, you use FT Design to write test scripts for your units. The test script is saved in FT Design and not in Git. You then schedule and run the tests using Functional Testing Execution. For details, see Execution.
To create codeless test scripts with FT Design:
-
In an MBT unit, click Open in Design. FT Design opens locally.
-
Create your codeless test script in FT Design. For details, see Create a script.
-
After saving the script in FT Design, click View in Model-Based Unit, or refresh the unit in MBT.
The testing tool type is automatically defined as FT Design. The repository path is automatically filled with an internal file name, and the automation status is set to Automated. These cannot be changed. If needed, delete the unit.
-
Schedule and run the tests using Functional Testing Execution. Select the test runner called Codeless Runner. For details, see Execution.
Tip: You can also perform this process in the opposite direction:
First, create a script in FT Design, then click Associate with > New Codeless Unit. A new unit is created in MBT, in a folder called VEFT Design.
To move the unit to another folder, add the Parent field in the grid view and select a different folder in the MBT repository.
See also: