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 appl开发者_JAVA技巧ication 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
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.
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).
精彩评论