Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Scanning a build

...

Scanning a build in ANT is achieved using the Java Build scanner executed as an ANT Java task

Code Block
languagebash
themeEclipse
titleSample command
xml
<target name="sealights_scan" depends="compile">
    <java jar="${sealights.dir}/sl-build-scanner.jar" fork="true">
		<arg value="-scan"/>
		<arg value="-tokenfile"/>
		<arg value="/path/to/sltoken.txt"/>
		<arg value="-buildsessionidfile"/>
		<arg value="buildSessionId.txt"/>
		<arg value="-workspacepath"/>
		<arg value="${build}"/>
		<arg value="-r"/>
		<arg value="-fi"/>
		<arg value="*.class"/>
		<arg value="-moduleName"/>
		<arg value="${package}"/>
	</java>
</target>

In order to add logs flags, you need to add the <jvmarg> values like below

<jvmarg value="-Dsl.log.toConsole=true"/>
<jvmarg value="-Dsl.log.level=info"/>

Info

See 'Java Command Reference - Scanning a build' for full parameter details

Running tests using JUnit

In order to capture code coverage information from tests run with JUnit, you need to run it with our test listener as a Java agent:

  • The listener needs to be passed using the jvmarg attribute -javaagent parameter together with its required parameters

Code Block
languagebash
themeEclipse
titleSample commandxml
<junit fork="yes">
  <jvmarg value="-javaagent:${sealights.dir}/sl-test-listener.jar"/>
  <jvmarg value="-Dsl.tokenFile=/path/to/sltoken.txt"/>
  <jvmarg value="-Dsl.buildSessionIdFile=buildSessionId.txt"/>
  <jvmarg value='-Dsl.testStage="Unit Tests"'/>
</junit>
Info

See 'Java Command Reference - Installing test listener as Java Agent' for full parameter details