Project
TeamCity
Priority
Major
Type
Feature
State
Open
Assignee
Kirill Maximov
Subsystem
Agent
Affected versions
Benares EAP (5813)
Fix versions
Medium Priority Pool
Fixed in build
No Fixed in build
  • Created by   Chris Morris
    4 years ago (12 Nov 2007 23:03)
  • Updated by   Yegor Yarko
    13 months ago (21 Dec 2010 13:11)
  • Jira: TW-3809
    (history, comments)
 
TW-3809 Detect errors reported by JUnit and fail the build with appropriate messages
1
Issue is visible to: All Users
  The issue is visible to the selected user group only
see attached screenshots - you can see TeamCity saying the build succeeded with build log output showing red colored lines and the Junit error messages
Comments (9)
 
History
 
Linked Issues (?)
 
Yegor Yarko
  Yegor Yarko
13 Nov 2007 13:45
4 years ago
Chris,
TeamCity sets the build status based on the build process exit code.
In this case it seems that the build script exited normally. Can you check this?

BTW, what runner do you use?
If Ant, junit task parameters need to be corrected, if Maven TW-3701 can be the case
Chris Morris
  Chris Morris
13 Nov 2007 18:59
4 years ago
"junit task parameters need to be corrected" - can you clarify what you mean? I'm not understanding you. Here's my junit ant task in the ant file:
		<junit 
			haltonerror="false" 
			printsummary="withOutAndErr" 
			haltonfailure="false" 
			fork="true"
			forkmode="once"
			clonevm="true" 
			timeout="600000"  
			>

I actually have two ant junit tasks - one that runs unit tests, one that runs integration tests, both have the same junit parameters as shown above. I have two builds in TeamCity, the main build is triggered by a commit and runs the full deployment tasks from the ant file then the junit task for the unit tests. The second build triggers on the success of the first build that only runs the junit task for integration tests (which does trigger compilation and dependency tests). The unit tests are running fine and TeamCity is capturing the output for them (even showing progress of number passing or failing, even before there's an exit code from the ant process), but the integration test build has the problems in the screenshots.

Why isn't TeamCity parsing the test output, regardless of the exit code? Oh - I guess that's not in the screenshot - but the status for the integration test build is "Success" and I have no Tests tab at all.
Yegor Yarko
  Yegor Yarko
14 Nov 2007 16:08
4 years ago
Chris,

In the build log you provided there is a ClassNotFound exception that means that no tests were actually run, so there is nothing to show on the Tests tab.

Why isn't TeamCity parsing the test output, regardless of the exit code?

TeamCity has the ability to fail the build if at least one test failed (this is configurable - see " Fail build if at least one test failed" option in the General settings of the build configuration) But in your case no tests were actually run: test case initialization failed before running any tests.

For now, your build script can be modified to fail the build if junit task results in error.
This can be done either by changing haltonerror="true" in the junit task (note that this way all other ant tasks will not be executed after error in junit), or by adding failureproperty="my_failure_property" to junit task and then failing the build in the end of the build script if the property was set.
e.g. ensuring Ant's "check_failures" target is called in the end of the build and defining the task:
    <target name="check_failures" if="my_failure_property">  <fail message="Failures found"/> </target>
Yegor Yarko
  Yegor Yarko
14 Nov 2007 16:14
4 years ago
Kir,

Can we try to detect errors reported by JUnit on test case loading and fail the build accordingly (if " Fail build if at least one test failed" is on)?
Chris Morris
  Chris Morris
14 Nov 2007 20:49
4 years ago
Ok, I understand what's going on. It's not the worst sort of bug, once I'm used to the output I should see. I know if it just says, "Success" without any test feedback, I know something is weird.

FWIW, I have noticed since I reported this that I did get "failing" notifications for these builds, just not "failed".

Ideally, I agree with Yegor's comment, but this is sort of a weird case, so I wouldn't be concerned if it wasn't fixed.
Yegor Yarko
  Yegor Yarko
04 Dec 2007 12:44
4 years ago
Related: there are also alike cases with .Net runners, so we should consider approaching the "class" of the problems.
Yegor Yarko
  Yegor Yarko
03 Mar 2008 01:37
3 years ago
<Comment was deleted>
Yegor Yarko
  Yegor Yarko
11 Apr 2008 21:20
3 years ago
Alike problem with TestNG: build (our integration build) is finished as "success" with no tests actually run/ The build log has:

[18:56:15]: [testng] [ERROR]: Cannot instantiate class jetbrains.buildServer.requirements.RequirementTypeTest
Yegor Yarko
  Yegor Yarko
11 Apr 2008 21:25
3 years ago
Seems,
TW-3917 (Fail build on specific messages appearing in the build log) can help here. Runners can provide the messages that should be considered as build failure identification.