1
votes

I have a bat file that is running my JUnit Cucumber tests. This bat file is being invoked by TeamCity. Once the JUnit Cucumber tests have been run, the output more or less ends with:

[15:24:37]18 Scenarios (18 passed)

[15:24:37]187 Steps (187 passed)

[15:24:37]0m24.339s

How can I save the line "18 Scenarios (18 passed)" to a variable in TeamCity, so that the next build step in TeamCity, which is an email test results component, can use this variable to send an email that contains the content of this variable? Otherwise the test results file that it attaches just has the details of each scenario without an overall summary being visible to the recipient.

1
Actually I just realised the first line of my test results xml file contains details of the overall test suite such as: <testsuite failures="0" name="cucumber.runtime.formatter.JUnitFormatter" skipped="0" tests="18" time="24.420714">Faheem Ebrahim
so, does it answers your question? Out of curiosity, why use *.bat to start JUnit tests? Why not a Gradle build file or, at least, Ant build.xml?Nikita Skvortsov
@FaheemEbrahim you have to start your tests with maven(gradle) runner. e.g. mvn test. Teamcity automatically parse your junit.xml results and can build Test tab with test counts, test names, etc. and if any tests will be failed then teamcity failed the build. or, you can just pass junit-results.xml for teamcitySenior Pomidor

1 Answers

0
votes

Нou have to start your tests with maven(gradle) runner. e.g. mvn test. TeamCity automatically parses your junit.xml results and can build Test tab with test counts, test names, etc. and if any tests will be failed then TeamCity failed the build. or, you can just pass junit-results.xml for TeamCity