Running unit tests for compact framework applications

A

aryaabraham

Hi,

Is there any way to run .net CF application unit tests on a PC or a VS Team
System Server without an emulator? I would like to leverage the code coverage
capabilities of recent versions of VS Team Systems.

Does anybody have any experience running automated regression tests on a CF
application?

Sincerely
Arya
 
D

drozd

Hi,

Is there any way to run .net CF application unit tests on a PC or a VS Team
System Server without an emulator? I would like to leverage the code coverage
capabilities of recent versions of VS Team Systems.

Does anybody have any experience running automated regression tests on a CF
application?

Sincerely
Arya

I'm assuming you mean MSTest tests. You can configure a test runner
configuration that will run the tests on the local computer using
full .NET Framework. The advantages are that you don't need a device
or emulator and the tests run really fast. The downside is that if
some of your tests exercise some device specific libraries (or P/
Invokes) then they will fail (however, in most cases you should
probably stub out these dependencies anyway).

It is also possible to check test coverage when doing this test run.

I haven't tried it yet, but I think it should be pretty
straightforward to include such a run of the tests using MSBuild in
your TFS build script.
 
C

Chris Tacke, MVP

You can run them against the desktop if the code they are testing isn't
dependent on device info, but it's a bit of a challenge because the test
assemblies are going to have references to the device test infrastructure.
The way around that is to create a separate desktop test project or maybe
modify the overall test configuration.

I do a fair amount of device testing and I actually have the TFS server spin
up the emulator (I've written an emulator library that the targets file can
launch before running tests) and actually run against it. I've also had it
run against actual hardware. Since the TFS server is really doing
regression testing (the developer should be ensuring the tests run and pass
locally in the first place) I find it's extremely valuable to have the
server testing against the actual OS rather than trying to shortcut it and
test against the desktop.

-Chris
 
A

aryaabraham

Thank you.

If I want to run code coverage I shall take your suggestion to stub out any
OS/hardware specific calls and then run the tests against the desktop version
of the .net framework.

Arya
 
A

aryaabraham

Chris,

Thank you for taking the time to answer my question. I have a follow up
question on your emulator library.

What do you do in the emulator library to start up the emulator? Do you
connect out to the real hardware to run your tests? I can see how that would
be very useful especially if I could collect OS profiling data in parallel to
look for memory or resource leaks.

If I find that test coverage is a problem I could run seperate regression
tests on a PC, for specific classes, as both you and drozd had mentioned.

Sincerely
Arya
 
C

Chris Tacke, MVP

The Emulator has an automation interface, so I created a library that can be
called directly from a msbuild targets file. When I do a nightly build it
kills any running emulator and launches a new one.

-Chris
 
S

Simon Hart [MVP]

Code coverage doesn't work for device test configs anyway. Just incase you
didn't know why it doesn't work.
 

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