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

How can I use global variables in Test Studio

4 Answers 207 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 14 Oct 2013, 10:47 PM
Can I use a c# class in Test Studio so I can create and maintain some global variables and methods I want to use? 
Thanks,

Jeff

4 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 15 Oct 2013, 12:24 PM
Hello Jeff,

If you would like to create global variables or functions in Test Studio Standalone version that are accessible from all the tests within the test project, you can create a utility class. This class will contain the intended functions or variables.

Let me know if this helps.
 

Regards,
Boyan Boev
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Jeff
Top achievements
Rank 1
answered on 16 Oct 2013, 02:46 PM
Boyan,

Thanks for the reply.  I ended up creating my own class in Visual Studio and added it to my tests project folder.  I found documentation on how to do this after I created this thread.  Which method do you think is best, using my own class like I am doing or using the utility class like you described in your post?

Thanks,

Jeff
0
Daniel
Top achievements
Rank 2
answered on 16 Oct 2013, 03:50 PM
Personal opinion, definitely using your own class.  Quote from a support ticket I had kind of lays it out there:

"Because you are using Visual Studio instead of our standalone Test Studio IDE it's actually easier (and IMO better) to use Visual Studio's Add Class feature (see attached screen shot). Then put your static class in this file. You can then reference and use it from your coded steps the same way you would with regular programming. Then you don't have a wasted class or overhead of an empty test."

I was using the Utility Class in the beginning, and it kind of became a bit hairy.  I jump back and forth between Visual Studio and the Test Studio IDE (only because the Test Studio IDE code editor lacks a lot of features), but still don't have any issues using the stand alone class.
0
Velin Koychev
Telerik team
answered on 21 Oct 2013, 12:42 PM
Hello,

@Jeff - As Daniel stated, it would be reasonable to use the approach from this article if you are using Test Studio IDE. If you are using Visual Studio, you might find Visual Studio's Add Class feature (as you currently do) much more useful. 

@ Daniel - Thank you for sharing your experience. 

Regards,
Velin Koychev
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Jeff
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Jeff
Top achievements
Rank 1
Daniel
Top achievements
Rank 2
Velin Koychev
Telerik team
Share this question
or