1. Home
  2. OpKey Help
  3. 11. Model Based Testing with OpKey
  4. 11.1 Working with Model

11.1 Working with Model

Working with Model

After successfully login into OpKey Web, select the appropriate Project in which you want to create a Model.

You will be navigated to the screen having as shown.

You can mark the “Don’t show me again” checkbox as checked if you do not wish to view this notification again.

Click “End Tour” to proceed with the process of creating a Model file.
How to create a Model File?

Method 1

After clicking on “End Tour” , you may “Click to Create New Artifact.Select Model.

The “Model”  text will appear highlighted.

Click on the highlighted icon to create a New Model. A pop up window will get open as shown

The fields marked with * are mandatory. Enter the Name of the Model. You can also enter the Description.Click OK.

Method 2

Go to Project Workspace > Select the root Folder > Click Create New file icon  > Select Model.

Method 3

Right click on root folder > select Create New > select ‘Model.

A model file will be created in the root Folder of the project Workspace.

The Model window will open up displaying a blank draft model with Start and Stop nodes.

Getting Familiar with the icons of the Model Window:

The Dockable panels of the Model Window:

The Model window contains three Dockable panels namely Details, Audit Trails and Tags. The details of these Dockable panels is mentioned below:

Details

This Dockable panel gives you the details about the Model such as the name of the OpKey user who has created it, the date on which the Model was created, the name of the user who has last modified the Model and the date on which it was last modified.

You can add comments/description about the Model in the right-hand side of the Details window.

Audit Trails

This Dockable panel reflects the details about all the changes done by user irrespective of the Model which includes Task, Field, Old Value, New Value, Time Stamp, and ByUser.

  • Task detail specify what activity has been performed by the user.
  • Field provides the name of the Data field being modified.
  • Old Value and New Value describes the previousand currentvalue of the Field being modified.
  • Time Stamp denotes the Dateand Timeon which the field was modified.
  • By User indicates the name of the user who has performed the task.
Once you click on the Export Audit Trails icon, a pop up window will open up as follows:
The Report Name is auto populated with the default Value.The Fields “From Date” and “To Date” is to define the duration for which the records are required. You can Just select the “From Date” and “To Date” values from the calendar control. Clicking on “Export” will export the details of the Audit Trails to an Excel file.

Tags

Tags are key-value combination added in the tags panel that allows the user to provide any important detail/information related to the Model.

For example, the browser or environment on which the artifact has been created. A user can add as many number of tags as possible in a particular component file.

Want to add a New Tag ? Here is how to do it:

Click on the Add Icon. A blank row will get added having a Key Name as “NewTag-1” and Value as “Value-1”  by default. The Key and Value fields are editable and can be updated as per the requirements of the OpKey User.

Getting familiar with Tags buttons:

Terms used while Creating a Model

Nodes

Nodes are the building blocks of a Model. They are also referred as Vertices.

Edges 

One Node is connected to another with the help of connectors called Edges. An edge is drawn as an arrow directed from the Current Test Step to the next Test Step.

Creating a Model

Let’s have a look at the Model window having a Blank model with just Start and Stop nodes in it.

How to create a Model?
There are two Approaches to create a Model in OpKey.

Approach 1- The Drag and Drop Method

The Drag and Drop approach is the easiest, fastest and most appropriate method to create a Model. Also you need to do is -Go to the Add Existing Node window placed at the right hand side of the Model window.

Add Existing Node window consists of all the Pre-built Components in OpKey. Select the appropriate Folder from which you wish to Drag and Drop the Components.

Expand the Function Library tree till you reach the smallest unit from where no further Expansion is possible.
You can also Search for a specific Function Library or Selected Step or Folder by typing their name in the Search bar and clicking on the search icon. Refresh icon allows to refresh and update all the pre-built components.

Now, Just Drag and Drop the Appropriate pre-built component from the Add Existing Node window  to the Draft Model.
Once done, Select the Start node and drag the Connecting Edge to the other vertex. In this way, you can easily connect the two Vertices.

Similarly, you can add more vertices to the model and connect them via. edges to complete the Model.

Approach 2- Manually Creating a Model

The process of Manually creating a Model is easy but quite lengthy. Here , You need to go to Add New Node window placed at the right hand side of the Model window.
Now, drag a blank vertex in to the draft model.
You can enter the Action in the Vertex say : Go to the Salesforce Application.Now, Select the Start node and drag the Connecting Edge to the other vertex. In this way, you can easily connect the two Vertices.

The Vertices are usually used to represent the “Verification Process“. The Edges can also be used to represent the “User’s Action” in the Model.

Similarly, you can add more vertices to the model and connect them via. edges to complete the Model.

The Vertices are usually used to represent the “Verification Process“. The Edges can also be used to represent the “User’s Action” in the Model.

How to Link the Vertices & edges to the Function Libraries?

The Edges and Vertices of the Model can be Linked to the Function Libraries  by any of the following method.

Method 1 :Right Click on the Selected Edge or Vertex

Select the Edge or the Vertex to which you wish to associate/Link the Function Library.

Right click on the Selected Edge/Vertex. A drop-down window will appear along with Various options like

Copy : Copies the Selected Edge/Vertex.

Paste: Pastes the Copied Edge/Vertex.

Open in New Tab : Open the Selected Edge/Vertex in a new window.

Link Function Library: Opens up a pop up window to associate the Selected Edge/Vertex to the Function Library.

Unlink Function Library: Used to Unlink the Selected Edge/Vertex from the Function Library, if previously associated.

Delete : Used to delete the Selected Edge/Vertex from the Model.

Select Link Function Library . 

Method 2 :Click on the “Create all Component” icon.

Go to the Add New Node Window > Click Create all Component icon.

The Vertex/Edge Associator  window will open up as follows:

Getting Familiar with the Buttons of the Vertex/Edge Associator window.

Search icon allows you to Search for a specific Folder/Function Library.

  • You can select an appropriate folder and click on Create button to create a blank FL and that created FL will automatically get linked to the Selected Vertex/Edge.
  • Here, you also have an option to expand the Function Library Tree and select the appropriate Function Library which you wish to link to the Selected Vertex/Edge. The Select button will get enabled. Click it to associate the Function Library with the Selected Vertex/Edge.
  • Click on Cancel button, if you do not want to associate any Function Library to the Selected Vertex/Edge.

Note:

If you have created the Model only with the pre-built components in OpKey, then you have the option to skip associating the Function Libraries with the Vertices/Edges of the Model.
Click Save. 

How to create Test cases from the Model?

Well, creating a complete model might seems to be a little time taking or complicated process but OpKey will prove its worth by creating a number of Test Cases, all just by a single click.

Oh yes, you heard it correctly, you can have either the complete coverage or the Edge Coverage or the Vertex coverage of the Model, all by a single click.

Also note that :

The Number of Paths in the Model = The number of Test Cases Generated

Before Generating the Test Cases from the Model, it is mandatory to download and run the MBT Utility on your system.

To do so, Go to Download Center > Click MBT Utility 

The MBT Utility will get downloaded on your system in the Zip file. Extract the files on a specific location on your system.

Double click on the highlighted file with the .bat extension. The following window will get open and the MBT Utility will start running on your system.

Now, to generate the Test cases, Click on the Publish Model.

Edge Coverage” is the value selected by default in the dropdown. You may also select either  “Vertex Coverage” or “All” from the dropdown. 

Let’s Select “All” from the dropdown and Click on Analyse/Publish Button.

The Analyze Model window will open up and the compilation process will begin.

Once the compilation is completed, the Analyze Impact and Publish Window will open as Follows:

In the Left Hand Side of the Screen you can see:

The Published Model : The model that has been created and published previously.

The Draft Model : The Recently created model after modifying the published Model.

 

In the Right Hand Side of the Screen you can see:

New Test Case(s) : The Test case(s) that has been compiled will be generated after publishing.

The Impacted Test Case(s) :The Test case(s) that has changed due to the newly created Test Cases.

The Unchanged Test Case(s) :The Test case(s) that has not been changed due to the newly created Test Cases.

Now, to generate the Test Cases, click on Publish. The Test case Associator window will get open.

Click on the “Create New” Folder icon to create a New Folder. Let the Newly created Folder remain selected so as to save all the Test Cases that will be generated after publishing.

The Process of creating Test Cases will begin and the progress status will be continuously displayed in the status bar. Once it is completed, you may close the”creating Test Case” window by clicking on the Close button.

All the generated Test Cases can be viewed in the Specified folder of the Project Workspace where you have saved them.


Now, you may modify the Draft Model and adding some Test steps in to it and then associate it with the Function Library.Click Save to save the changes made in the model.

Click on the Show Difference icon in the Publish Model window to view and compare the two models side by side.

It can be clearly seen that the New Vertex/Edge, Deleted Vertex/Edge and  Unchanged Vertex/Edge are denoted by different colors in the show difference window.

Now, You may generate the Test Cases for the newly created Draft Model in a similar manner as done for the Published Model.

Once the Test Cases for the newly created Draft Model are generated, you can have the impact analysis of the models by viewing the list of Impacted Test Cases and Unchanged Test Cases.

Wow, we have generated a number of Test Cases with 100% coverage of the Application by just a Single Click.

So, what are you waiting for? Start Creating your Model Now..

Execution Results:

Once the Model is created and you have generated the Test Case(s), click on Run Now to Execute all the generated Test Cases at one go. The Execution Wizard window will open up as follows:

Enter all the mandatory fields and Click on Finish.

The Execution will begin and the logs will get generated.

You may download the reports as per the requirements.

Congratulations! You have successfully created and Executed a Model in OpKey.

Was this article helpful to you? Yes 1 No