Skip to content

Commit dc4a445

Browse files
Make testng verbosity configurable
TestNG apparently lacks the ideal console logging: only log test failures along with their stack traces. However, it does have a more verbose logging option that will log this information along with all tests run (verbose=2). This change uses default verbosity but allows us to override it for specific situations. We use higher verbosity when running CI on Travis.
1 parent cbe1b5f commit dc4a445

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: java
2+
script: ant -Dtestng.verbosity=2 test
23
jdk:
34
- oraclejdk7
45
- openjdk7

build.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
<!-- Enables/disables inclusion of debug symbols in .class files. -->
2828
<property name="debug" value="true" />
2929

30+
<!-- How verbose should testng be? A value of 2 or greater logs tests that
31+
are run and test failure stack traces to the console -->
32+
<property name="testng.verbosity" value="1"/>
33+
3034
<path id="build.classpath">
3135
<pathelement location="${src.build.dir}"/>
3236
<fileset dir="${lib.build.dir}/build" includes="*.jar"/>
@@ -130,7 +134,7 @@
130134
description="Runs the unit and integration tests. Set property no.test.tracevis to skip visualization tests."/>
131135

132136
<target name="test-unit" depends="build-test" description="Runs the unit tests.">
133-
<testng haltonfailure="true" outputDir="${test.result.dir}">
137+
<testng haltonfailure="true" outputDir="${test.result.dir}" verbose="${testng.verbosity}">
134138
<classfileset dir="${test.build.dir}" includes="**/Test*.class"/>
135139
<classpath refid="test.classpath"/>
136140
</testng>

0 commit comments

Comments
 (0)