This is a migrated thread and some comments may be shown as answers.

Question about including piece of testing code

4 Answers 75 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
veri555999
Top achievements
Rank 1
veri555999 asked on 24 Sep 2015, 11:01 AM

Hi, hospital form guy here

Situation: every hospital form has the same header which uses the same piece of code for testing. I currently have 2 form tests written. Problem is, the same code is copy-pasted in both tests. If I want to make changes to the header code, I have to change it in every test, which is not very convenient.


Situation that would be useful:

1. Launch test

2. Test includes the header code and tests it.

3. Test continues running its test-specific code.

 

How could I achieve this? Thank you in advance.

4 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 25 Sep 2015, 06:55 PM
Hello,

Are you using the free Telerik Testing Framework or our commercial Test Studio product?
  1. In Test Studio you should put the common steps into a sub test then call it from a parent test using Test-as-step.
  2. Using Telerik Testing Framework the principle is the same but you use standard programming methods to create a common method that both tests would call as a subroutine.


Regards,
Cody
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
veri555999
Top achievements
Rank 1
answered on 28 Sep 2015, 12:57 PM
Sorry for forgetting to mention. I'm using the TTF with VS2013.
0
Cody
Telerik team
answered on 28 Sep 2015, 06:01 PM
Hi,

In that case option 2 that I previously explained is the route you must take.

Regards,
Cody
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
veri555999
Top achievements
Rank 1
answered on 15 Oct 2015, 12:08 PM

Hi again.

So, the shared code has been split into several files and is called when needed.

Case closed!

Tags
General Discussions
Asked by
veri555999
Top achievements
Rank 1
Answers by
Cody
Telerik team
veri555999
Top achievements
Rank 1
Share this question
or