02 - Templates

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Templates

Exercise 2a – Log In Process


Objective
By the end of this exercise, you will have created a TestCase that automates the process of a simple login.

Why is this important?


This TestCase will be converted into a Template, which will then provide the skeleton for that Template.

Project perspective
The DemoWebShop, like most other online web stores, requires the user to log in before they can purchase goods from the
store. You need to create a TestCase that automates the login process in order to avoid doing it manually each time.

Instructions

1. Navigate to the TestCases root folder and add the Test Configuration Parameters “Email” and “Password”.
Enter the first pair of Email and Password created in lesson 1 as values for the Test Configuration Parameters
2.
created above.

3. Add the Test Configuration Parameter “Browser” with the value "InternetExplorer".

Within the root folder “TestCases”, create a new folder called Template. In there, create a subfolder called
4.
"2a Log In Process".
5. In the subfolder "2a Log In Process", create a new TestCase called "Log In Process".
Add the Reusable TestStepBlocks "Precondition" and "Postcondition" from the Library to the TestCase "Log
6.
In Process".

Hints
»» To recap the creation of Test Configuration Parameters, please see Lesson 2 of Automation Specialist Level 1.
»» TestSteps and Reusable TestStepBlocks can easily be searched and added to a TestCase by using the “Add
TestStep” function (CTRL+T).

8
Exercise 2b - Resolve Reference
Objective
By the end of the exercise, you will be able to use the Resolve Reference command to break the connection between the
Reusable TestStepBlock and the TestCase.

Why is this important?


Some elements of the Reusable TestStepBlocks will not be relevant for the TestCases that the Template generates. The Resolve
Reference command allows you to use the structure of the ReusableTestStepBlocks and to amend the values without changing
the Values in the Library.

Project perspective
If we want to use the Email and Password data from the TestSheet in the TestCase, we must be able to link them to the Email
and Password TestStepValues. Right now, the Log in TestStep belongs to the Reusable TestStepBlock Precondition. You need
to Resolve the Reference to edit the TestStep.

Key elements:

Reusable
TestStepBlock

Instructions

1. Duplicate the TestCase folder "2a Log In Process" and rename it to "2b Resolve References".
Right click on the Reusable TestStepBlock Reference “Precondition_Reference” and choose “Resolve
2.
Reference”.
Create a new folder in the TestCase “Log In Process” and name it “Workflow”. Place the folder in between
3.
Precondition and Postcondition_Reference.

4. Move the TestStep Log In from the Precondition folder to the Workflow folder.

5. Enter the following Values for the TestStepValues as per the table below:

TestStep TestStepValue Value ActionMode


Precondition Open the Application Url http://demowebshop.tricentis.com Input
Workflow Log in Email {CP[Email]} Input
Password {CP[Password]} Input

6. Run the TestCase created in the ScratchBook.

7. Set the "WorkState" of the TestCase to Completed.

Hints
»» Once a reference is resolved, it is not possible to revert the action. You can use the undo arrow on the top left of
Tosca. However, this option is only available if you have not saved the project after resolving the references.

9
Templates

Exercise 2c - Convert to Template


Objective
By the end of the exercise, you will be able to create a Template from the TestCase Log In Process.

Why is this important?


The Template is one of the main points of focus for TestCaseDesign. Using a TestCase Template will allow you to create several
new TestCases at once.

Project perspective
The login process of the DemoWebShop needs to be tested multiple times with many different accounts. It is time-consuming
to duplicate one TestCase multiple times and then edit the values manually. It is also hard to maintain the TestCases when
something is changed. Instead, you can create a Template from your Log in Process TestCase and link the data from the
TestSheet to it.

Instructions

1. Duplicate the folder "2b Resolve References" and rename it to "2c Convert to Template".

2. Right click on the TestCase "Log In Process" and select “Convert to Template”.

10

You might also like