Reputation: 612
I want to run unit and integrated tests for my windows phone 7 application.But The library which has been provided by jeff wilcox and code from http://smartypantscoding.com/a-cheat-sheet-for-unit-testing-silverlight-apps-on-windows-phone-7 run through emulator.
But I want to run individual tests in the same way any windows application runs e.g by right clicking on individual tests in a test class .. also if soemone wants to run the tests through the command line without invoking the sdk.
But the unit testing framework which is currently available runs through emulator.
Upvotes: 0
Views: 169
Reputation: 84724
With some good separation of concerns and some limitations, you can execute your tests using the Silverlight runtime. Once this is configured you can run your tests using ReSharper+AgUnit or TestDriven.net in VS and Statlight from the commandline.
You can read about the setup instructions on a blog post I wrote up but for the sake of keeping information on SO, I'll summarise here:
Reference Microsoft.Silverlight.Testing
and Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight
from the Silverlight (not WP) toolkit%programfiles%\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone71
and set Copy Local
to true
The limitations include:
Microsoft.Phone.*
)If you can deal with all that (I still haven't decided if it's worth it) it can provide a pretty quick test cycle, and the in-emulator tests can still be run for anything that sits outside the limitations.
What we really need is the emulator supporting a fast, headless mode (in-emulator tests is way more compatible) and some kind of Gallio adapter.
Upvotes: 2
Reputation: 9604
You can run the Silverlight Unit Test apps on your phone, but if you've got WP7.5 "Mango" make sure you get the Mango compatible binaries first from Jeff Wilcox's blog.
To run individual tests use the "test tag" capability: Add a tag to the tests you want to run [Tag("MyTag")]
, either at the TestClass or TestMethod level. Then type the matching tag into the text box on the launch screen of the test app.
That's the best way I've found of re-running tests to quickly validate a fix you've got. I usually keep a short tag reserved for debugging (e.g. "e") so it's quick to type.
Upvotes: 0
Reputation: 26347
You'll have to run the unit tests through the emulator. End of story.
Upvotes: 1