You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Denis Sadowski (JIRA)" <ji...@codehaus.org> on 2008/04/29 16:04:47 UTC

[jira] Issue Comment Edited: (SUREFIRE-477) Issue with redirectTestOutputToFile and unit test with System.out.print

    [ http://jira.codehaus.org/browse/SUREFIRE-477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=132976#action_132976 ] 

dsadowsk edited comment on SUREFIRE-477 at 4/29/08 9:04 AM:
------------------------------------------------------------------

I have attached an expansion of your provided project, included a copy of your BasicTest called NotShownTest as well as a unit test that will break the I/O stream using print. 

BasicTest will run just as it did in your sample project, then PrintTest will run, it will break the I/O to the command prompt, and if you look into junit4.PrintTest-output.txt the "Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec" is outputted here instead of to the window.

After this no other output is redirected to the command prompt during execution, and NotShownTest (renamed copy of BasicTest) will not redirect its print statements to a -output.txt file.

Attached is also a screenshot from the command prompt to show the lack of output.

Furthermore, if a test case with a failure is injected then the test failure and error results are not displayed.

      was (Author: dsadowsk):
    I have attached an expansion of your provided project, included a copy of your BasicTest called NotShownTest as well as a unit test that will break the I/O stream using print. 

BasicTest will run just as it did in your sample project, then PrintTest will run, it will break the I/O to the command prompt, and if you look into junit4.PrintTest-output.txt the "Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec" is outputted here instead of to the window.

After this no other output is redirected to the command prompt during execution, and NotShownTest (renamed copy of BasicTest) will not redirect its print statements to a -output.txt file.

Attached is also a screenshot from the command prompt to show the lack of output.
  
> Issue with redirectTestOutputToFile and unit test with System.out.print
> -----------------------------------------------------------------------
>
>                 Key: SUREFIRE-477
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-477
>             Project: Maven Surefire
>          Issue Type: Bug
>    Affects Versions: 2.4
>            Reporter: Denis Sadowski
>            Priority: Minor
>         Attachments: command_prompt.JPG, redirectIssue.zip, surefire477.zip
>
>
> We have the Maven surefire plugin configured to redirect test output to file using the redirectTestOutputToFile property.
> Consider the following unit test:
> import static org.junit.Assert.*;
> import org.junit.Test;
> public class PrintUnitTest {
> 	@Test
> 	public final void test1() {
> 		assertTrue(true);
> 		System.out.print(System.currentTimeMillis());
> 	}
> }
> The surefire plugin fails to print any more information to the console window after "Running PrintUnitTest". Hence does not show the "Tests run ........." line.
> Furthermore, if other unit tests are run after this one, they run, but there output is also not shown on the console window. If a build failure occurs in any of the unit tests the Results, with mention of which tests failed are not printed.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira