# 3-Component Integration Build

The steps described below define how to report an integration build from 3 components: two backends (Java & .NET) and a front end (JavaScript).

The architecture diagram of the use case described in this tutorial:

<figure><img src="https://4057366433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAjqTCMRYvHhDgsdPLUnc%2Fuploads%2FtqSmVA9dMIZCW2ZI417H%2FScreenshot%202025-07-31%20at%2011.43.56.png?alt=media&#x26;token=621549f6-9f3b-43cb-8ed5-0310943bb842" alt=""><figcaption></figcaption></figure>

## Step 0 - Define a common LabID  <a href="#step-0-define-a-common-labid" id="step-0-define-a-common-labid"></a>

The Sealights' LabID is a string that identifies the testing environment. Normally, this string is generated in the dashboard under the Settings > Integration Build Labs:

<figure><img src="https://4057366433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAjqTCMRYvHhDgsdPLUnc%2Fuploads%2FEua1i65UOiMq9KRTe01D%2FScreenshot%202025-07-31%20at%2011.46.00.png?alt=media&#x26;token=145cd221-b5c6-4338-befc-dac2fccdc082" alt="" width="477"><figcaption></figcaption></figure>

In the current example (our tutorial), the **LabID used** will be **QA-ENV1**.

{% hint style="info" %}
Note: The ability to add the Integration Build Lab identifier will be available only after completing Step 2 in this walkthrough
{% endhint %}

## Step 1 - Build, Report & Deploy Components <a href="#step-1-build-report-and-deploy-the-components-one-by-one" id="step-1-build-report-and-deploy-the-components-one-by-one"></a>

### **Component-1 - Back end, Java (Tomcat)**

* Build and Report Component #1 to the Sealights dashboard

{% code overflow="wrap" lineNumbers="true" %}

```
java -jar sl-build-scanner.jar -config -appname Component-1 -branchname tutorial/master -buildname 1.0.0 -pi *com.example.*
java -jar sl-build-scanner.jar -scan -tokenfile .../sltoken.txt -buildsessionid=<Component-1 BSID> -workspacepath "..." -fi "*.class,*.jar" -r
```

{% endcode %}

* Deploy Component #1: In the JVM arguments, specify a Lab ID parameter (QA-ENV1).

{% code overflow="wrap" lineNumbers="true" %}

```
JAVA_OPTS=-javaagent:sl-test-listener.jar -Dsl.labId=QA-ENV1 -Dsl.buildSessionId=<Component-1 BSID> -Dsl.tokenFile=sltoken.txt
```

{% endcode %}

### **Component-2 - Back end, .NET (IIS)**

* Build and Report Component #2 to the Sealights dashboard:

{% code overflow="wrap" lineNumbers="true" %}

```
SL.DotNet.exe config --appName "Component-2" --branchName "tutorial/master" --buildName "1.2.0" --includeNamespace myNameSpace.* --buildSessionIdFile buildSessionId.txt
SL.DotNet.exe scan --buildSessionId=<Component-2 BSID> --workspacePath c:\path\to\binaries --ignoreGeneratedCode true
```

{% endcode %}

* Deploy Component #2: when starting the collector service session, specify the same Lab ID parameter as before:

{% code overflow="wrap" lineNumbers="true" %}

```
SL.DotNet.exe startCollectorServiceSession --buildSessionIdFile buildSessionId.txt --processName w3wp.exe --applicationPool DefaultAppPool --includeChildProcesses true --labId QA-ENV1
```

{% endcode %}

### **Component-3 - Front end, JavaScript**

* Build and Report Component #3 to the dashboard:

{% code overflow="wrap" lineNumbers="true" %}

```
./node_modules/.bin/slnodejs config --tokenfile ./sltoken.txt --appname "Component-3" --branch "tutorial/master" --build "1.0.0"
./node_modules/.bin/slnodejs scan --tokenfile ./sltoken.txt --buildsessionid <Component-3 BSID> --instrumentForBrowsers --workspacepath dist --outputpath sl_dist --scm git --labid QA-ENV1
```

{% endcode %}

* Deploy the instrumented version of your code onto the webserver.

{% hint style="info" %}
Unlike previous steps, with Front End JavaScript the Lab ID is generally defined within the build scan command.\
Please refer to [#deploying-instrumentation-for-several-environments-lab-ids](https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-agent/front-end-application/deploying-instrumented-code#deploying-instrumentation-for-several-environments-lab-ids "mention") for further details.
{% endhint %}

{% hint style="success" %}
All the 3 components are reported to Sealights dashboard and their active instance (application servers) share the same LabID.
{% endhint %}

## Step 2 - Create Integration Build & Report Its Components <a href="#step-2-create-the-integration-build-and-report-its-components" id="step-2-create-the-integration-build-and-report-its-components"></a>

Create an integration build using one of the following methods:

1. SeaLights agent command: [component-file](https://docs.sealights.io/knowledgebase/setup-and-configuration/build-and-test-execution/integration-build/integration-build-explicit-components-and-versions/component-file "mention")
2. REST API calls using Sealights APIs: [integration-builds](https://docs.sealights.io/knowledgebase/setup-and-configuration/integrations/rest-apis/integration-builds "mention")

In our case, we will provide the following JSON file content to the agent scan command (as a file named `sl-integration-components.json`)

{% code overflow="wrap" lineNumbers="true" %}

```json
[
	{
		"appName": "Component-1",
		"branch": "tutorial/master",
		"build": "1.0.0"
	},	
	{
		"appName": "Component-2",
		"branch": "tutorial/master",
		"build": "1.2.0"
	},
    {
		"appName": "Component-3",
		"branch": "tutorial/master",
		"build": "1.0.0"
	}
]
```

{% endcode %}

From the different options available, we’ll go with the Java agent to report this integration build

{% code overflow="wrap" lineNumbers="true" %}

```
java -jar sl-build-scanner.jar -config -tokenfile ./sltoken.txt -appname "MyIntegrationBuildApp" -branchname "master" -buildname "0.1.0" -pi "*integration.build*" -buildSessionIdFile integrationBSID.txt
java -jar sl-build-scanner.jar -scan -tokenfile sltoken.txt -buildsessionidfile integrationBSID.txt -componentfile sl-integration-components.json
```

{% endcode %}

{% hint style="success" %}
The integration Build builds now appears in your dashboard.
{% endhint %}

## Step 3 - Execute Tests Against Integration Build  <a href="#step-3-execute-tests-against-the-integration-build" id="step-3-execute-tests-against-the-integration-build"></a>

### Application Server Configuration Review <a href="#application-server-configuration-review" id="application-server-configuration-review"></a>

The build session ID used should correspond to the **component** (unique per component), whereas the lab ID should correspond to the **environment** (shared between components). For example:

<table><thead><tr><th width="322.94921875"></th><th>BuildSessionId</th><th>LabId</th></tr></thead><tbody><tr><td>Back end environment which contains Component #1</td><td>BSID-Component <strong>#1</strong></td><td><strong>QA-ENV1</strong></td></tr><tr><td>Back end environment which contains Component #2</td><td>BSID-Component <strong>#2</strong></td><td><strong>QA-ENV1</strong></td></tr><tr><td>Front end environment which contains Component #3</td><td>BSID-Component <strong>#3</strong></td><td><strong>QA-ENV1</strong></td></tr></tbody></table>

#### Test Runner Configuration Review <a href="#test-runner-configuration-review" id="test-runner-configuration-review"></a>

* The **build session ID used** for reporting test executions should correspond to the **integration build**, under which the information will be displayed.
* The **lab ID** should reflect the **same environment identifier** as the other components which make up the integration build to ensure all the coverage data will be linked together (In our example: **QA-ENV1)**.

&#x20;

* If running tests using the **Maven** **plugin**, make the following modifications to the .JSON configuration file before executing your tests with the SeaLights plugin enabled:

{% code overflow="wrap" lineNumbers="true" %}

```
{  
  ...
  "buildSessionId": "<Integration Build BSID>",
  "testStage": "E2E Tests",
  "labId": QA-ENV1,
  "executionType": "testsonly",
  ...
}
```

{% endcode %}

* If running tests using the **Gradle** **plugin**, make the following modifications to your build.gradle according to the following example:

{% code overflow="wrap" lineNumbers="true" %}

```
buildscript {
    ...
        allprojects { 
            sealights {
                ...
                buildSessionId = "<Integration Build BSID>"
                runTestOnly=true
                testTasksAndStages=["E2test":"E2E Tests"]
                labId="QA-ENV1"
                ...
            }
            ...
        }
...
}
```

{% endcode %}

* If running tests using **Java** **CLI commands**, use the following configuration in your start/end execution commands:

{% code overflow="wrap" lineNumbers="true" %}

```
java -jar sl-test-listener.jar start -tokenfile .../sltoken.txt -buildsessionid <Integration Build BSID> -testStage "E2E Tests" -labid QA-ENV1

<Tests are executed here>

java -jar sl-test-listener.jar end -tokenfile .../sltoken.txt -buildsessionid <Integration Build BSID> -labid QA-ENV1
```

{% endcode %}

***

{% hint style="success" %}
Once the above steps are completed, coverage is collected from the individual components, with the metrics displayed on the integration build level in the Sealights dashboard.
{% endhint %}
