Phase 1: Core Coverage

Overview

In this phase, you'll integrate the SeaLights Java CD Agent with your application to start collecting coverage data. This is the foundation for all subsequent phases and provides immediate visibility into your application's test coverage.

By the end of Phase 1, you'll have real-time coverage data flowing from your application component to the SeaLights Dashboard.

What You'll Get

  • Real-time visibility into application component coverage — See which parts of your code are being exercised during testing

  • Quick assessment of testing completeness — Understand gaps in your test coverage at a glance

  • Improved release confidence — Make data-driven decisions about release readiness

Implementation Steps

1

Step 1: Download the SeaLights Java CD Agent

Download the latest version of the SeaLights Java CD-Only Agent to the machine where your component is deployed and make it available for that component. The agent is downloadable from the following URL: https://agents.sealights.co/sl-cd-agent/sl-cd-agent-latest.ziparrow-up-right

Example CLI commands for downloading the SeaLights Java Agent:

# Download the latest Java agent
wget -nv  https://agents.sealights.co/sl-cd-agent/sl-cd-agent-latest.zip

# Extract the agent
unzip -oq sl-cd-agent-latest.zip

#validate the agent version
echo "Sealights CD Agent version used is:" `cat version.txt`

2

Step 2: Run Your Component with the SeaLights Java CD Agent

Attach the SeaLights Java CD agent as a -javaagent to your Java component. This enables SeaLights to capture coverage data whenever a method is executed within your component.

You can add the agent in one of the following ways:

  1. Inline — Add the -javaagent and parameters directly to the java -jar command used to run your component

  2. Environment variable — Set the parameters via JAVA_TOOL_OPTIONS or a similar JVM variable

Example 1: Adding the SeaLights Agent and parameters to your java command inline

java -javaagent:/path/to/sl-cd-agent.jar \
  -Dsl.tokenFile=/path/to/agent/tokenfile \
  -Dsl.appname=<component-name> \
  -Dsl.buildname=<component-build-number> \
  -Dsl.labid=<test-env-id> \
  -Dsl.includes=<included-packages> \
  -jar my_component.jar

Minimum Required Parameters

  • sl.tokenFile - Path to the agent token file. Note: The token can also be placed in a file named sltoken in the same directory as the agent. In that case, this parameter is not required.

  • sl.appName - The name of your application component. This name will appear in the SeaLights dashboard and reports. This can be any name that represents your component.

  • sl.buildname - A unique identifier that represents the current build of your application component — for example, the CI build number, a timestamp, or a custom name (as long as it is unique).

  • sl.labid - A unique name representing the environment where the application component is deployed — for example, a machine IP or a label like E2E-test-env-5. Make sure the name is unique for each test environment.

  • sl.includes - Specifies which Java packages SeaLights should monitor for coverage. By default, SeaLights may analyze all packages, but explicitly setting this improves performance. Accepts a comma-separated list of search patterns with wildcards (* = any string, ? = any character)

Additional optional parameters may be found here: CD Only Agent Configuration Parameters

What Happens When Your Application Component Starts?

After your application component starts, SeaLights begins scanning it to analyze its method structure. This process may take a few minutes.

During this time:

  • The component—along with its specified build number—will appear immediately in the SeaLights dashboard, indicating a successful connection between the agent and SeaLights.

  • The console will display messages confirming the successful startup of the SeaLights agent and later the completion of the scan.

If an error occurs, a detailed message will appear in the console with suggested troubleshooting steps.

Verification

To confirm Phase 1 was successful:

  1. Check the console output — Look for messages confirming successful agent startup and scan completion.

  2. Visit the SeaLights Dashboard — Verify that:

    • Your application component appears in the dashboard

    • The build number you specified is visible

    • Coverage data begins appearing after you run tests against your application

circle-check
circle-info

Repeat the Phase 1 steps above for each Java component in your application. Doing so will allow SeaLights to capture coverage across a multi-service application!


Next Steps

With core coverage in place, you're ready to move on to Phase 2: Advanced Coverage Analytics. In Phase 2, you'll gain granular coverage insights by test stage (Integration, Regression, E2E), enabling you to optimize your testing strategy and make more informed release decisions.

Last updated

Was this helpful?