badpanda
badpanda

Reputation: 2454

Is it possible to interact with a console while running a windows desktop application?

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

Upvotes: 1

Views: 793

Answers (2)

ewall
ewall

Reputation: 28100

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).

Upvotes: 1

Hans Olsson
Hans Olsson

Reputation: 55009

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.

Upvotes: 1

Related Questions