Improve Test Optimization With Context Propagation

SeaLights is using Open Telemetry to propagate the context of your tests, this allow to enrich the test optimization statistical model to an almost 1:1 relationship between a test and the code of the application it is testing.

There are 2 main ways to propagate the context of a test:

  1. The utilization of a baggage

  2. The utilization of a cookie

In order to set this up, these are the necessary steps you need to take:

  1. Set up the testing framework to set either the baggage or the cookie with the test information, including:

    1. Test name

    2. Test session ID

  2. Set up the front-end agent with the flag to enable Open Telemetry usage

  3. Set up the backend agent with the flags to enable Open Telemetry usage

Set Context Propagation on the Node Agent

In order to enable context propagation on the Node Agent, you will need to set the --enableOpenTelemetry flag when applying the scan command, for example:

npx slnodejs scan --workspacepath ./MyApp --tokenfile sltoken.txt --buildsessionidfile buildSessionId --scm none --instrumentForBrowsers --enableOpenTelemetry --outputpath "sl_dist"

Set Context Propagation on the Java Agent

In order to enable context propagation on the Java Agent, you will need to set the following flags when starting the test listener:

  • sl.otelEnabled=true

  • sl.otelConfiguration.enabled=true

  • sl.otelConfiguration.loadEmbeddedAgent=true

  • sl.featuresData.codeCoverageManagerVersion=v3

For example:

-javaagent:/path/to/sl-test-listener.jar -Dsl.tags=backend -Dsl.labId=<lab ID> -Dsl.otelEnabled=true -Dsl.otelConfiguration.enabled=true -Dsl.otelConfiguration.loadEmbeddedAgent=true -Dsl.featuresData.codeCoverageManagerVersion=v3

Testing Frameworks

Setting Context Propagation with PlayWright

In order to set the context with the baggage, please follow this guide.

Setting Context Propagation With Cypress

In order to set the context with the baggage, please follow this guide.

Setting Context Propagation With Gauge

In order to set the context with the baggage, please follow this guide.

Last updated

Was this helpful?