Configuration Reference
Complete reference guide for configuring Xping SDK. This document covers all available configuration options, their purposes, valid values, and best practices.
Configuration Methods
How you initialize decides which sources are read. There are two paths, and only one of them loads files.
XpingContext.Initialize() — no argument. Configuration is discovered:
XPING_*environment variables - e.g.XPING_APIKEY,XPING_BATCHSIZEXping__*environment variables - the standard .NET nested format, e.g.Xping__ApiKeyappsettings.{Environment}.json- loaded after the base file, so it overrides itappsettings.json- Default values
XpingContext.Initialize(config) — you supply the object. No files are read, and the nested
Xping__* format does not apply, because there is no IConfiguration in this path at all:
XPING_*environment variables- The
XpingConfigurationyou passed - Default values
The XPING_* variables sit at the top of both, which is the point: a pipeline can inject a
secret or redirect an endpoint without the test assembly being rebuilt, and a value hardcoded in
Initialize(config) does not shield the run from it. Your instance is not modified — the override
is applied to the copy the SDK resolves.
Once a process has called Initialize(config), a later Initialize() in the same process reuses that
configuration instead of discovering one. This matters in a long-lived process, such as an IDE's test
server, that runs several sessions. Only a configuration a session actually started with is reused, and
XpingContext.ShutdownAsync() forgets it.
If you configure in code and want appsettings.json or Xping__* honoured as well, build an
IConfiguration yourself and call services.AddXping(configuration).
Quick Reference Table
| Setting | Type | Default | Environment Variable | Description |
|---|---|---|---|---|
ApiEndpoint |
string | https://upload.xping.io/v1 |
XPING_APIENDPOINT |
Xping API base URL |
ApiKey |
string | (none) | XPING_APIKEY |
Authentication API key. Required in Cloud mode; omit it to run local-only. The CLI uses it for Cloud reads when no stored login is available. --api-key on the command line takes precedence over a stored login; the environment variable does not. |
ProjectId |
string | (none) | XPING_PROJECTID |
Optional. Pins the whole session to one project; omit it to get one project per test assembly. The CLI uses it to bind local runs to a Cloud project. |
Mode |
XpingMode | Auto |
XPING_MODE |
Auto, LocalOnly, Cloud, or Disabled |
BatchSize |
int | 100 |
XPING_BATCHSIZE |
Tests per upload batch |
FlushInterval |
TimeSpan | 30s |
XPING_FLUSHINTERVAL |
Auto-flush interval |
Environment |
string | Default |
XPING_ENVIRONMENT |
The deployed environment the tests target |
Enabled |
bool | true |
XPING_ENABLED |
SDK enabled/disabled |
CaptureStackTraces |
bool | true |
XPING_CAPTURESTACKTRACES |
Include stack traces |
EnableCompression |
bool | true |
XPING_ENABLECOMPRESSION |
Compress uploads |
MaxRetries |
int | 3 |
XPING_MAXRETRIES |
Upload retry attempts |
RetryDelay |
TimeSpan | 2s |
XPING_RETRYDELAY |
Delay between retries |
UploadTimeout |
TimeSpan | 30s |
XPING_UPLOADTIMEOUT |
Timeout per upload attempt |
EnablePullRequestDetection |
bool | true |
XPING_ENABLEPULLREQUESTDETECTION |
Detect PR context for CI/CD comment posting |
CollectLocalGitAuthor |
bool | false |
XPING_COLLECTLOCALGITAUTHOR |
Include git author name in local-run metadata (opt-in to avoid PII collection) |
CollectCiActorEmail |
bool | true |
XPING_COLLECTCIACTOREMAIL |
Record the CI actor's email address as CI.ActorEmail |
DefaultBranch |
string | (none) | XPING_DEFAULTBRANCH |
The branch Xping Cloud treats as the default branch for this pipeline's CI runs. Replaces the value the platform reports |
StrictMode |
bool | false |
XPING_STRICTMODE |
Throw on configuration errors instead of silently disabling |
LocalStorePath |
string | repository root | XPING_LOCAL_STORE |
Overrides the local store location |
CloudUrl |
string | https://app.xping.io |
XPING_CLOUDURL |
CLI only. Xping Cloud (Portal) URL used by xping login and Cloud-enriched reports |
| (banner) | string | (unset) | XPING_NO_BANNER |
Suppresses the SDK's retry hint and the CLI's invitation. The invitation is written to stderr, so it never reaches a redirected report |
Operating Mode
Xping runs in one of three modes. The mode is resolved once at startup and determines whether the SDK uploads, stores locally, or does nothing.
Mode
Type: XpingMode
Default: Auto
Environment Variable: XPING_MODE
| Value | Behaviour |
|---|---|
Auto |
Resolves to Cloud when credentials are present, otherwise LocalOnly. |
LocalOnly |
Collects and writes the local store. No network calls at all. |
Cloud |
Collects, uploads, and writes the local store. |
Disabled |
Collects nothing. Equivalent to Enabled = false. |
How Auto resolves
| Condition | Resolved mode |
|---|---|
Enabled = false |
Disabled |
StrictMode = true |
Cloud |
ApiKey present |
Cloud |
| Otherwise | LocalOnly |
Strict mode still requires credentials
StrictMode exists to guarantee observability in CI, so it forces Cloud. A missing API key under strict mode remains a hard configuration error and will not silently degrade to local-only collection.
This is the intended split: local-only is the default for an unconfigured developer, never a silent downgrade for a configured pipeline.
# CI: fail the build if observability is misconfigured
export XPING_STRICTMODE=true
export XPING_APIKEY="..."
export XPING_PROJECTID="..."
Local-only makes no network calls
In LocalOnly mode the SDK does not create an HTTP client, retry pipeline, or circuit breaker. Nothing in the local path opens a socket.
Staying local with credentials present
Setting Mode explicitly overrides credential detection:
export XPING_MODE=LocalOnly
Useful when a key is present in your environment for other reasons but you want a particular run kept off the platform.
Core Settings
ApiEndpoint
Type: string
Default: https://upload.xping.io/v1
Required: No (uses default if not specified)
Environment Variable: XPING_APIENDPOINT
The base URL for the Xping API. Change this only if you're using a self-hosted or regional instance.
Valid values:
- Must be a valid HTTP or HTTPS URL
- Must not include trailing slash
Example:
{
"Xping": {
"ApiEndpoint": "https://upload.xping.io/v1"
}
}
export XPING_APIENDPOINT="https://upload.xping.io/v1"
var config = new XpingConfiguration
{
ApiEndpoint = "https://upload.xping.io/v1"
};
XpingContext.Initialize(config);
ApiKey
Type: string
Default: None
Required: In Cloud mode only
Environment Variable: XPING_APIKEY
Your Xping authentication API key. This credential identifies your account and authorizes SDK operations.
Omitting it is a supported configuration: the SDK resolves to LocalOnly and records test history to disk instead of uploading. See Running Without an Account.
Getting your API key:
- Log in to Xping Cloud
- Navigate to Account → Settings → API & Integration
- Click Create API Key and copy it
Security considerations:
- Never commit API keys to source control
- Use environment variables or secret management in CI/CD
- Rotate keys regularly as a security best practice
- Each team member can use their own key for attribution
Example:
{
"Xping": {
"ApiKey": "xpg_live_productionkey"
}
}
# Recommended: Use environment variables
export XPING_APIKEY="xpg_live_productionkey"
In the xping CLI: the CLI uses the key to read Cloud data when no stored login (xping login) is available. --api-key on the command line takes precedence over a stored login; the environment variable and appsettings.json do not, because on a developer machine they usually hold the SDK's upload key. Prefer XPING_APIKEY to --api-key, so the key does not land in shell history.
// Not recommended: Hard-coding in source
var config = new XpingConfiguration
{
ApiKey = "xpg_live_productionkey"
};
XpingContext.Initialize(config);
ProjectId
Type: string
Default: None — the project is derived from the test assembly
Required: No
Environment Variable: XPING_PROJECTID
You usually do not need to set this. When ProjectId is unset, Xping derives the project from the test assembly each execution belongs to. A test project called PaymentService.Tests reports into a project of that name, created automatically the first time your tests run.
That means a solution-wide dotnet test produces one project per test project:
| Test assembly | Project |
|---|---|
Billing.Tests |
billing-tests |
Api.Tests |
api-tests |
Web.Tests |
web-tests |
This mirrors how the xping CLI already scopes local reports — xping report --assembly Billing.Tests — so local and cloud views agree on what a project is.
Set ProjectId only to override that. It is a hard pin: every execution in the session lands in that one project regardless of which assembly it came from. The case for it is a monorepo where several test assemblies should report as a single project:
{
"Xping": {
"ProjectId": "payment-service"
}
}
Validation Rules (applied by the platform to a pinned value):
- Character Set: ASCII alphanumeric characters, hyphens (
-), and underscores (_) only - Format: Must start with an alphanumeric character (a-z, 0-9), followed by any combination of alphanumeric, hyphens, or underscores
- Whitespace: No spaces or whitespace characters allowed (including internal whitespace)
- Maximum Length: 128 characters
- Normalization: Automatically converted to lowercase, so
"my-app"and"My-App"are the same project - A blank value (
"") is treated as unset, not as a pin
Important: A project is identified by its name, and there is no automated migration between projects. Renaming a test assembly therefore starts a new project and leaves the old history behind — as does changing a pinned
ProjectId. Pin a value if you expect to rename the assembly.
Note: Because a solution-wide run can create several projects at once, a first run on a plan with a low project limit may hit that limit. Pin a
ProjectIdto report into a single project instead.
Example:
{
"Xping": {
"ProjectId": "payment-service"
}
}
export XPING_PROJECTID="payment-service"
var config = new XpingConfiguration
{
ProjectId = "payment-service"
};
XpingContext.Initialize(config);
In the xping CLI: the CLI uses the same value to bind local runs to a Cloud project when it adds Cloud data to xping report.
Project organization strategies:
- Monorepo: Use separate project IDs per component (
"web-api","web-ui","worker") - Multi-repo: Use repository name or service name
- Environment separation: Include environment suffix (
"myapp-prod","myapp-staging")
Batching & Upload Settings
BatchSize
Type: int
Default: 100
Valid Range: 1 to 1000
Environment Variable: XPING_BATCHSIZE
Number of test executions to accumulate before automatically uploading to Xping.
Upload triggers:
- When
BatchSizetest executions are collected (e.g., 100 tests) - When
FlushIntervaltimer fires (e.g., every 30 seconds) - When test session completes (via
FinalizeAndShutdownAsync(); automatic under xUnit)
This means even small test suites (e.g., 10 tests) will upload immediately when the test session ends, regardless of batch size.
Performance considerations:
- Small batches (10-50): Faster mid-run visibility, more API calls, higher overhead
- Medium batches (100-200): Balanced for most scenarios (recommended)
- Large batches (500-1000): Fewer API calls during execution, higher memory usage
When to adjust:
- Increase for large test suites (1000+ tests) to reduce API call frequency during test execution
- Decrease for real-time monitoring during development (see results before suite completes)
Example:
{
"Xping": {
"BatchSize": 200
}
}
export XPING_BATCHSIZE="200"
FlushInterval
Type: TimeSpan
Default: 00:00:30 (30 seconds)
Valid Range: Must be greater than zero
Environment Variable: XPING_FLUSHINTERVAL
Maximum time to wait before uploading accumulated test executions, even if BatchSize hasn't been reached. This is a timer-based flush that runs periodically during test execution.
Important: At the end of your test session, FinalizeAndShutdownAsync() will upload any remaining tests immediately, regardless of this interval.
Format:
- JSON:
"HH:MM:SS"format (e.g.,"00:01:00"for 1 minute) - Environment variable: Seconds as integer (e.g.,
"60") or TimeSpan string - Programmatic:
TimeSpanobject
Usage scenarios:
- Short intervals (5-15s): See results quickly during development (uploads every 5-15s)
- Medium intervals (30-60s): Standard CI/CD pipelines (balanced)
- Long intervals (2-5m): Large batch jobs where you only need final results
Example:
{
"Xping": {
"FlushInterval": "00:01:00"
}
}
# As seconds
export XPING_FLUSHINTERVAL="60"
# As TimeSpan
export XPING_FLUSHINTERVAL="00:01:00"
var config = new XpingConfiguration
{
FlushInterval = TimeSpan.FromMinutes(1)
};
XpingContext.Initialize(config);
UploadTimeout
Type: TimeSpan
Default: 00:00:30 (30 seconds)
Valid Range: 00:00:01 (1 second) to 1.00:00:00 (1 day)
Environment Variable: XPING_UPLOADTIMEOUT
Timeout for a single upload attempt. An attempt that doesn't complete within this time is retried according to MaxRetries and RetryDelay. The whole upload, retries included, gives up after 2 × UploadTimeout (60 seconds by default), so a failing upload can't hold up the end of a test run. Each retry is cut short if that cap is reached first, and later retries are skipped.
When to adjust:
- Increase for slow network connections or large batches
- Decrease for fast failure detection in reliable networks
Example:
{
"Xping": {
"UploadTimeout": "00:01:00"
}
}
export XPING_UPLOADTIMEOUT="60"
Reliability & Retry Settings
MaxRetries
Type: int
Default: 3
Valid Range: 0 to 10
Environment Variable: XPING_MAXRETRIES
Maximum number of retry attempts for failed upload operations. Retries use exponential backoff based on RetryDelay.
Retry behavior:
- 0 retries: Fail immediately on first error
- 1-3 retries: Standard resilience (recommended)
- 4-10 retries: High resilience for unreliable networks
Retried errors:
- Network timeouts
- HTTP 5xx errors (server errors)
- HTTP 429 (rate limiting)
- Transient network failures
Not retried:
- HTTP 4xx errors (except 429) - indicates client error
- Authentication failures (401, 403)
- Validation errors (400)
Example:
{
"Xping": {
"MaxRetries": 5
}
}
export XPING_MAXRETRIES="5"
RetryDelay
Type: TimeSpan
Default: 00:00:02 (2 seconds)
Valid Range: 00:00:00 to 1.00:00:00 (1 day)
Environment Variable: XPING_RETRYDELAY
Base delay for exponential backoff between retry attempts. The delay roughly doubles with each retry, and jitter randomizes every delay so parallel runs don't retry in lockstep. Don't rely on exact retry times.
With RetryDelay = 2s and MaxRetries = 3, the retries come after delays of roughly 2s, 4s and 8s.
Each attempt is capped at UploadTimeout, and the whole upload, retries and delays included, at 2 × UploadTimeout. Retries still due after that cap are skipped, so a long RetryDelay can leave fewer retries than MaxRetries.
Example:
{
"Xping": {
"RetryDelay": "00:00:05"
}
}
export XPING_RETRYDELAY="5"
Environment Settings
Environment
Type: string
Default: "Default"
Environment Variable: XPING_ENVIRONMENT
The deployed environment your tests targeted - Staging, Production, QA. Confidence
scores are computed per (test, environment), so this is the axis along which Xping Cloud compares
a test's behaviour between deployments.
It is not a label for where the suite ran. A developer's laptop run and the CI run of the same suite belong to the same environment, because they are the same environment; what differs is how far the revision under test can be trusted, and Xping Cloud records that separately from the commit SHA and pull-request flag. Recording them as two environments would halve the evidence on both sides and produce a "gap between environments" finding that is really the gap between a laptop and a build agent.
Resolution:
- The
Environmentsetting - fromXPING_ENVIRONMENT,appsettings.json, or code "Default"when nothing was set
Two rungs, and nothing is inferred from the host. Every distinct environment name in your data traces to a decision somebody made.
Common values:
"Default"- nothing configured; you have one environment and nothing to compare"Staging"- the staging deployment"Production"- the production deployment"QA"- the QA deployment
Example:
{
"Xping": {
"Environment": "Staging"
}
}
export XPING_ENVIRONMENT="Staging"
Set one name per deployment, not per run
Avoid names that vary run to run - one per pull request, per branch, or per build agent. Each new name permanently splits that test's scored history, and the distinction you are reaching for is already recorded. A handful of stable names is the goal; most projects need none at all.
ASPNETCORE_ENVIRONMENT and DOTNET_ENVIRONMENT are not read
These answer a different question: how the app under test should configure itself, not which
deployment your suite pointed at. They also fire by accident. A CI job running inside a container
whose base image carries ENV ASPNETCORE_ENVIRONMENT=Production would stamp every pipeline run
"Production" while developer runs said otherwise - a CI-vs-local split wearing a
Development-vs-Production costume, and a convincing one, because the resulting "Production gap"
looks like a real finding.
If you do want that value, pass it through explicitly. Do it in the shell, so the variable is read from the process the tests actually run in:
- name: Run tests
run: XPING_ENVIRONMENT="$ASPNETCORE_ENVIRONMENT" dotnet test
Note that ${{ env.ASPNETCORE_ENVIRONMENT }} will not work here. GitHub Actions' env context
only exposes variables declared in a workflow, job or step env: block; it cannot see one set by
the runner image, a container ENV, or an earlier step's export - which is exactly the case worth
passing through. The expression would silently expand to nothing.
One line, explicit, and it cannot fire by accident.
CI detection still happens
Dropping the CI-vs-local distinction from Environment does not stop Xping detecting CI. Every run
still records IsCIEnvironment, an ExecutionContext custom property ("CI" or "Local"), the
detected platform, and its build metadata - branch, commit SHA, run ID, actor. Those are
diagnostics attached to the run rather than a second scoring axis.
DefaultBranch
Type: string
Default: (none)
Environment Variable: XPING_DEFAULTBRANCH
The branch Xping Cloud treats as the repository's default branch for this pipeline's runs. Xping Cloud counts a CI push to the default branch as a Canonical run, which carries full weight in confidence scoring; a push to any other branch counts for less.
The SDK reads the default branch from the platform on GitHub Actions and GitLab CI. Other platforms
don't report one, so Xping Cloud uses the project's default branch setting, then main or
master. Set DefaultBranch when that guess is wrong and you'd rather configure it in the
pipeline - a repository whose default branch is develop or trunk on Azure DevOps or Jenkins, for
example - or when a pipeline should treat another branch as its baseline.
The default branch of a run is resolved in this order:
DefaultBranch/XPING_DEFAULTBRANCH- The value the CI platform reports (GitHub Actions, GitLab CI)
- The project's default branch setting in Xping Cloud
mainormaster
Notes:
- It is sent only from CI. Local runs are never Canonical, so it has no use there.
- It is reduced to a bare branch name, as the branch of the run is: a leading
refs/heads/,refs/remotes/origin/ororigin/is removed, so Jenkins'GIT_BRANCH(origin/main) can be passed through as is. Branch names are compared case-sensitively. - It changes nothing on TeamCity: the SDK reports no branch there, so Xping Cloud can't place the run.
- It applies to new runs only. Runs already recorded keep their classification.
Use with care. On GitHub Actions and GitLab CI it replaces a value read from the platform itself.
A stale setting - a repository renamed master to main, or a value copied into a shared pipeline
template - silently stops every Canonical run. When the setting differs from what the platform
reports, the SDK logs a warning naming both values, so check the build log. Two pipelines of one
project with different values both produce Canonical runs, so the confidence evidence mixes both
branches at full weight. The setting also beats the project setting in Xping Cloud, so it can't be
overridden from there.
Examples:
export XPING_DEFAULTBRANCH="develop"
{
"Xping": {
"DefaultBranch": "develop"
}
}
Feature Flags
Enabled
Type: bool
Default: true
Environment Variable: XPING_ENABLED
Master switch to enable or disable the entire SDK. When disabled, Xping operates as a no-op—tests run normally but no tracking occurs.
Use cases:
- Temporarily disable tracking without removing SDK code
- Feature flags for gradual rollout
- Debugging test failures potentially caused by SDK
- Conditional enabling based on environment or configuration
Example:
{
"Xping": {
"Enabled": false
}
}
export XPING_ENABLED="false"
// Conditional configuration based on environment
var config = new XpingConfiguration
{
// Disable in development, enable in CI
Enabled = Environment.GetEnvironmentVariable("CI") != null
};
XpingContext.Initialize(config);
CaptureStackTraces
Type: bool
Default: true
Environment Variable: XPING_CAPTURESTACKTRACES
Include full stack traces for failed tests in uploaded data. Stack traces help diagnose test failures but increase payload size.
Trade-offs:
- Enabled: Better debugging, larger payloads, slightly higher overhead
- Disabled: Smaller payloads, faster uploads, less diagnostic info
When to disable:
- Very large test suites with frequent failures
- Network bandwidth concerns
- Privacy/security requirements (stack traces may contain sensitive paths)
When
CaptureStackTracesis set tofalse, the uploaded payload for failed tests will includestackTraceOmitted: true. This allows Xping Cloud to distinguish between a test that had no stack trace and one where the user explicitly disabled stack trace collection.
Example:
{
"Xping": {
"CaptureStackTraces": false
}
}
export XPING_CAPTURESTACKTRACES="false"
EnableCompression
Type: bool
Default: true
Environment Variable: XPING_ENABLECOMPRESSION
Compress upload payloads using gzip compression. Significantly reduces bandwidth usage with minimal CPU overhead.
Typical compression ratios:
- JSON test data: 60-80% size reduction
- With stack traces: 70-85% size reduction
When to disable:
- Debugging network issues (inspect uncompressed payloads)
- Very constrained CPU environments (rare)
- Proxy/firewall issues with compressed content
Example:
{
"Xping": {
"EnableCompression": false
}
}
export XPING_ENABLECOMPRESSION="false"
EnablePullRequestDetection
Type: bool
Default: true
Environment Variable: XPING_ENABLEPULLREQUESTDETECTION
Detect pull request context from CI/CD environment variables and include it in session uploads. When enabled, Xping reads PR metadata (PR number, branch, platform) from the CI environment to enable automatic PR comment posting with test results.
Supported platforms:
- GitHub Actions on github.com, GHE.com and GitHub Enterprise Server (via
GITHUB_EVENT_NAME,GITHUB_REF, etc.; the server comes fromGITHUB_SERVER_URL). The commit is the PR head, read frompull_request.head.shain the event payload atGITHUB_EVENT_PATH. - GitLab CI merge request pipelines on gitlab.com and self-managed instances (
CI_MERGE_REQUEST_IIDset; the server comes fromCI_SERVER_URL). The commit isCI_MERGE_REQUEST_SOURCE_BRANCH_SHAin merged-results pipelines, otherwiseCI_COMMIT_SHA. - Azure Pipelines PR builds (
BUILD_REASON=PullRequest) for Azure Repos (Azure DevOps Services or Server, fromSYSTEM_COLLECTIONURI) and GitHub repositories (github.com, GHE.com or GitHub Enterprise Server, fromBUILD_REPOSITORY_URI). The commit isSYSTEM_PULLREQUEST_SOURCECOMMITID. - Jenkins multibranch (Branch Source) PR builds (
CHANGE_IDset) for GitHub, GitLab and Azure DevOps repositories on any server, identified fromCHANGE_URL. The commit is the PR head, read fromrefs/remotes/origin/$BRANCH_NAMEin the workspace's.gitdirectory and used only when it isGIT_COMMITor its first parent, so both the merge and head strategies are supported. GHPRB jobs aren't supported.
Every PR context records the server it came from (https://github.com, https://ghes.example.com, …), so the same owner/name on two servers stays two repositories. Xping Cloud posts PR comments only for github.com repositories; on other servers the PR context still drives PR insights and links.
When to disable:
- You don't use PR comment posting and want to skip the detection overhead
- You're running in a non-PR build and want to suppress any PR context association
Example:
{
"Xping": {
"EnablePullRequestDetection": false
}
}
export XPING_ENABLEPULLREQUESTDETECTION="false"
var config = new XpingConfigurationBuilder()
.WithPullRequestDetection(false)
.Build();
XpingContext.Initialize(config);
CollectLocalGitAuthor
Type: bool
Default: false
Environment Variable: XPING_COLLECTLOCALGITAUTHOR
When running on a developer machine (not a CI environment) inside a git repository, controls whether the SDK reads the author name from .git/config [user] name and includes it as the Git.Actor custom property in environment metadata.
This setting is disabled by default because user.name in .git/config is typically a developer's real full name — collecting and uploading it without explicit consent is a PII concern. Enable it only when your team is aware and has agreed to share this information.
When enabled, the following custom property is populated:
Git.Actor— value of[user] namefrom the local.git/config
This setting has no effect when:
- Running in a CI environment (
IsCIEnvironment = true) — CI actor comes from the CI provider's environment variables instead - Running outside a git repository
Example:
{
"Xping": {
"CollectLocalGitAuthor": true
}
}
export XPING_COLLECTLOCALGITAUTHOR="true"
var config = new XpingConfiguration
{
CollectLocalGitAuthor = true
};
XpingContext.Initialize(config);
CollectCiActorEmail
Type: bool
Default: true
Environment Variable: XPING_COLLECTCIACTOREMAIL
On a CI run, controls whether the SDK records the email address the platform gives for the person
behind the run as the CI.ActorEmail custom property. It is read from BUILD_REQUESTEDFOREMAIL
(Azure Pipelines), GITLAB_USER_EMAIL (GitLab), CHANGE_AUTHOR_EMAIL or ghprbPullAuthorEmail
(Jenkins) and APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL (AppVeyor).
Xping Cloud uses the email only to link a committer to a workspace member automatically; it never
counts committers by it. Set this to false to keep email addresses out of the local store and
uploads. Committers are still counted from CI.Actor, and are then linked to members by hand. See
Who Is Behind the Run.
This setting has no effect on:
- Local runs, which never send
CI.ActorEmail CI.ActorandCI.ActorId, which are sent either way
Example:
{
"Xping": {
"CollectCiActorEmail": false
}
}
export XPING_COLLECTCIACTOREMAIL="false"
var config = new XpingConfiguration
{
CollectCiActorEmail = false
};
XpingContext.Initialize(config);
Advanced Settings
Logging: The SDK uses
Microsoft.Extensions.Logging.ILoggerfor diagnostics. Configure log verbosity through your host's standard logging configuration (e.g.,appsettings.jsonLoggingsection orILoggingBuilder). There are no SDK-specificLogLevelorLoggerconfiguration properties.
StrictMode
Type: bool
Default: false
Environment Variable: XPING_STRICTMODE
Controls how the SDK responds to errors that prevent proper test observability.
false(default — resilient mode): Configuration and network errors are logged and the SDK silently continues or is disabled. Tests always run without interruption.true(strict mode): In the core SDK, any error that prevents test data from being collected or uploaded is surfaced by throwingXpingConfigurationExceptionorXpingNetworkException. The provided NUnit, xUnit, and MSTest adapters turn them into a failed run, so CI pipelines fail when observability cannot be guaranteed.
Strict mode is recommended for production CI/CD pipelines where you want to guarantee observability is always active, rather than letting it silently degrade.
How the run fails:
| Error | Adapter | What you see |
|---|---|---|
| Configuration error, at startup | all | The test process terminates (Environment.FailFast) before any test runs. |
SDK fails to start, such as an appsettings.json that does not parse |
all | Same as a configuration error. Strict mode must then come from XPING_STRICTMODE, Xping__StrictMode, or code: the SDK cannot read it from the file that failed. |
| Upload error, at the end of the run | xUnit | An error from the runner (Catastrophic failure: XpingNetworkException). |
| MSTest | [AssemblyCleanup] fails. MSTest reports it on the last test result, so that test shows as failed. |
|
| NUnit on vstest | The test process terminates once the test host has sent its results, about two seconds after the upload fails. dotnet test reports the run as aborted. |
|
| NUnit on Microsoft.Testing.Platform | The test executable exits with code 1 after writing its reports. dotnet test reports the run as failed. |
In every case dotnet test exits non-zero, and every test that ran stays in TRX and other reports.
NUnit and MSTest: an upload error surfaces when the session ends, in your
[OneTimeTearDown]or[AssemblyCleanup]. CallXpingContext.FinalizeAndShutdownAsync()there. Under NUnit it is what fails the run:FinalizeAsync()only throws, NUnit logs that as a warning, anddotnet testexits with code 0. Under MSTest an exception fromFinalizeAsync()fails the run too, but it leaves the host running.
When the SDK cannot start in resilient mode, it prints [Xping] SDK initialization failed: <reason> once and the tests run untracked. Where that line shows up depends on the runner:
| Runner | Where to look |
|---|---|
| NUnit | dotnet test output, at the default verbosity. |
| xUnit (v2 and v3) | dotnet test -v n, or the runner's diagnostics with "diagnosticMessages": true in xunit.runner.json. |
| MSTest | The output of the first test that ran, kept in TRX (dotnet test --logger trx). |
The next run in the same process tries again, so an IDE's test server recovers once the cause is fixed.
When to use strict mode:
- Production CI/CD pipelines where missing Xping configuration or network failures should be a build failure
- Teams that have fully adopted Xping and want to enforce observability mandatorily
- Security-sensitive environments where untracked test runs are unacceptable
When to use resilient mode (default):
- Local development and developer onboarding
- Environments where tests must always run regardless of observability status
- Gradual SDK adoption across a codebase
Behavior comparison:
| Scenario | Resilient Mode (default) | Strict Mode |
|---|---|---|
Missing ApiKey |
Error logged, SDK disabled, tests run | XpingConfigurationException thrown, test run fails |
Invalid ApiEndpoint |
Error logged, SDK disabled, tests run | XpingConfigurationException thrown, test run fails |
SDK fails to start (e.g. appsettings.json does not parse) |
[Xping] SDK initialization failed printed, tests run untracked |
Test run fails before any test runs |
| Network error during upload | Error logged, tests complete without observability data | XpingNetworkException thrown, test run fails |
| Valid configuration + upload succeeds | SDK active, tests tracked | SDK active, tests tracked |
Example:
{
"Xping": {
"StrictMode": true
}
}
# Enable via environment variable
export XPING_STRICTMODE="true"
# Inline for a single test run
XPING_STRICTMODE=true dotnet test
var config = new XpingConfigurationBuilder()
.WithApiKey("your-api-key")
.WithProjectId("your-project")
.WithStrictMode(true)
.Build();
XpingContext.Initialize(config);
GitHub Actions example:
- name: Run Tests
env:
XPING_APIKEY: ${{ secrets.XPING_APIKEY }}
XPING_PROJECTID: ${{ vars.XPING_PROJECTID }}
XPING_STRICTMODE: "true"
run: dotnet test
Expected output when strict mode triggers:
# Resilient mode (default) — configuration error
[Error] Configuration validation failed: ApiKey is required.
SDK disabled - tests will run without observability tracking.
# Strict mode — configuration error
[Xping] Strict mode configuration error: Xping configuration invalid: ApiKey is required.
# Resilient mode (default) — network error
[Error] Network error occurred
HTTP request failed: ...
# Strict mode — network error
[Xping] Strict mode network error: Xping network error in strict mode: HTTP request failed: ...
Configuration Examples
CloudUrl
Type: string
Default: https://app.xping.io
Environment Variable: XPING_CLOUDURL
CLI only; the SDK does not read it. The Xping Cloud (Portal) URL that xping login signs in to and that xping report reads Cloud data from. Leave it unset unless you were given another Xping Cloud address.
Precedence, highest first: the --cloud-url option, XPING_CLOUDURL, Xping__CloudUrl, then Xping:CloudUrl in appsettings.{environment}.json and appsettings.json of the working directory.
The value must be an absolute https URL with no path, query or fragment; http is accepted only for localhost and 127.0.0.1. Case, a default port and a trailing slash are ignored, so https://App.Xping.io/ and https://app.xping.io are the same sign-in.
export XPING_CLOUDURL="https://app.xping.io"
LocalStorePath
Type: string
Default: (unset — resolved to the repository root)
Environment Variable: XPING_LOCAL_STORE
Overrides where the local store is kept. Leave it unset for the default — .xping/ at the repository root, which is where xping report looks — and set it only when a run must keep its history somewhere else: a read-only checkout, a container whose source tree is not writable, or a test host that drives the SDK as its subject and must not write next to the real runs.
XpingContext.Initialize(new XpingConfiguration
{
LocalStorePath = Path.Combine(Path.GetTempPath(), "xping-scratch")
});
The SDK reads XPING_LOCAL_STORE once, when it initializes; changing it during the run does not move the run's own history. The CLI reads the same variable, so an exported XPING_LOCAL_STORE moves both sides together. A value set in code or appsettings.json moves only the SDK; export the variable when running the CLI against it (--directory starts the CLI's repository walk somewhere else, it does not name a store).
Complete JSON Configuration
{
"Xping": {
"ApiKey": "xpg_live_productionkey",
"ProjectId": "my-application",
"ApiEndpoint": "https://upload.xping.io/v1",
"BatchSize": 100,
"FlushInterval": "00:00:30",
"Environment": "Production",
"Enabled": true,
"CaptureStackTraces": true,
"EnableCompression": true,
"MaxRetries": 3,
"RetryDelay": "00:00:02",
"UploadTimeout": "00:00:30",
"EnablePullRequestDetection": true,
"CollectLocalGitAuthor": false,
"CollectCiActorEmail": true
}
}
Environment-Specific Configuration
appsettings.Development.json:
{
"Xping": {
"ApiKey": "xpg_test_developmentkey",
"ProjectId": "my-app-dev",
"Environment": "Development",
"Enabled": true,
"BatchSize": 50,
"FlushInterval": "00:00:10"
}
}
appsettings.Production.json:
{
"Xping": {
"ApiKey": "xpg_live_productionkey",
"ProjectId": "my-app-prod",
"Environment": "Production",
"Enabled": true,
"BatchSize": 200,
"FlushInterval": "00:01:00"
}
}
CI/CD Environment Variables (GitHub Actions)
env:
XPING_APIKEY: ${{ secrets.XPING_APIKEY }}
XPING_PROJECTID: "my-app"
XPING_ENVIRONMENT: "CI"
XPING_ENABLED: "true"
XPING_BATCHSIZE: "200"
XPING_FLUSHINTERVAL: "60"
Programmatic Configuration
using Xping.Sdk.Core;
using Xping.Sdk.Core.Configuration;
// Fluent builder pattern
// XPING_APIKEY is applied automatically, so it does not need reading by hand here.
var config = new XpingConfigurationBuilder()
.WithProjectId("my-application")
.WithBatchSize(200)
.WithFlushInterval(TimeSpan.FromMinutes(1))
.WithEnvironment("Staging")
.WithMaxRetries(5)
.Build();
XpingContext.Initialize(config);
// Direct configuration
var directConfig = new XpingConfiguration
{
ApiKey = "xpg_live_productionkey",
ProjectId = "my-app",
BatchSize = 150,
EnableCompression = true
};
XpingContext.Initialize(directConfig);
Minimal Configuration
{
"Xping": {
"ApiKey": "xpg_live_productionkey",
"ProjectId": "my-app"
}
}
All other settings use default values.
Configuration Loading Order
See Configuration Methods above for the two resolution orders and which
one applies to how you initialize. The short version: XPING_* beats everything, on both paths.
Example resolution under XpingContext.Initialize(), which reads files:
ApiKey:
- Default: null
- appsettings.json: "xpg_test_key"
- Environment variable: "xpg_live_key" <- Wins
- Programmatic: Not set
BatchSize:
- Default: 100
- appsettings.json: 200 <- Wins
- Environment variable: Not set
- Programmatic: Not set
A blank variable counts as unset rather than as the empty string, on both formats. That matters
because XPING_APIKEY: ${{ secrets.XPING_APIKEY }} expands to nothing when the secret is missing:
treated as a value it would clear a key configured elsewhere and silently drop the run to
local-only, so it is ignored instead.
Configuration Validation
Xping SDK validates configuration on initialization and provides clear error messages for invalid settings.
Validation Rules
| Setting | Validation |
|---|---|
ApiKey |
Must not be empty or whitespace |
ApiEndpoint |
Must be valid HTTP/HTTPS URL |
BatchSize |
Must be between 1 and 1000 |
FlushInterval |
Must be greater than zero |
MaxRetries |
Must be between 0 and 10 |
RetryDelay |
Between 0 and 1 day |
UploadTimeout |
Between 1 second and 1 day |
Handling Validation Errors
var builder = new XpingConfigurationBuilder()
.WithApiKey("") // Invalid
.WithBatchSize(2000); // Invalid
if (builder.TryBuild(out var config, out var errors))
{
XpingContext.Initialize(config);
}
else
{
Console.WriteLine("Configuration errors:");
foreach (var error in errors)
{
Console.WriteLine($" - {error}");
}
}
}
// Output:
// Configuration errors:
// - ApiKey is required.
// - BatchSize cannot exceed 1000.
Best Practices
Security
- Never commit API keys to source control
- Use environment variables in CI/CD pipelines
- Rotate API keys regularly
- Use different keys per environment
- Restrict key permissions when available
Performance
Adjust batch size based on test suite size:
- Small suites (<100 tests):
BatchSize = 50 - Medium suites (100-1000 tests):
BatchSize = 100-200 - Large suites (>1000 tests):
BatchSize = 500-1000
- Small suites (<100 tests):
Balance flush interval with visibility needs:
- Real-time monitoring:
10-15 seconds - Standard CI:
30-60 seconds - Batch jobs:
2-5 minutes
- Real-time monitoring:
Enable compression unless debugging network issues
Reliability
- Keep default retry settings unless you have specific requirements
- Monitor retry rates in Xping Cloud
- Increase timeouts for slow networks
- Enable auto-detect CI for consistent environment tracking
Development Workflow
Local development:
{ "Xping": { "Enabled": true, "BatchSize": 50, "FlushInterval": "00:00:10" } }CI/CD pipelines:
env: XPING_BATCHSIZE: "200" XPING_FLUSHINTERVAL: "60"Production monitoring:
{ "Xping": { "BatchSize": 500, "FlushInterval": "00:02:00" } }
Troubleshooting
Configuration not loading
Problem: Settings from appsettings.json are ignored.
Solutions:
Ensure file is copied to output directory:
<ItemGroup> <None Update="appsettings.json"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> </ItemGroup>Verify JSON syntax is valid
Check section name is exactly
"Xping"(case-sensitive)
Environment variables not working
Problem: Environment variables don't override JSON configuration.
Solutions:
Verify variable name uses
XPING_prefix (notXPING__)Check variable is set in the correct scope:
# System-wide export XPING_APIKEY="key" # Process-specific XPING_APIKEY="key" dotnet testRestart IDE/terminal after setting environment variables
Validation errors on startup
Problem: SDK fails to initialize with validation errors.
Solutions:
Check error messages for specific issues
Verify the required setting (
ApiKey) is providedEnsure numeric values are within valid ranges
Validate TimeSpan format:
"HH:MM:SS"
See Also
- Quick Start Guides - Framework-specific setup
- CI/CD Integration - Pipeline configuration examples
- Troubleshooting - Common configuration issues
Need help?