views:

54

answers:

2

I know that you can create a separate console application, however, I am in the final stages of testing and my application does not have an interface. Is there a way to simply open a console and interact with that inside the desktop application? This would be in a test method. (I am using C#, in Visual Studio 2008).

Thanks,

badPanda

+1  A: 

You might be able to do what you want using AllocConsole (creates a new console) or AttachConsole (attaches to an existing console), but I think there are some limitations to what you can do with them.

See here for the API documentation for AllocConsole and here's the PInvoke page.

Here's a list of lots of Console functions, might be something else useful there too.

ho1
+1  A: 

This may or may not be helpful, but some of the same techniques of GUI testing can be applied to a console app too, of course.

Here is an article and example code in C# for a user interface test.

Or there are totally different tools/languages that can be used for UI testing, such as AutoIt v3, which is easy to learn and apply. AutoIt does have a DLL/COM control that you can access from your preferred programming language (but I haven't used it that way so I can't comment on how well it works).

ewall
I'm actually not doing any UI testing. The only piece of my application that involves the windows forms is a system tray icon.But thanks.
badpanda