On Fri, May 2, 2008 at 11:10 AM, Kenny Riddile <kfriddile@yahoo.com> wrote:
Kenny Riddile wrote:
> Robert Dailey wrote:
>> Hi,
>>
>> Currently in Visual Studio, running a console application as a unit
>> test results in the dialog immediately disappearing after it is done
>> executing, regardless of success or failure. In both cases, I would
>> like for the console dialog to pause, as it does with a call to
>> system( "pause" );. Is there some preprocessor directive I can define
>> to make this happen? Since Boost.Test is a framework, it is the
>> responsibility of boost to do this. If it doesn't do it at all, I
>> could just as easily go into the source code and add that logic
>> myself if I need to.
>>
>> Help is appreciated.
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users@lists.boost.org
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
> If you're just trying to run it from the IDE, I believe running
> without debugging (ctrl-F5 instead of just F5) will do what you want.
>
I just noticed the word "automating" in the subject which suggests you
aren't trying to run from the IDE.  Couldn't you simply make a batch
file that runs the test program and then calls "pause" and have your
system run that instead of modifying boost code?  Forcing user
interaction doesn't sound to "automated" though...

Hey Kenny,

Thanks, the batch file idea is pretty much the best idea so far. However, this still won't work if I run it from visual studio. By "Automated" I mean exactly what it means: The pause process should be handled by boost, transparently, which is a form of automation. I'm not saying boost should force the user either, if you simply make it a preprocessor define like BOOST_TEST_PAUSE, you provide the user the flexibility of deciding whether or not boost will pause at the end of the test or not, which makes boost a little more flexible and I won't have to run off and make a batch file. The logic, at least without having looked at the boost.test source, would be seemingly simple:

#ifdef BOOST_TEST_PAUSE
system( "pause" )
#endif // BOOST_TEST_PAUSE

This may not be portable, but other platforms may not have the "Console disappearance" issue, so this may be a windows-specific feature. I will probably add this logic somewhere and submit a patch to the boost dev team.

Thanks for all the help guys.