maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Broyer <>
Subject Re: Integration testing of command line tools?
Date Tue, 21 Aug 2018 06:21:58 GMT
One approach could be to have a main() overload taking an additional
Environment argument to abstract access to environment variables, system
properties, and standard I/O; and returning an int as the possible
System.exit() value.
That way, you can easily stub the environment for tests.
Your standard main() then simply (and only) call that overload with a
straightforward Environment implementation, and then call System.exit().

Le lun. 20 août 2018 15:59, Mark H. Wood <> a écrit :

> When writing integration tests for command-line tools, is there any
> support in Failsafe, jUnit, or elsewhere to fork a process and manage
> its standard IO streams?
> Or am I over-designing?  Would one typically write such an integration
> test rather like a unit test, bypassing the command analyzer and just
> calling the appropriate method on an instance created by the test
> suite?  Without stubbing or mocking the underlying code, of course,
> since it's an integration test.
> Is there a better place to ask?
> --
> Mark H. Wood
> Lead Technology Analyst
> University Library
> Indiana University - Purdue University Indianapolis
> 755 W. Michigan Street
> Indianapolis, IN 46202
> 317-274-0749

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message