Now we are going to have a deeper look into how to define and remove representatives. We are also going to show you how you can easily move representatives and copy/paste them.
Define a Representative
You can add a representative to an equivalence class in two ways:
- Open the context menu next to the equivalence class and select “Add Representative”.
- Highlight the equivalence class row by clicking on it and press “Alt+C”.

Move Representatives Up and Down
If you want to change the order of representatives within your equivalence class you can move them up and down. Again you can do this in the following 2 ways:
- Open the context menu of the representative and select “Move Up” or “Move Down”.
- Highlight the representative row by clicking on it and press “Alt+↑” or “Alt+↓”.
A representative can only be moved within its equivalence class. So the command “Move Up” does not work on the first representative under the equivalence class and the command “Move Down” does not work on the last representative in an equivalence class.
Copy and Paste a Representative
If you want to define a representative which is quite similar to an already existing one you don’t have to define everything again. You can simply copy and paste them!
Copy a representative in the two following ways:
- Open the context menu of the representative and select “Copy”.
- Highlight the representative row by clicking on it and press “Ctr+C”
This will copy the representative into the clipboard.

If you then want to paste a representative you can do this in the following 4 ways:
- Open the context menu of that representative after which you want to copy the new one and select “Paste Below”.
- Highlight that representative row after which you want to copy the new one and press “Ctr+V”.
- Open the context menu of that equivalence class at which end you want to add the representative and select “Paste” (picture below).
- Highlight that equivalence row at which end you want to add the representative and press “Ctr+V”.

Remove a Representative
Deleting a representative from an equivalence class can be done in the following 2 ways:
- Open the context menu of the representative and select “Remove”.
- Highlight the representative row by clicking on it and press “Del”.
If you delete a representative that was already selected in one or more test cases be aware that after the removal no representative for those test cases are chosen and you need to reselect another one again.
Primitive Representatives
We are now going to focus on primitive representatives and how to edit their respective values.
What is a Primitive Representative?
Primitive representatives are representatives of the following types:
- bool
- byte
- sbyte
- short
- ushort
- int
- uint
- long
- ulong
- decimal
- float
- double
- char
- string
Change the value of a Primitive Representative
We are now going to show you how to edit an already existing primitive representative in the model view. Since this is similar for most of our types we are going to show you the general method with the type “double”. Data types “char” and “string” work a little bit different.
Let’s say the duration in our AverageSpeed example is defined by a simple parameter duration of the type double instead of a complex interface. We already defined equivalence classes and added representatives. If you add a representative the way we showed you a chapter before then you see that the value of the representative is always 0. That’s because values are initialized with their type’s default value.
There are three ways to change a value:
- Open the context menu of the representative and select “Change Value”.
- Highlight the representative row by clicking on it and press “F2”.
- Double click on the value.

The selected input field gets highlighted and you can simply edit the value.
Define a Representative of the type “char”
There are special rules for defining char values. If you add a char representative then you will see that you get actually 2 values, the character and its numeric representation in braces.

There are two ways to define a character value:
- Enter a character into the input text field with or without single quotes like ‘a’ or plain a.
- Enter the character’s numeric value.
Define a Representative of type “string”
You can enter strings with or without double quotes. There are two exceptions to this rule:
- To enter a string that contains a double quote you can do so without escaping but your string has to start and end with a double quote. E.g. “He said “Hello!” “
- To set a string variable to null you set the value to null without double quotes.
Desired value | Required input |
---|---|
Double quotes | “”” |
Null pointer | null |
A string containing the word “null” | “null” |
Complex Representatives
Beside primitive representatives we also have the option to define complex representatives. In our AverageSpeed example we have input factors of types Duration and ITrack.
Change the Value of a Complex Representative
To show you how to and what you can change when it comes to complex representatives we choose the input factor duration with Type Duration from the example.
Adding a representative always adds the default value, which is null for class types. If you want to change the value of a complex representative you have three options:
- Open the context menu of the representative and select “Change Value”.
- Highlight the representative row by clicking on it and press “F2”.
- Double click on the value.
In all three cases the Value Editor for input factor duration opens

Select a Constructor
Since complex representatives can have different constructors you first need to choose an appropriate one by using the selector in the Value Editor.

Fill the Complex Representative with Actual Values
Once you choose a constructor you will see that the view in the Value Editor changes: There is one input field for every argument of the constructor. Primitive types can directly be edited in the top-level view of the Edit Value dialog. Complex types are broken up into a tree of primitive values. The tree is shown on the left hand side of the dialog. You can use it to navigate to different nodes of the value you are editing. Furthermore there is a breadcrumb bar at the top of the dialog that displays the path to the node you are currently editing.

Once you saved your changes, the value of the representative is updated in the test model.
Factory Methods
Defining complex values with the Value Editor can become cumbersome or even impossible. For example you cannot cope with polymorphism nor cyclic data structures. For such situations you can use a factory method that creates these complex values. You can define an arbitrary number of factory methods and reuse them for representatives and expected values in your model.
Define a Factory Method
To define and use a factory method open den Value Editor. Instead of choosing a constructor choose “Add New Factory Method” in the drop down menu.

A dialog for defining a new factory method will open. You must choose a name for the factory method and may add parameters.

After saving your changes you will find the new factory method in the drop down menu of the Value Editor.

You can add as many factory methods as you want but be aware that they have to have different names.
Changes to factory methods are only allowed if they are not used to create any other value of your model.