Microsoft.VisualStudio.TestTools

J

jrad

I have created a .NET cf dll that I use in a WM application.
I have created unit tests for these classes using VS2008.
I would like to create a .NET CF application that someone can run on a
WM device to run these unit tests without needing VS2008.

Is there some sample code that shows how to iterate through the tests
in a unit test library, run them and get the result using
Microsoft.VisualStudio.TestTools assembly?

Thanks,
JR
 
C

Chris Tacke, MVP

I'm not sure what the usefulness of being able to run tests outside of the
dev environment is, but it's pretty simple. Just use refelction to load up
all classes with the TestClass attribute and execute them. An exception
(which is what an assert failure ends up being) is a failure. Of course
doing this you lose any ability to have a TestContext, DeploymentItems, etc.
You also don't get a nice set of reportable testresults.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
S

Simon Hart [MVP]

You also wouldn't get code coverage report. Very pointless activity if you
ask me.
 
M

Matt Evans

Can you get code coverage reports for smart device unit tests? Can you
tell me how, as I understood it didn't work for smart device based
unit testing?

Thanks

Matt
 
C

Chris Tacke, MVP

Studio can already deploy and run tests (with test edition or better
anyway) - am I missing something?

-Chris
 
C

Chris Tacke, MVP

Ah. Makes good sense then.

-Chris

Christian Resma Helle said:
Hi Chris,

The reason I suggested the MCSF test runner is because the developer
wanted an application to deploy and run unit tests on someone else's
device.

The test runner included in the mobile client software factory was just a
stand alone application that one can deploy to the device. The MCSF was
initially designed before the release of VS2005, at that time there was no
support for smart device unit testing
 
S

Simon Hart [MVP]

If I remember correctly, code coverage only works for smart devices when the
target config is set to local i.e. executing the tests hosted on the desktop
instead of the device emulator. The added benefit of doing this, is you can
debug these tests as well - which you can't if you execute the tests on the
emulator.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top