9 Answers, 1 is accepted
0
Accepted
Hi Nate,
open the code behind for New Test. Create a public static String variable inside the class but not inside a method (screenshot 1). Notice in the screenshot that the class name is New_Test.
Now you can access this varible from all other tests in this project like this:
See screenshot 2. Keep in mind that since it's a static variable, all tests will be working with the same instance. Any changes you make to the variable will be "visible" from all the tests.
Let me know if you're having any trouble getting this to work!
All the best,
Stoich
the Telerik team
open the code behind for New Test. Create a public static String variable inside the class but not inside a method (screenshot 1). Notice in the screenshot that the class name is New_Test.
public
static
String myVariable=
new
String();
Now you can access this varible from all other tests in this project like this:
New_Test.myVariable
Let me know if you're having any trouble getting this to work!
All the best,
Stoich
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Nate
Top achievements
Rank 1
answered on 07 Mar 2011, 05:27 PM
Thanks, I haven't tried this yet, but your explanation makes sense.
0
One more thing to keep in mind: In QA edition a code-behind file is compiled to latest changes when you run the test. If you change anything in any code-behind file it will only become visible to other tests once you run it. You don't actually need to wait for it to finish - just start it and immediately abort it. It will still have compiled.
Kind regards,
Stoich
the Telerik team
Kind regards,
Stoich
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Nate
Top achievements
Rank 1
answered on 07 Mar 2011, 05:42 PM
That's a good tip, thanks for the info. If I remember correctly, you guys plan on increasing the frequency of compiler runs in the next release, correct?
0
Hi Nate,
yes, changes in the way QA edition compiles tests will be implemented. However, I'm not 100% sure when that will happen.
Best wishes,
Stoich
the Telerik team
yes, changes in the way QA edition compiles tests will be implemented. However, I'm not 100% sure when that will happen.
Best wishes,
Stoich
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Nicklas
Top achievements
Rank 1
answered on 28 Sep 2011, 10:38 AM
What if I want to the global variable to get its value from a data source? I tried this:
public
static
String myVariable = (string)Data["Email"];
but it didn't work for me. I get this error msg: "...An object reference is required for the non-static field, method, or property...". I'm not a coder so don't really know what it means and how to resolve.
0
Hi Nicklas,
you'll need to move the right side of that operation inside a function. Leave this in the class definition:
Then reset the value inside a function in the same test like this:
Obviously the test will have to be databound.
The function can be a regular coded step or possible or possible the initializing function:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/knowledge-base/test-execution/execute-custom-scripts-before-after-test.aspx
All the best,
Stoich
the Telerik team
you'll need to move the right side of that operation inside a function. Leave this in the class definition:
public
static
String myVariable =
"some default value"
;
myVariable = (
string
)Data[
"Email"
];
The function can be a regular coded step or possible or possible the initializing function:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/knowledge-base/test-execution/execute-custom-scripts-before-after-test.aspx
All the best,
Stoich
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Vasu
Top achievements
Rank 1
answered on 26 Jan 2012, 03:27 PM
Hi,
The link : http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/knowledge-base/test-execution/execute-custom-scripts-before-after-test.aspx
seems to be broken. Can you please update with a new one that works.
Thanks,
Vasu
The link : http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/knowledge-base/test-execution/execute-custom-scripts-before-after-test.aspx
seems to be broken. Can you please update with a new one that works.
Thanks,
Vasu
0
Hello Vasu,
Anthony
the Telerik team
Here is the new link for that article.
Anthony
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items