By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,122 Members | 1,634 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,122 IT Pros & Developers. It's quick & easy.

How to unit test a C# library launched from an external program?

P: n/a
Hi all,

Right now, I'm debugging a C# library by starting an external
application. To do this, I go in the project settings of the C#
project, go in the Debug section and check the radio button "Start
external program". I then specify the application that will start my
library.

I was wondering how VS 2005 does this under the cover. I'm asking
this because in my situation, tons of objects from the external
program are created when my code is debugged. They are created
because the external app was launched first. I can't really re-create
all those objects because the external app is written in C++. It's
objects are accesible through COM.

The end goal is that I would like to run unit tests on my code. But
to run my unit tests, I need to launch the external app first. Since
my code access the COM objects of the external application, this
application needs to be running first.

Does anybody know how to do this? I'm a believer of TDD but I can't
find a way to do this in my development environment.

Thanks for you help,

Louis-Philippe

May 8 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Your unit test class would need to have a SetUp or similar helper method that
would perform the various tasks (executing your external app first, etc)
necessary for successful test methods to be run.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"lp********@gmail.com" wrote:
Hi all,

Right now, I'm debugging a C# library by starting an external
application. To do this, I go in the project settings of the C#
project, go in the Debug section and check the radio button "Start
external program". I then specify the application that will start my
library.

I was wondering how VS 2005 does this under the cover. I'm asking
this because in my situation, tons of objects from the external
program are created when my code is debugged. They are created
because the external app was launched first. I can't really re-create
all those objects because the external app is written in C++. It's
objects are accesible through COM.

The end goal is that I would like to run unit tests on my code. But
to run my unit tests, I need to launch the external app first. Since
my code access the COM objects of the external application, this
application needs to be running first.

Does anybody know how to do this? I'm a believer of TDD but I can't
find a way to do this in my development environment.

Thanks for you help,

Louis-Philippe

May 8 '07 #2

P: n/a
Did you try using any Profilers?? for instance CLR Profiler
--
Every thing is perfect, as long as you share!!!

Don''t forget to rate the post
"lp********@gmail.com" wrote:
Hi all,

Right now, I'm debugging a C# library by starting an external
application. To do this, I go in the project settings of the C#
project, go in the Debug section and check the radio button "Start
external program". I then specify the application that will start my
library.

I was wondering how VS 2005 does this under the cover. I'm asking
this because in my situation, tons of objects from the external
program are created when my code is debugged. They are created
because the external app was launched first. I can't really re-create
all those objects because the external app is written in C++. It's
objects are accesible through COM.

The end goal is that I would like to run unit tests on my code. But
to run my unit tests, I need to launch the external app first. Since
my code access the COM objects of the external application, this
application needs to be running first.

Does anybody know how to do this? I'm a believer of TDD but I can't
find a way to do this in my development environment.

Thanks for you help,

Louis-Philippe

May 9 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.