Silverlight Unit Test Runner for Resharper – January 2009 Update

UPDATE, 6th of May 2009: Project has been rewritten and put into another project, read more here.

 

I got some sparetime between all the family dinners during the christmas holidays and pretty much did a total rewrite of the Silverlight Unit Test Runner for Resharper.

The reason I had to go pretty drastic measures, was that the first version was closer to a proof of concept than production quality, and it also had a few flaws in it with regards to reporting results and also taking in input to the Silverlight part of the runner.

Anyways, the new and improved version can be downloaded here.

To install it, you need to have a Plugin folder in the Resharper bin directory, and within this a folder for the plugin, e.g. SlverlightUnitTest :

Once you have this in place, you need to unzip the file above. You'll now have a folder looking something like this:

The three DLLs you see in the folder need to go into the Global Assembly Cache. Simply open explorer and browse to c:WindowsAssembly and drag these files into this folder (do not move them, just normal drag'n'drop).

As you can see, there is also a WebSite folder inside the plugins directory. This is the website that everything is running in. The path for this will come handy when the plugin is first initialized. If it is the first time running the plugin after this upgrade, you'll get a dialog asking for the path for the WebSite for the Silverlight Unit Test Runner. The path of the WebSite above is the one it needs.

Simply click browse and select the path:

If by any chance you select a wrong path, or want to change the path, you can simply go to the registry and fix it by either removing the value or changing it yourself:

You should now be able to run your Silverlight Tests like any other test you've been running through the Resharper Unit Test Explorer.

Whats new
The entire architecture of the plugin has changed. The previous version relied on an Xml being outputed from the Silverlight application running into the enclosing HTML DOM. This is now changed to be using WCF services.
It will now run only the tests you have selected to run. These are sent as parameters into the plugin and forwarded to the Unit Test framework by Jeff Wilcox as tags.

How does it work
Instead of half-way trying to explain how it all works, a picture speaks more than a thousand words they say:


15 thoughts on “Silverlight Unit Test Runner for Resharper – January 2009 Update

  1. Brian Chick says:

    Looks like a great idea. Never quite got it to work for me though. It launches the test runner, but as soon as the test starts running, Studio crashes.

  2. Brian Chick says:

    One more thing: What is causing Studio to crash when using this test runner may not be an issue with the runner, but ReSharper itself.

    While Studio compiles the application and it runs just fine outside of Studio, ReSharper reports errors. See the following jira request:

    http://www.jetbrains.net/jira/browse/RSRP-86864

  3. SDeKock says:

    For some reason all tests show up as passed, even if they fail!
    This makes the plugin completely useless.

  4. rune says:

    Hei

    Litt på sida av posten, men kva verktøy og mal har du brukt for å laga det fine flytdiagrammet?

  5. einar says:

    Jeg brukte Visio 2007 og "Basic Flowchart – Metric" også valgte jeg Theme: Solstice (tror jeg det var).

  6. Have you accounted for security permissions on the web site folder? Since this is located (by default) in the Program Files folder, the visual studio user may not have appropriate rights to change the contents of the web site.

  7. einar says:

    I haven’t taken that into consideration, its a bad assumption on my account that the developer is Administrator or that Visual Studio is running as an administator.

    I’m working on a modification that would enable this to be a bit more sane and speedier as well. The idea is to separate the web piece into a separate process and have interprocess communication between the plugin and the web hoster. This would allow for a cleaner way of handling this.

  8. Dileep says:

    Everytime when I am running test, it is throwing an exception as

    System.Net.WebException: The operation has timed out
    at System.Net.HttpWebRequest.GetResponse()
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
    System.TimeoutException: The HTTP request to ‘http://localhost:1234/Services/TestResultService.svc’ has exceeded the allotted timeout of 00:00:59.6560000. The time allotted to this operation may have been a portion of a longer timeout.
    at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
    System.TimeoutException: The request channel timed out while waiting for a reply after 00:00:59.3281121. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.

    Server stack trace:
    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
    at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Exception rethrown at [0]:
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(ref MessageData msgData, Int32 type)
    at Objectware.Silverlight.Testing.Runner.TestResultService.TestResultService.GetAllResults()
    at Objectware.Silverlight.Testing.Runner.TestResultService.TestResultServiceClient.GetAllResults()
    at Objectware.Silverlight.Testing.Runner.ResultsManager.PollThread()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()

  9. Dileep says:

    Everytime when I am running test, it is throwing an exception as

    System.Net.WebException: The operation has timed out
    at System.Net.HttpWebRequest.GetResponse()
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
    System.TimeoutException: The HTTP request to ‘http://localhost:1234/Services/TestResultService.svc’ has exceeded the allotted timeout of 00:00:59.6560000. The time allotted to this operation may have been a portion of a longer timeout.
    at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
    System.TimeoutException: The request channel timed out while waiting for a reply after 00:00:59.3281121. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.

    Server stack trace:
    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
    at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Exception rethrown at [0]:
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(ref MessageData msgData, Int32 type)
    at Objectware.Silverlight.Testing.Runner.TestResultService.TestResultService.GetAllResults()
    at Objectware.Silverlight.Testing.Runner.TestResultService.TestResultServiceClient.GetAllResults()
    at Objectware.Silverlight.Testing.Runner.ResultsManager.PollThread()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()

  10. einar says:

    Sorry for the reallllllly late answer here.

    I’ve completely rewritten the entire solution and put it in a different project on Codeplex, you can read more about it here: http://www.ingebrigtsen.info/post/2009/05/01/Silverlight-Unit-Test-runners-new-project-3e-Odin.aspx

    The version out now (0.4) supports command line only, I am hard at work these days in getting the 0.5 version of that finished and then I’ll be adding the R# support as well.

    The R# support will replace the MSTest plugin that JetBrains has created, that is because of implementation issues that JetBrains has put into their plugin that will recognize Silverlight MSTest flavor, but won’t run them – causes a headache when having a new plugin that will run them.

  11. einar says:

    Sorry for the reallllllly late answer here.

    I’ve completely rewritten the entire solution and put it in a different project on Codeplex, you can read more about it here: http://www.ingebrigtsen.info/post/2009/05/01/Silverlight-Unit-Test-runners-new-project-3e-Odin.aspx

    The version out now (0.4) supports command line only, I am hard at work these days in getting the 0.5 version of that finished and then I’ll be adding the R# support as well.

    The R# support will replace the MSTest plugin that JetBrains has created, that is because of implementation issues that JetBrains has put into their plugin that will recognize Silverlight MSTest flavor, but won’t run them – causes a headache when having a new plugin that will run them.

  12. Michael says:

    Thanks a lot for this post

  13. ferpaz says:

    This plugin can be used with Resharper 4.5?

  14. Its only for R# 4, I’m afraid. They changed the API for 4.5 totally and I haven’t had the time to work on it for a while.

    I started a Codeplex project called odin (http://odin.codeplex.com), which is based on the work in this post. It has limited commandline support for now.

    I’m hard at work with the Balder project (http://balder.codeplex.com) and will focus my effort there first before I continue the Odin project, if at all. Microsoft is working on a solution themselves that integrate into Visual Studio, so I guess I’m kinda holding off for that as well.

  15. Its only for R# 4, I’m afraid. They changed the API for 4.5 totally and I haven’t had the time to work on it for a while.

    I started a Codeplex project called odin (http://odin.codeplex.com), which is based on the work in this post. It has limited commandline support for now.

    I’m hard at work with the Balder project (http://balder.codeplex.com) and will focus my effort there first before I continue the Odin project, if at all. Microsoft is working on a solution themselves that integrate into Visual Studio, so I guess I’m kinda holding off for that as well.

Leave a Reply

Your email address will not be published. Required fields are marked *