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

Unable to get Silverlight tests working

23 Answers 343 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 25 Jul 2011, 03:27 PM
I have the following code in an NUnit test:

var settings = new Settings {
    Web = new Settings.WebSettings {
        Browser = BrowserExecutionType.Chrome,
        BaseUrl = "http://localhost:19736/",
  EnableSilverlight = true
    }
};
 
var manager = new Manager(settings);
manager.Start();
manager.LaunchNewBrowser();
manager.ActiveBrowser.NavigateTo("/Default.htm");
var app = manager.ActiveBrowser.SilverlightApps()[0];

The test runs (using resharper runner), and a browser opens (saying "Preparing browser for automation..."). I get an timeout:

Uncategorized: DialogMonitor.Start() : Using: ArtOfTest.WebAii, Version=2011.1.712.0, Culture=neutral, PublicKeyToken=4fd5f65be123776c
Uncategorized: DialogMonitor.Start() : OS: Microsoft Windows NT 6.1.7601 Service Pack 1
DialogPlayback: Manager.SetupDialogMonitoring() : Beginning monitoring for dialogs from the set {}.
UIAutomation: UIAutomationWindowMonitor.get_Instance() : Added a(n) WindowPatternIdentifiers.WindowOpenedProperty handler on element System.Windows.Automation.AutomationElement scope Descendants.
Framework: DialogMonitor.Start() : The current ActiveBrowser is either invisible or disconnected.
DialogPlayback: UIAutomationWindowMonitor.HandleAutomationEvent() : New window detected, but not considered a dialog (Text = "WebUI - Google Chrome", ClassName = "Chrome_WidgetWin_0").
-> error: Wait for condition has timed out

Now I switch to Internet explorer browser, I get a blank IE window and:

Uncategorized: DialogMonitor.Start() : Using: ArtOfTest.WebAii, Version=2011.1.712.0, Culture=neutral, PublicKeyToken=4fd5f65be123776c
Uncategorized: DialogMonitor.Start() : OS: Microsoft Windows NT 6.1.7601 Service Pack 1
DialogPlayback: Manager.SetupDialogMonitoring() : Beginning monitoring for dialogs from the set {}.
UIAutomation: UIAutomationWindowMonitor.get_Instance() : Added a(n) WindowPatternIdentifiers.WindowOpenedProperty handler on element System.Windows.Automation.AutomationElement scope Descendants.
Framework: DialogMonitor.Start() : The current ActiveBrowser is either invisible or disconnected.
Framework: InternetExplorerActions.LaunchNewBrowserInstance() : Process launched (ID=4848, Path="C:\Program Files (x86)\Internet Explorer\iexplore.exe", Arguments="-nomerge about:blank").
Framework: Manager.LaunchNewBrowser() : Attempting to attach on IE frame (HWND=4263410)...
Error: [unknown]() : Unable to open key HKLM\SOFTWARE\Telerik
-> error: Exception thrown attempting to launch Internet Explorer. Please make sure Internet Explorer is properly installed and you are able to launch it.

Using Firefox:

Uncategorized: DialogMonitor.Start() : Using: ArtOfTest.WebAii, Version=2011.1.712.0, Culture=neutral, PublicKeyToken=4fd5f65be123776c
Uncategorized: DialogMonitor.Start() : OS: Microsoft Windows NT 6.1.7601 Service Pack 1
DialogPlayback: Manager.SetupDialogMonitoring() : Beginning monitoring for dialogs from the set {}.
UIAutomation: UIAutomationWindowMonitor.get_Instance() : Added a(n) WindowPatternIdentifiers.WindowOpenedProperty handler on element System.Windows.Automation.AutomationElement scope Descendants.
Framework: DialogMonitor.Start() : The current ActiveBrowser is either invisible or disconnected.
Framework: FireFoxActions.FindFireFoxInstallation() : Valid Firefox 4.0.0.1 installation found at "C:\Program Files (x86)\Mozilla Firefox\firefox.exe".
-> error: Wait for condition has timed out

What am I doing wrong? I've tried installing the test framework again

Thanks,
Jon


23 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 25 Jul 2011, 10:41 PM
Hi Jonathan,

I am sorry but the ReSharper is untested and unsupported. Instead we have our own unit test runner as a part of JustCode you can use instead.

Greetings,
Cody
the Telerik team
Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

Have you looked at the new Online User Guide for Telerik Test Studio?
0
Jonathan
Top achievements
Rank 1
answered on 26 Jul 2011, 12:34 PM
I installed Just Code and ran the test again, still get the same result:

Error message : 
System.InvalidOperationException : Pipe hasn't been connected yet.


Stack Trace : 
   at System.IO.Pipes.PipeStream.CheckWriteOperations()
   at System.IO.Pipes.PipeStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at ArtOfTest.WebAii.Messaging.Http.HttpProxyManager.InstallAsSystemProxy()
   at ArtOfTest.WebAii.Core.Manager.LaunchNewBrowser(BrowserType browserToLaunch, Boolean waitForBrowserToConnect, ProcessWindowStyle windowStyle, String arguments)
   at ArtOfTest.WebAii.Core.Manager.LaunchNewBrowser(BrowserType browserToLaunch, Boolean waitForBrowserToConnect, ProcessWindowStyle windowStyle)
   at Lincs.AcceptanceTests.Publishing.PublishingNavIconSteps.WhenThePublishingIconIsClicked() in D:\uklhctfs01\Felincs\Dev\Source\Slincs\Lincs.AcceptanceTests\Publishing\PublishingNavIconSteps.cs:line 21
   at TechTalk.SpecFlow.Bindings.MethodBinding.InvokeAction(Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
   at TechTalk.SpecFlow.TestRunner.ExecuteStep(StepArgs stepArgs)
   at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()
   at Lincs.AcceptanceTests.Publishing.PublishingNavigationIconFeature.OpenPublishingNotificationView() in d:\uklhctfs01\Felincs\Dev\Source\Slincs\Lincs.AcceptanceTests\Publishing\PublishingNavIcon.feature:line 6
0
Jonathan
Top achievements
Rank 1
answered on 26 Jul 2011, 04:34 PM
Switched to MSTest and it all worked. Works in resharper runner too.
0
Cody
Telerik team
answered on 27 Jul 2011, 07:34 PM
Hi Jonathan,

It appears we have a regression... NUnit tests no longer work at all. I tried running them using the standard NUnit GUI and they don't work their either. I've filed a high priority bug on this here. Thank you for reporting this issue.

Regards,
Cody
the Telerik team
Check out the Test Studio roadmap to find out more about the new performance testing functionality coming in our R2 2011 release this September!

Have you looked at the new Online User Guide for Telerik Test Studio?
0
A
Top achievements
Rank 1
answered on 11 Aug 2011, 04:31 AM
Hi Team!
Tell me please when did this regression appear? Does WebAii Framework version exist which works with NUnit correctly? And how I can get it? Now I can download latest version only.

Thanks,
Andrew.
0
Cody
Telerik team
answered on 11 Aug 2011, 05:11 PM
Hi A,

After posting that message I discovered we do still work fine so long as you use nunit-x86.exe (instead of nunit.exe) if you're running on a 64 bit machine. If you still have problems I'll be glad to assist.

All the best,
Cody
the Telerik team
Vote for Telerik Test Studio at the Annual Automation Honors Voting!
0
Kelly
Top achievements
Rank 1
answered on 20 Mar 2012, 04:19 PM
Hello everyone,

I too am still having similar problems as described by the original poster.  My OS is Windows 7 Enterprise, 64 bit.  The WebAii Framework version is 2011.2.1117.0.  I do believe it to be the latest but if there is an update please let me know.

I am using Internet Explorer 8.  I've gone ahead and tried the "disable all add-ons" approach. I've ensured that my browser has been configured for UI Testing automation.  I do have Telerik Test Studio (TTS) and recorded a quick test and it works fine when running it from w/i TTS...but once I converted the whole thing to C# code, trouble began and it's hit the fan...from missing references to just flat out headaches.  Been at it for a damn week now!

I'm using NUnit 2.5.10.11092, CLR version 2.0.50727.4963 and yes I am using the n-unit-86.exe *32 assembly, verified through the Task Manager.  Does this mean that my automated UI Test should be targeting .net 2.0 framework?  I've tried changing it in the Application tab (w/i Visual Studio 2010) of the project but then Visual Studio tells me that I cannot change the specified .NET framework or profile of a test project.  Attempted re-targeting of the project has been canceled.

I've scoured the forums on here trying to find a fix for this but no luck! Please help.

-Humberto

0
Cody
Telerik team
answered on 21 Mar 2012, 12:55 AM
Hi Humberto,

My first question is a very high level question. Why do you want/need to convert your test into a coded unit test?

If this is an absolute requirement, could you detail what exactly is going wrong beyond "missing references to just flat out headaches" and then maybe we can assist better. it is true that VS 2008 requires test projects use .NET 3.5 and VS 2010 requires test projects to use .NET 4.0. This is only because it expects you to be using the Microsoft test runner and it only supports the respective .NET framework versions.

In your case you're trying to use NUnit which means you could create a standard .NET library project instead of a test project and move your test code into this other project. Then you can target whatever .NET framework version you desire. Now having said that I don't believe NUnit requires .NET 2.0.

Would it be possible for you to send us your project for analysis?

Kind regards,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Kelly
Top achievements
Rank 1
answered on 21 Mar 2012, 04:11 PM
Cody, thank you for getting back to me so soon. 

I've been fighting with this for some time now. 

At this point there is nothing really "fancy" about my test.  I am just trying to navigate to a URL and have that URL be supplied via the app.config.  I'll gladly share it with you.  However, since I couldn't get that to work...I'll settle for just being able to navigate to the desired URL.

Alright, so no I am confused...I don't recall why I chose to create a Telerik Test Studio project in C# using the pre-installed Template.  I must have been following a tutorial online somewhere.

I have however noticed that when I take a pre-recorded test, via TTS, that once I convert it to code..and choose NUnit as the framework, that the nunit.core and nunit.framework assembly references are always missing.  I always have to remove them from the project, track them down and add them in again.  That is what I meant by "missing references".

"Headaches" because I can't get a simple script to work.  Just launch IE and got the URL I try to specify.  Since I was trying to debug the script, but being a Class library, I was attaching it to a process (nunit-86 *32) process that is already running and then I would try to run it via the NUnit GUI and hook into it for debugging purposes.  It would work and I would hit my breakpoints within Visual Studio. And it would exception out at

myMgr.LaunchNewBrowser(BrowserType.InternetExplorer);

I ended up having to specify BrowserType.InternetExplorer literally since I couldn't get it to determine that from the app.config file.  But as you can see from the code, I also tried BrowserType.Chrome without any luck.

The reason we are trying to forego executing the Automated UI scripts from within TTS or the Telerik Execution Server is that eventually these scripts will become part of an automated build and continuous integration process involving Bamboo server.  That is the starry eyed dream.

Please find attached source code.

Respectfully,

-Humberto
0
Cody
Telerik team
answered on 22 Mar 2012, 12:00 AM
Hello Kelly,

Thank you for the test project. Before I get into troubleshooting it, I'd like to offer you a totally different alternative. I have another long time big customer who is also using Bamboo. But instead of converting tests to code, they are using a build script that uses our command line runner to run Test Studio tests in their native format. They have been using this approach for nearly 2 years and are very happy with the results. I firmly believe that you too wiil be much happier in the long run with the results and the ease of test maintenance taking this approach instead. I guarantee you will avoid a lot of steps in the process as well by not converting whole tests to code. You will not rely on NUnit at all.

If you wish I can try and put two in touch so you can collaborate on this effort. They may be willing to share their setup with you. We can't help much since we've never used Bamboo and have virtually no idea where to even start.

Regards,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Kelly
Top achievements
Rank 1
answered on 22 Mar 2012, 02:26 PM
The name is Humberto.  The license credentials are under the name of Kelly.  She has nothing to do with actually using the software tool.  I appreciate the offer Cody, and will consider it for future efforts, but please, let's stay on track. Unable to launch Internet Explorer?  Now it seems I can't do it from within VS2010 nor Telerik Test Studio.  In TTS, I can't even get the 'launch recorder' to work now.

I was eagerly anticipating some type of result or idea.

Thank you,
-Humberto
0
Cody
Telerik team
answered on 22 Mar 2012, 08:42 PM
Hi Humberto,

First my apologies for the mix up in the name. I admit I didn't look closely and merely used the account name instead of your signature. Sorry about that.

Part 1 of the problem with your NUnit test is that it is not correctly starting up. Your code is duplicating what the NUnit Setup code is doing. Change the beginning of your code to this:

[Test()]
public void WebTest1()
{
    // Launch an instance of the browser
    Manager.LaunchNewBrowser();
 
    // Navigate to : 'https://askmartytest.lmi.org/'
    //ActiveBrowser.NavigateTo("https://askmartytest.lmi.org/");
    ActiveBrowser.NavigateTo(Manager.Settings.Web.BaseUrl);

Part 2 is that the format of the app.config file has changed. It needs to be formatted like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="WebAii.Settings"     type="ArtOfTest.WebAii.Core.SettingsConfigSectionHandler,    ArtOfTest.WebAii, Version=2011.2.1117.0, Culture=neutral, PublicKeyToken=4fd5f65be123776c"/>
    <section name="WebAii.Settings.Web" type="ArtOfTest.WebAii.Core.WebSettingsConfigSectionHandler, ArtOfTest.WebAii, Version=2011.2.1117.0, Culture=neutral, PublicKeyToken=4fd5f65be123776c"/>
  </configSections>
  <WebAii.Settings
    annotateExecution="true"
    annotationMode="All"
    clientReadyTimeout="60000"
    createLogFile="true"
    executionDelay="0"
    executionTimeout="20000"
    logAnnotations="false"
    logLocation="E:\WebAiiLogs\"
    queryEventLogErrorsOnExit="true"
    simulatedMouseMoveSpeed="0.3"
    unexpectedDialogAction="HandleAndFailTest"
    waitCheckInterval="500"
    />
  <WebAii.Settings.Web
    aspNetDevServerPort="-1"
    defaultBrowser="InternetExplorer"
    enableScriptLogging="false"
    enableSilverlight="false"
    enableUILessRequestViewing="false"
    killBrowserProcessOnClose="true"
    localWebServer="None"
    recycleBrowser="true"
    silverlightApplicationPath=""
    silverlightConnectTimeout="30000"
    useHttpProxy="false"
    verboseHttpProxy="false"
    webAppPhysicalPath="C:\Aot\webtest\artoftest.testing\pages"
    />
</configuration>

As for the IE launching and recording problem, have you already tried following this troubleshooting guide? Let me know and we'll continue working on resolving your problems.

Regards,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Kelly
Top achievements
Rank 1
answered on 22 Mar 2012, 09:37 PM
Hello Cody,

First off, my apologies if I came off a bit rudely.  I am trying to take a double pronged approach here.  Firstly by employing your support via the forums for trying to work up scripts via VS2010 even if I have to first create them with TTS.  And secondly by contacting Technical Support via phone, who then instructed me to open up a ticket.  Either way I have been directed to the same help file, "error launching recorder".  A serious of steps and such that I had already attempted prior to trying to contact Telerik support.

I've already done what you are suggesting.

However, thank for the tidbits regarding the new format of the app.config file.  So now there should be 2 config sections? Are they both necessary even though I am only testing a web app?

I've not tried your suggested code modifications but will get back to you.

Again, short of moving TTS to a completely different machine (which I don't have readily available) I've tried all of the other suggestions on said documentation file.  But I'll try it again and cross my fingers this time.

Kindly,

-Humberto
0
Cody
Telerik team
answered on 22 Mar 2012, 09:44 PM
Hi Humberto,

One additional thought, when using our VS plug-in, you must be sure that Visual Studio is running with administrator level rights. This means:

1) Turn UAC all the way off if using Vista or Win7 -or-
2) Log on using an account that is a member of the local administrator group for that machine
3) Run VS "as administrator"

Let me know if you need directions for how to do any of the above 3 items. If you still cannot get the recorder running let's plan on looking at this problem via GoToMeeting sometime tomorrow. I'm in Austin, TX which is Central Time. Suggest a time somewhere between 9am and 5pm Central time and we'll be good.

Kind regards,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Kelly
Top achievements
Rank 1
answered on 22 Mar 2012, 09:51 PM
What? You're in Austin!? I'm in San Antonio...

Yeah, let's plan for an online collaboration.  I've ensured that VS runs as Admin...and I'm fairly confident that I am an admin on this box since I install all kinds of things on here.

And, before I could record Tests using the VS plugin and run them. I could do this with the plugin and with the full TTS.  Now I can't do either. As of 3 days ago.

I'll be in touch.
-Humberto
0
Kelly
Top achievements
Rank 1
answered on 22 Mar 2012, 09:56 PM
Now, the code change you mentioned before (about duplicating in my code what the Manager object is already doing) is in a line after the launch of the Browser...which is the line that my code is erroring out on.

So we really are talking 2 different issues right?  One, launching and attaching to IE and two, navigating to the settings property/value that dictates my specific URL?

Just to confirm.

Also, do the training you guys offer take place in Austin? Or it is online only?

Regards,

Humbi
0
Cody
Telerik team
answered on 22 Mar 2012, 10:09 PM
Hello Humberto,

We have three options for training. The first two are online. The third (most expensive) we travel to your office.

Regarding the change to app.config format change. It's a good idea to use both only because they work together to complement each other. Neither are required. You may one, or the other, or both.

Lastly yes I think we are talking about two separate issues:
1) Getting the NUnit test to run as expected.
2) Successfully launching IE for recording or playing back a test.

These are two separate and mostly independent issues (other than obviously an NUnit test can't run if Test Studio cannot successfully connect to the browser to control it).

BTW, one last note, we do not offer telephone technical support. The number you probably called goes to our "customer advocate" people. These people handle sales questions and license activation issues only (and take purchases).

1.  Please join my meeting, Friday, March 23, 2012 at 9:00 AM Central Daylight Time.
https://www2.gotomeeting.com/join/193825794

2.  Use your microphone and speakers (VoIP) - a headset is recommended.  Or, call in using your telephone.

Dial +1 (630) 869-1010
Access Code: 193-825-794
Audio PIN: Shown after joining the meeting

Meeting ID: 193-825-794

GoToMeeting®
Online Meetings Made Easyâ„¢


Regards,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Kelly
Top achievements
Rank 1
answered on 22 Mar 2012, 10:48 PM
Yep Cody, it was a Customer Advocate...I recall seeing that title.  That is another issue we are trying to resolve...somehow disconnecting the email address that the license is linked to from the email address (me) that is actually using the tool/product and have the "reply notifications" be automatically sent to me...instead of being forwarded to me via the Purchasing agent.

I just tried to create a brand new test sript via the Plugin for VS...no luck.  See attached screen shot.

Thank you Cody.

-Humberto
0
Cody
Telerik team
answered on 23 Mar 2012, 08:12 PM
Hi Humberto,

It was a pleasure working with you today during our online meeting. To summarize we discovered that IE is just taking too long to load and be ready to perform actions. Unfortunately we don't have any information or ideas how to resolve this. You were going to do your own research on this to try and determine what is causing this slow behavior from IE. I look forward to hearing back from you after you've had time to work on this problem.

Regards,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Kelly
Top achievements
Rank 1
answered on 23 Mar 2012, 09:33 PM
Hi Cody,

Thanks for the screen sharing session this morning.  Your observation of "You IE is taking too long to load".  That sort of set the thinking process in motion in my mind and I realized that this may not have been a TTS issue but rather an IE8 issue and that TTS was correctly simply reporting that it was timing out in being able to attain a connection to IE.

In hindsight, I had noticed for a few weeks now that my IE was acting slow.  Everytime I created a new tab, it would take a good 5 seconds to do so!  Thought nothing of it affecting TTS and just endured it.

This morning after our phone call, I compared with a co-worker and his IE version would take between 1-2 secs to load up to our homepage.  Mine was taking about 9-10 seconds consistently to load up to a blank page!

I've been able to fix this issue by just going to IE Tools > Options > Advanced tab > Reset in order to reset my IE settings.  So whatever had somehow snuck into my IE settings would get flushed out.  I can't tell you exactly what the actual issue was..but am glad to report that I am now able to launch and attach an IE8 session via both the stand alone TTS and the VS2010 plugin.

I am now in the process of re-configuring my IE8 broswer for use with TTS/Plugin.

Again, thank you for your patience.

-Humberto
0
Cody
Telerik team
answered on 23 Mar 2012, 11:04 PM
Hi,

Very good to hear. Since we found solutions to both your problems I am considering this problem report closed.

Kind regards,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Humberto
Top achievements
Rank 1
answered on 26 Mar 2012, 04:48 PM
Hi Cody, yes very good. 

I wouldn't say the issue is resolved though.

There were two issues at hand.  The one remaining issue is that I am unable to execute my little test script via NUnit.  I still get the "unable to launch Internet Explorer" problem when trying to debug/run.

Ideas?

-Humberto
0
Cody
Telerik team
answered on 26 Mar 2012, 08:53 PM
Hi Humberto,

I don't have any clear ideas. Here's a video demonstrating how it works on my machine. Try following the same steps. I also attached the test project I used in this video for you.

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
Jonathan
Top achievements
Rank 1
Answers by
Cody
Telerik team
Jonathan
Top achievements
Rank 1
A
Top achievements
Rank 1
Kelly
Top achievements
Rank 1
Humberto
Top achievements
Rank 1
Share this question
or