locked
Silverlight Unit Test Project RRS feed

  • Question

  • Hi,

    I have created a Unit Test project of my existing Silveright project.

    there is a page in this test project, which is showing summary of all the tests.


    My issue is,,,, this summary page shows the count and details of Tests which are passed, but throwing error when any test method fails.

    I think insted of throwing exception, it should continue and should show it in fail count.


    I have googled this and found that I should add this exception as handled expection , so that i will not throw it and will continue.But I am still getting exception when any test method fails.

    Can some one give any inputs regarding above issue.


    Thanks

    Wednesday, July 6, 2011 8:51 AM

Answers

  • Your solution should have three projects in it now. Your Silverlight Application project, your Silverlight Unit Test project, and a Web project (the project that contains the aspx files. If you do not have the web project, and are only using the Silverlight Application project, then you should add a web project. The easiest way is to create a new Silverlight Application, and move your project files from your current Application to the new Application. Then you can add a new Unit Test Project and move your test files to the new project.

    It is always best to use a .Web project for development and debugging purposes. When your application is deployed, it will be hosted within a web project.

    Friday, July 8, 2011 11:16 AM

All replies

  • Are you saying the application will "break" (ie tests will stop and VS will show you line where exception occured) when you run the tests? This will happen if you have Silverlight debugging enabled. You should disable Silverlight debugging for your unit test project.

    Follow the steps located here but uncheck the Silverlight option.

    Wednesday, July 6, 2011 5:08 PM
  • Hi,

    Thanks fr your reply.

    I have tried to follow the link you have given. but its not making any difference.Still Its crashing on testcase fail.

    I have Silverlight Unit Test project, which does not have this type of property page.

    the link , which u have suggested, is saying to change the setting of Web project. and it will not make any difference in my case, as its not coming in picture at all.

    My main Silverlight project is directly accessed by Silverlight Unit Test project.

    Friday, July 8, 2011 10:08 AM
  • The .Web project should be part of your solution. When you create a new Silverlight Unit Test Application, it gives you the option to "Host the Silverlight application in a new Web site". This option should be checked. And that .Web project will have the option to turn off Silverlight debugging by going to the project propertyies -> Web tab -> Debuggers. The .Web project should also be your startup project.

    If you added it to an existing solution, you should be given the option "Host the Silverlight application in a new or existing Web site in the solution". This option should be checked. Along with this will be the option to "Add a test page that references the application". This should be checked. There are two other options "Make it the start page", and "Enable Silverlight debugging". The first can be set or not, but the new page must be made the start page when trying to run your tests. The later should be unchecked if you do not want to debug your tests (which will cause VS to break on exceptions).

    Friday, July 8, 2011 10:22 AM
  • I have a SL project, and its web project.

    Then I have added a New Silver Light Unit Test project(Its a SL project not a web project), which is directly using my SL project tp test it.


    Do you want to say that I should add a Web proejct for this test project and then change the settings?

    Friday, July 8, 2011 10:50 AM
  • Your solution should have three projects in it now. Your Silverlight Application project, your Silverlight Unit Test project, and a Web project (the project that contains the aspx files. If you do not have the web project, and are only using the Silverlight Application project, then you should add a web project. The easiest way is to create a new Silverlight Application, and move your project files from your current Application to the new Application. Then you can add a new Unit Test Project and move your test files to the new project.

    It is always best to use a .Web project for development and debugging purposes. When your application is deployed, it will be hosted within a web project.

    Friday, July 8, 2011 11:16 AM