New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/fix test output parsing #106
Feature/fix test output parsing #106
Conversation
… **" and "** TEST FAILED **" are in the correct location in the output
I'm wondering why you added the following code: If you do not what the stderr appear at the stdout, than you can redirect this directly with the ProcessBuilder. |
When you pipe output, as it is doing via ProcessBuilder / Process, stdout gets buffered to some arbitrary size and stderr is unbuffered. This was resulting in something like the following in the resulting output: By running the command via Notice how I had to "correct" the example files for the TestBuildOutputAppenderTest; this is because the After finding the solution via other less obvious means... I found this succinct reference on StackOverflow: http://stackoverflow.com/questions/18995187/xcodebuild-corrupts-test-result-output-when-output-redirected-to-file |
I think the problem is the following line in the code:
This tells the Process to merge stderr and stdout, and this is the problem. Solving it with the script command is not the correct way I think. It would be better to set the redirectErrorStream to false and also process the error stream in
Fix the source, not the cause... ;) |
I'm not sure that would solve the problem since stdout would still not be flushed until the buffer is full, which is the real problem. If you could find a way to get stdout to auto flush, that would be the best solution. Sent from my iPad
|
Why is this the problem? The outputAppender only gets the string if the whole line was read. I also thought the problem is that stderr and stdout both write the output to the same stream. |
It's fine for them to be in the same stream, as long as they are in the correct order (i.e., the order xcodebuild is actually outputting them). The problem was that the standard error output was showing up "too early" because the standard output was buffering. |
In my opinion the steams should not be synced with a shell command, they should be synced by the by the plugin by using two streams, one for stderr and one for stdout. |
That will only work if the stdout stream has been flushed when stderr gets some input. I don't know that we can control that from the java side, can we? |
Okay, apparently I was mistaken. The |
Have you set
to
? |
Yes, and as I said, it isn't actually going to the error stream. I was getting other stuff in the error stream, but not the TEST SUCCEEDED message. Sent from my iPhone
|
Do I'm getting this right? I know that the BTW. I never had this issue and a I have lots of unit tests (over 1k) and I also cannot reproduce it. |
Regarding what is going on with the output: I don't really know where the messages are coming from. But it is I did go ahead and open a radar for Apple yesterday. Hopefully they'll respond soon and we'll at least have a better idea about why this is happening. As evidenced by the stack overflow article and issue #107, I am not the only one experiencing these issues. |
On another test related topic, currently the build is not aborting and failing if the unit tests fail to run. Would it be okay to throw a build exception if the unit tests fail to run at all? |
I have merged you code, but I do the 'script' command only when running the unit tests. I'm not happy with the script command, but it is fine for now until I find some time so do a better implementation. I have created a 0.9.14.b version for testing. It would be nice if I get feedback if it works as expected. I also have anonymized the test output.txt ;) |
Awesome, thanks! Sent from my iPhone
|
I tested version 0.9.14.b and it seems to be working; thanks! |
These changes improve the parsing of the test output and fixes issue #101
First, every command run through the command runner is now run via "script" which ensures that the stdout is line-buffered. This fixes issues I was having with stdout getting corrupted, sometimes resulting in partial lines.
Then I updated the test output parsing (of both XcodeTestTask and TestBuildOutputAppender) to look for the
** TEST SUCCEEDED **
or** TEST FAILED **
that is output via xcodebuild at the end of a test run. This is a much more reliable method for determining when each test destination run is complete.