[test] Automating system("pause")

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.

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

On Fri, May 2, 2008 at 11:10 AM, Kenny Riddile
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.

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.
Did you see this docs, about executing Tests right after the compilation Visual Studio? http://www.boost.org/doc/libs/1_35_0/libs/test/doc/usage/msvc_net.html

Ovanes Markarian wrote:
Did you see this docs, about executing Tests right after the compilation Visual Studio? http://www.boost.org/doc/libs/1_35_0/libs/test/doc/usage/msvc_net.html
Great way to do it (I do the equivalent in $BUILDSYSTEM.) I like that you can just keystroke yourself to the failing tests. -- Sohail Somani http://uint32t.blogspot.com

Robert Dailey wrote:
On Fri, May 2, 2008 at 11:10 AM, Kenny Riddile
mailto: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 mailto: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.
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users Sorry, I was in a rush and saw "automate" and immediately thought automated build system/unit tests since I was doing something similar recently.

Use CTRL-F5 to run the test. 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
-- Sohail Somani http://uint32t.blogspot.com

What if I want debugging?
What if I call this from the command line (say if I call it as a post-build
event in visual studio)?
On Fri, May 2, 2008 at 11:12 AM, Sohail Somani
Use CTRL-F5 to run the test.
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
-- Sohail Somani http://uint32t.blogspot.com
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Kenny's suggestion of a batch file sounds good. Robert Dailey wrote:
What if I want debugging? What if I call this from the command line (say if I call it as a post-build event in visual studio)?
On Fri, May 2, 2008 at 11:12 AM, Sohail Somani
mailto:sohail@taggedtype.net> wrote: Use CTRL-F5 to run the test.
-- Sohail Somani http://uint32t.blogspot.com

[Please do not mail me a copy of your followup] boost-users@lists.boost.org spake the secret code <496954360805020809x753340e4yde78507203927d58@mail.gmail.com> thusly:
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.
How are you running the unit test? What I do is set the unit test as a build event on the code its supposed to test and that sends the output of the unit test console app to the build output window.
In both cases, I would like for the console dialog to pause, as it does with a call to system( "pause" );
If you do this, how is the automated build supposed to proceed? -- "The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download http://www.xmission.com/~legalize/book/download/index.html Legalize Adulthood! http://blogs.xmission.com/legalize/

"Robert Dailey" 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.
I am not 100% sure I understand your problem. There are several ways to see test output. 1. Use Ctrl+f5. The output window stays. 2. Use post build event. The output is in your IDE. 3. During debug, set a breakpoint in exit from main() HTH, Gennadiy
participants (6)
-
Gennadiy Rozental
-
Kenny Riddile
-
legalize+jeeves@mail.xmission.com
-
Ovanes Markarian
-
Robert Dailey
-
Sohail Somani