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

Telerik Testiing Framework

8 Answers 129 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Catriona
Top achievements
Rank 1
Catriona asked on 15 May 2014, 03:59 PM
I'm trying to use the Telerik Testing Framework (Not Studio) to run tests with NUnit.
I have only just started with your testing framework so are probably asking some "newbie" questions (Sorry).

I have to use IIS as I'm using VS20103.
I have looked at your example code QuickSTarts_NUnit/AspNetANdTestRegion.
I have used this as a basis for my test.
I have a couple of questions.
1. When using your BaseTest, How do I get access to the TextFixture to start my IIS as the start of all my tests?
2. How do I shut down a browser at the end of a test? A Manager.RemoveBrowser(ActiveBrowser.ClientId) doesn't seem to do this.
3. When running TestMethod2 and TestMethod2B both browsers are left running. If I do this.CLeanup() in test MyTestCleanUp() this has no affect.

My aim is to start IIS at the beginning of the Tests, Load a page and perform some tests.
Some tests will load different pages in the same browser.
I want to test my javascript
I want to test multiple pages (Although I think I read that this wasn't possible).

I've attached my simple test project only TestMethod2 & TestMethod2B work at all.

8 Answers, 1 is accepted

Sort by
0
Ivaylo
Telerik team
answered on 16 May 2014, 01:49 PM
Hello Catriona,

Please take a look at the following article on getting started with Telerik Testing Framework. I hope you will also find useful automating browser actions.
On accessing TextFixture you should look over the internet for a solution since this is beyond our scope of the support expertise. You can find this article helpful.
About closing the browser you can simply use:

ActiveBrowser.Close();

About testing Javascript take a look at Invoking Javascript funtions article.

Regards,
Ivaylo
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Catriona
Top achievements
Rank 1
answered on 19 May 2014, 01:48 PM

Using the links you gave me and looking through the sample code I have a test project started.

I am now trying to use the samples from C:\Program Files (x86)\Telerik\Test Studio\Samples\Telerik Controls Wrappers\ASP.NET AJAX\Input. I want to find a RadTextBox and put some text in there.

When I attempt to do this I can see that the text is written (If I look closely) but then I get MouseCLick;LeftCLick and timeout waiting for the text. See RadControlsWebApp3_RadTextBox.pdf in zip file (actually real project not sample given which exhibits same problem)

Is it not possible to use these HtmlControls when using IIS as the WebServer? 

If I use below, it does set the text. But how to "Wait" to check the text written?

Element PRJobIdTextBoxEl = ActiveBrowser.Find.ById("ctl00_ContentPlaceHolder1_ctl00_PRJobIdTextBox");

ActiveBrowser.Actions.SetText(PRJobIdTextBoxEl, PRJobId);


0
Catriona
Top achievements
Rank 1
answered on 19 May 2014, 02:38 PM

Some additional information which may help you see my problem.

Using my test harness I tried running your sample code Samples\TelerikControlWrappers\ASP.NET AJAX\Input\TextBox.cs the test SingleLineTextBox and this exhibited the same behaviour. The only change I made was to specify the full path.

ActiveBrowser.NavigateTo(http://demos.telerik.com/aspnet-ajax/input/examples/radtextbox/firstlook/defaultcs.aspx);


0
Ivaylo
Telerik team
answered on 20 May 2014, 07:31 AM
Hello Catriona,

Please provide me with a sample demo of the test you are using against our controls so I can take a look and be able to execute it.

Looking forward to hearing from you.

Regards,
Ivaylo
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Catriona
Top achievements
Rank 1
answered on 20 May 2014, 07:54 AM
Please find my sample project. I have added the test SingleLineTextBox() from the samples "C:\Program Files (x86)\Telerik\Test Studio\Samples\Telerik Controls Wrappers\ASP.NET AJAX\Input\TextBox.cs".
I am using VS2013, IIS.
0
Ivaylo
Telerik team
answered on 21 May 2014, 06:32 AM
Hello Catriona,

Thank you for providing me with the testing project, however I had multiple issues building it and working with it since I don't have IIS running on my machine right now.
Since you are working with our Sample Tests project which is demonstrating the use of RadControl WebAii Wrappers. Here is an example test on typing into a RadTextBox control:

[TestMethod]
public void SingleLineTextBox()
{
    Manager.LaunchNewBrowser();
    ActiveBrowser.NavigateTo("/input/examples/radtextbox/firstlook/defaultcs.aspx");
 
    RadTextBox textBox = Find.ById<RadTextBox>("RadTextBox1_wrapper");
 
    Assert.AreEqual("type here", textBox.EmptyMessage);
 
    // simulate typing
    textBox.TypeText("some text", 100);
    textBox.Blur();
 
    Assert.AreEqual("some text", textBox.InputValue);
}

That test should be running against this ASP.NET AJAX live demo.

Regards,
Ivaylo
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Catriona
Top achievements
Rank 1
answered on 21 May 2014, 07:55 AM
Thank you for the reply, unfortunately that was one of the test I was running in my environment. I had copied it into my test harness to see if it would work. It doesn't as it gives the same error as I indicated for my actual tests. Basically no data has been written to the textbox.

I've found that I can use ActiveBrowser.Actions.SetText() to set the text and look at the data using the RadTextBox html controls.

So now I guess my question now is whether the (html control) RadTextBox .TypeText can be used at all or should I regard these controls as read-only and use the ActiveBrowser.Actions.SetText() for updates?

I've attached the annotation that I get when the SingleLineTextBox is run.
0
Ivaylo
Telerik team
answered on 21 May 2014, 02:39 PM
Hello Catriona,

Yes, please use ActiveBrowser.Actions.SetText();  for updates for now.
I will investigate this further and will update this ticket accordingly.

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