# publish-test-results

Publishes local test results to Jira server as a Test Run, where the results are connected to the synchronized test cases and optionally to a build.

To read more about publishing test results see the [Publishing test result files](/specsync/jira/features/test-result-publishing-features/publishing-test-result-files.md) page. Please also check the related [configuration file reference](/specsync/jira/reference/configuration/configuration-publishtestresults.md) for the `publish-test-results` command.

## Options

In addition the the options listed here, all [common command line options](/specsync/jira/reference/command-line-reference.md#common-command-line-options) can also be used.

| Option                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                         | Default                                      |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
| `--filter`                              | A [local test case condition](/specsync/jira/features/general-features/local-test-case-conditions.md) of scenarios that should be considered for test result publishing (e.g. `@current_sprint and @done`). See [Filters and scopes](/specsync/jira/important-concepts/filters-and-scopes.md) for details.                                                                                                          | not filtered by tags                         |
| `--sourceFileFilter`                    | An expression of source file [glob patterns](https://speclink.me/specsync-glob) that should be considered for test result publishing (e.g. `Folder1/**/*.feature`). See [Filters and scopes](/specsync/jira/important-concepts/filters-and-scopes.md) for details.                                                                                                                                                  | not filtered by feature files                |
| `-r`\|`--testResult` \<FILE‑PATH>       | The file path of the test result (.trx, .xml or .json) file to publish or a folder that contains multiple test result files. Can be specified multiple times. The semicolon-separated value list is still supported. Wildcards are supported using the [glob pattern](https://speclink.me/specsync-glob) syntax.                                                                                                    | use from config file                         |
| `-f`\|`--testResultFormat` \<FORMAT>    | The file format of the file to publish. Please check the [Compatibility](/specsync/jira/reference/compatibility.md#supported-test-result-formats) page for supported formats. Invoking the command with `?` as format will list all supported format as well.                                                                                                                                                       | use from config file or detect automatically |
| `--runName` \<NAME>                     | The name of the Test Run to be created. The value can contain [placeholders](/specsync/jira/reference/configuration/configuration-publishtestresults.md#setting-placeholders).                                                                                                                                                                                                                                      | get from test result file                    |
| `--runComment` \<RUN‑COMMENT>           | The comment field of the test run to be created. The value can contain [placeholders](/specsync/jira/reference/configuration/configuration-publishtestresults.md#setting-placeholders).                                                                                                                                                                                                                             | not specified                                |
| `--testResultComment` \<RESULT‑COMMENT> | The comment added to the individual test results within the created test run. Useful if the individual test results are typically browsed not through the test run. The value can contain [placeholders](/specsync/jira/reference/configuration/configuration-publishtestresults.md#setting-placeholders).                                                                                                          | not specified                                |
| `--testRunSetting` \<NAME>=\<VALUE>     | Additional settings for the created test run. The value can contain [placeholders](/specsync/jira/reference/configuration/configuration-publishtestresults.md#setting-placeholders). For Zephyr Scale Test Cycles you can specify `name`, `description`, `iteration`, `version` and `folder`. This option can be used *multiple times* using the `setting=value` format, e.g. `--testRunSetting "name=My Results"`. | use from config file or defaults             |
| `--testResultSetting` \<NAME>=\<VALUE>  | Additional settings for the individual test results. The value can contain [placeholders](/specsync/jira/reference/configuration/configuration-publishtestresults.md#setting-placeholders). For Zephyr Scale test results you can specify `comment` and `environment`. This option can be used *multiple times* using the `setting=value` format, e.g. `--testResultSetting "comment=Details"`.                     | use from config file or defaults             |
| `--attachFile` \<FILE>                  | File path that should be attached to the test run additionally. (e.g. `error1.png`) Can be specified multiple times. Wildcards are currently not supported.                                                                                                                                                                                                                                                         | only test result file attached               |

## Examples

Publishes a test result file `result.trx` to Jira:

```
dotnet specsync publish-test-results --testResult result.trx
```

Publishes a test result file produced by Cucumber Java JUnit execution:

```
dotnet specsync publish-test-results --testResult cucumber-result.xml --testResultFormat CucumberJavaJUnitXml
```

Publishes test results to Jira with Zephyr Scale and set Test Cycle folder and result environment.

```
dotnet specsync publish-test-results -r result.trx --testRunSetting "folder=/MyFolder" --testResultSetting "environment=Chrome"
```

{% content-ref url="/pages/YGXT54k7D3PR01ARt0Jy" %}
[Command line reference](/specsync/jira/reference/command-line-reference.md)
{% endcontent-ref %}

{% content-ref url="/pages/uhQACOkZRxfbFxCouQpF" %}
[publishTestResults](/specsync/jira/reference/configuration/configuration-publishtestresults.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.specsolutions.eu/specsync/jira/reference/command-line-reference/publish-test-results-command.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
