Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

...

Before running the build scan and tests, you need to create a session ID. The session ID is provided to each step in order to link them together as one complete cycle.

Generating a session ID in Java is done using the Java Build scanner with the -config flag. This command can be executed as an ANT Java task.

In the following sample, we have used a timestamp for the build name but any environment variable can be used according to your organization’s naming convention.

...

Code Block
languagexml
<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

Sample integration into an existing ANT project

...

Code Block
languagexml
<project name="sl-ant-sample" xmlns:if="ant:if">

    <target name="compile">
		<echo>Compiling the JAR</echo>
		<antcall if:true="${sealights}" target="sealights_scan" />
    </target>

	<target name="sealights_config">
		<echo>Sealights -- Create BSID</echo>
	</target>

	<target name="sealights_scan" depends="sealights_config">
		<echo>Sealights -- Scan artefacts</echo>
	</target>

	<target name="junit">
		<echo if:true="${sealights}">Sealights<>Sealights -- Add JVM arg</echo>
		<echo>Regular</echo>
  	</target>

</project>

...