Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Arbitrary executable as test runner
mausch
#1 Posted : Friday, May 18, 2012 6:45:23 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/18/2012(UTC)
Posts: 1

Hi,

Is it possible to set up NCrunch to use an arbitrary executable as test runner?
Concretely, I have a test project that is directly an .exe and runs the tests directly, reporting results to console. It doesn't use NUnit or any other typical test framework. Maybe NCrunch could get back test results through something like NUnit's xml reports?
No idea about how this affects instrumentation though.

Cheers,
Mauricio
Remco
#2 Posted : Saturday, May 19, 2012 12:34:36 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,974

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Hi Mauircio,

Thanks for posting! It is possible to have NCrunch execute the code within your .exe, though you may need to change the way you are approaching the problem.

If the .exe is launched into its own process (as is the normal behaviour with .exes), NCrunch won't be able to take control of the process and obtain coverage information from the code. NCrunch was also designed with the intention of using Tests as entry points rather than processes themselves.

By far the best way to solve this would be to create a test project that is able to call directly into the code that would be executed by your .exe. Most likely your .exe is launched by using the standard 'public void Main(string[] args)' syntax, and as such it should be very possible for you to call this same method from a test and inject the arguments in order to simulate execution by the O/S. Naturally you would have your choice of a number of different test frameworks for the entry point (NUnit, MSTest, MbUnit, MSpec, Xunit), though there is no need to use any of the advanced features of the framework as I presume that you've written the assertions in your console executable already.

I hope this helps.


Cheers,

Remco
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.038 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download