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

Run test code from a Win Form program

5 Answers 54 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Juan
Top achievements
Rank 1
Juan asked on 20 Apr 2012, 08:15 PM
Hi everyone,

I've created a Win Forms program in Visual Studio C#. The program is very simple:
1 combo box where I have the four browser supported by Telerik TS (Chrome, IE, Safari and Firefox)
1 "Start Test" button

Basically, I have my test code in the button, so I just need to choice the browser and click the button to start the automated code.

To create the code that test the web site, I've added the Telerik references to the Win Forms. 
Everything is good with Chrome, but with the other browser I just get this error:

?myManager.ActiveBrowser.Find.ByAttributes<HtmlAnchor>("id=1245").Click()

'((ArtOfTest.WebAii.Controls.HtmlControls.HtmlControl)(myManager.ActiveBrowser.Find.ByAttributes<HtmlAnchor>("id=1245")))' is null


I don't know why the test is not finding the reference to the object with id "1245", the only thing that occurs is that the code can open the URL in the browser.

My question is, do you know if is possible to do this? or... I'm getting this error because this is not completely possible?

Please let me know if you need more details about my problem,
Thanks in advance,
Juan



5 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 21 Apr 2012, 05:35 PM
Hi Juan,

Let me see if I understand correctly:
1) You create a WinForms application
2) This applications sole purpose is life is to be a Test Studio test launcher i.e. you select the browser to use and the test to run then click a "Start" button to launch the execution of the test.
3) This process appears to be working fine when using the Chrome browser, but with any other browser you get a null reference exception. 

Do I understand your steps correctly? First, yes that is certainly doable. In fact we have a code sample showing one approach for doing this very thing - though it's different in that it demonstrates a console application and using the Telerik Testing Framework instead of running Test Studio tests.

Without seeing your code and reproducing the problem locally it's impossible to say what is causing it.

Kind regards,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Juan
Top achievements
Rank 1
answered on 23 Apr 2012, 05:55 PM
Hi Cody,
Thanks for your response.

Yes, you are correct! That is what I want. Actually, I made a console program and it works great.
I know is difficult to say what is my problem if you can't see my code. But I just wanted to know if that is possible.
If is possible to do the same in a Win forms program? (This is just to have a friendly UI for the final user.

Thanks,
Juan
0
Cody
Telerik team
answered on 23 Apr 2012, 06:07 PM
Hi Juan,

Yes it is absolutely possible (and shouldn't be all that difficult) to create a WinForms test launcher the way you want, with browser selection support. We'll be happy to help diagnose why your WinForms app isn't working once we have something in our hands to analyze.

Kind regards,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Juan
Top achievements
Rank 1
answered on 23 Apr 2012, 07:56 PM
I'll give it a try to see what is happening, I'll let you know if I need help.

Thanks Cody for all your support!
Juan
0
Cody
Telerik team
answered on 23 Apr 2012, 09:09 PM
Hi Juan,

Very good. We'll be here.

Greetings,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Juan
Top achievements
Rank 1
Answers by
Cody
Telerik team
Juan
Top achievements
Rank 1
Share this question
or