protected void failed(Throwable e, Description description) {
// Notify Teamcity of failed test
- System.out.print("##teamcity[publishArtifacts '");
- System.out.println(getScreenshotErrorBaseName()
- + "* => screenshot-errors']");
+ if (!System.getProperty("teamcity.version", "").equals("")) {
+ System.out.print("##teamcity[publishArtifacts '");
+ System.out.println(getScreenshotErrorBaseName()
+ + "* => screenshot-errors']");
+ }
}
};
<target name="run-tb3-suite">
<fail unless="junit.test.suite" message="Define suite to run using junit.test.suite" />
<fail unless="com.vaadin.testbench.screenshot.directory" message="Define screenshot directory using -Dcom.vaadin.testbench.screenshot.directory" />
+
+ <!-- Ensure teamcity.version is set to something -->
+ <condition property="teamcity.version" value="">
+ <not>
+ <isset property="teamcity.version" />
+ </not>
+ </condition>
+
<junit printsummary="withOutAndErr" fork="yes">
<formatter usefile="false" type="plain" />
<classpath refid="classpath.tb3" />
<jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
<jvmarg value="-Djava.awt.headless=true" />
+ <jvmarg value="-Dteamcity.version=${teamcity.version}" />
<test name="${junit.test.suite}" />
</junit>
</batchtest>
</junit>
- <!-- Have teamcity publish each test error artifact immediatly if there are any -->
- <basename property="basename" file="${target}" suffix="java" />
- <echo>##teamcity[publishArtifacts '${com.vaadin.testbench.screenshot.directory}/errors/${basename}* => screenshot-errors']</echo>
+ <antcall target="notify-teamcity-of-build-artifact">
+ <param name="file" value="${target}" />
+ </antcall>
</target>
+ <!-- Have teamcity publish each test error artifact immediatly if there are any -->
+ <target name="notify-teamcity-of-build-artifact" if="teamcity.version">
+ <basename property="basename" file="${file}" suffix="java" />
+ <echo>##teamcity[publishArtifacts '${com.vaadin.testbench.screenshot.directory}/errors/${basename}* => screenshot-errors']</echo>
+ </target>
+
<!-- Remove temporary source and compiled java files -->
<target name="remove-temp-testclasses">
<delete failonerror="false">