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

Code Execution BEFORE EACH Test

3 Answers 154 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stephan
Top achievements
Rank 1
Stephan asked on 23 Sep 2015, 03:59 PM

Hi ppl,

I am currently evaluating the Test Studio including its VS plugin. The usability is very good and the element Mapping (WPF) is awesome. Everyone who has done WPF testing with the MS Framework knows what I am talking about...

However, I ran into some critical issues this morning:

Preconditions

Here is what I need to to:
1) Start IIS Server
2) Load a default Dataset XML into my MSSQL Server
3) Wait for the Process to be finished (Processmonitor)
4) Start my Application
5) Run my Tests

So, I need to ensure that steps 1) - 3) are executed BEFORE EACH test. In NUnit when writing Unittests I solved this problem simply by creating an abstract class, containing all preconditions. This also works using the MS UITesting Framework.

Test Studio always starts with step 4).

Is there...
....any possibility to execute code BEFORE EACH test using Test Studio (plugin)?
....any possibility to execute code BEFORE EACH test using only the pure framework?

This is crucial for my Application Tests, because if I do not reset the Database before a test runs again, it might fail because (for example) it tries to add an element to a list which is already in the list (unique attributes).

"Application"-class

When I am working in Visual Studio, it does not recognize the "Application"-class. It seems to only be available during run-time. So far so good, but how can I address a UI Element via C# code? (Writing "Application." [there is a dot] does not show me any suggestions, which seems absolutely logical, because Application is not recognized)
I don't need a complete tutorial here, but I would be very thankful for any link to a documentation about PURELY coded Tests using the Telerik Testframework.

 

Thank you a lot in advance!

Stephan

3 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 25 Sep 2015, 03:14 PM
Hello,

First, regarding your steps 1-3 you have a couple of options:
1) Implement our hook in a specific that runs before the tests starts
2) Implement your own test extension, more specifically the OnBeforeTestStarted hook in the extension, which will get called by every test that runs on that machine unconditionally.

Regarding "any possibility to execute code BEFORE EACH test using only the pure framework" that's completely up to you and what test runner framework you choose to use.  When using the free Telerik Testing Framework, you just using our programming API to hand code all of your tests from scratch. You have to figure out how to run code before each test, and you have to figure out what you will use for the test runner e.g. Visual Studio, NUnit, XUnit, etc.

Regarding the "Application"-class, this only exists using Test Studio, and it's "Applications"... plural like this:

Applications.WPF_Demosexe.WPF_Controls_Examples__GridView_ChartView_ScheduleView_RichTextBox_Map_Code_Samples.TextboxTextbox.SetText(true, value, 10, 100, false);

This class is autogenerated by Test Studio using all of the element definitions contained in all tests in the entire project, and then placed in the generated pages.g.cs/vb file. See here for more details. Because this is a feature of Test Studio only, you don't have access to it when using just the free Telerik Testing Framework.


Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Stephan
Top achievements
Rank 1
answered on 28 Sep 2015, 01:21 PM

Hey Cody,

 I will make this short:

Thanks a lot for your great answer! This is support at its best!

 Stephan

0
Cody
Telerik team
answered on 28 Sep 2015, 06:04 PM
Hi,

Glad I could help.

Regards,
Cody
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Stephan
Top achievements
Rank 1
Answers by
Cody
Telerik team
Stephan
Top achievements
Rank 1
Share this question
or