Configuration ​
Configuration mode is the most flexible mode to publish your test results. It allows you to customize the behavior of the reporter.
Config File ​
The configuration file can be either a json
or js
file.
JSON File ​
{
"api_key": "<api-key>",
"targets": [
{
"name": "slack",
"inputs": {
"url": "<slack-incoming-webhook-url>"
}
}
],
"results": [
{
"type": "testng",
"files": [
"path/to/testng-results.xml"
]
}
]
}
JS File ​
const config = {
api_key: "<api-key>",
targets: [
{
name: "slack",
inputs: {
url: "<slack-incoming-webhook-url>"
}
}
],
results: [
{
type: "testng",
files: [
"path/to/testng-results.xml"
]
}
]
};
module.exports = config;
Config Intellisense ​
Since TestBeats ships with TypeScript typings, you can leverage your IDE's intellisense.
const { defineConfig } = require("testbeats");
const config = defineConfig({
api_key: "<api-key>",
targets: [
{
name: "slack",
inputs: {
url: "<slack-incoming-webhook-url>"
}
}
],
results: [
{
type: "testng",
files: [
"path/to/testng-results.xml"
]
}
]
});
module.exports = config;
INFO
To leverage testbeats intellisense, you need to install testbeats
package.
npm install testbeats
Portal Configuration ​
api_key
(string): test beats api key. Get it from testbeats.project?
(string): name of the project. Defaults to name of the repository.run?
(string): name of the test run. Defaults to name of the build run in CI.show_failure_summary?
(boolean): show failure summary. Defaults to true.show_smart_analysis?
(boolean): show smart analysis. Defaults to true.show_error_clusters?
(boolean): show top error clusters. Defaults to true.show_failure_analysis
(boolean): show failure analysis. Defaults to true.
TIP
- Project Names: Project names should remain static, as they are essential for calculating various test metrics. Unique test counts and failure analyses are tied to the specific project, making it a best practice to use the repository name consistently.
- Test Run Names: Test run names should also be static. Consistent naming allows for effective analysis and comparison of failures across different runs, facilitating better insights and tracking of trends over time.
With an organization we can have multiple projects and each project can host multiple runs. Consistent naming allows for effective analysis.
{
"api_key": "<api-key>",
"project": "<project-name>",
"run": "<run-name>",
"targets": [
{
"name": "slack",
"inputs": {
"url": "<slack-incoming-webhook-url>"
}
}
],
"results": [
{
"type": "testng",
"files": [
"path/to/testng-results.xml"
]
}
]
}
Targets Configuration ​
name
(string): name of the target.slack
,teams
,chat
,custom
,delay
,influx
enable?
(boolean): enables the target. Defaults to true.condition?
(condition): condition of execute the target.inputs
(object): target inputs.url
(string): target url.title?
(string): target title. Defaults to test run name.title_suffix?
(string): target title suffix.title_link?
(string): target title link.publish?
(string): type of report to be published. Defaults totest-summary
test-summary
,test-summary-slim
,failure-details
only_failures?
(string): publish only failures. Defaults to true.max_suites?
(number): max suites. Defaults to 10.width?
(string): target width. Only forteams
extensions?
(array): target specific extensions.
{
"targets": [
{
"name": "slack",
"inputs": {
"url": "<slack-incoming-webhook-url>",
"title": "API Regression Test",
"title_suffix": "Prod",
"title_link": "https://your.custom-link.com",
"publish": "test-summary-slim",
"only_failures": true,
"max_suites": 5
}
},
{
"name": "teams",
"inputs": {
"url": "<teams-incoming-webhook-url>",
"title": "API Regression Test",
"title_suffix": "Prod",
"title_link": "https://your.custom-link.com",
"only_failures": false,
"max_suites": 10,
"width": "Full"
},
"extensions": [
{
"name": "ci-info"
}
]
}
],
"results": [
{
"type": "testng",
"files": [
"path/to/testng-results.xml"
]
}
]
}
Extensions Configuration ​
name
(string): name of the extension.ci-info
,hyperlinks
,mentions
,metadata
,report-portal-analysis
,report-portal-history
,chart-test-summary
enable?
(boolean): enables the extension. Defaults to true.condition?
(condition): condition of execute the target.hook?
(string) - defines the position of the extension.start
,after-summary
,end
inputs?
(object) - custom inputs to run the extension.title?
(string) - title of the extension to be displayed. (applicable for most extensions)title_link?
(string) - attaches a clickable link to the title. (applicable for most extensions)
{
"targets": [
{
"name": "slack",
"inputs": {
"url": "<slack-incoming-webhook-url>",
"publish": "test-summary"
}
}
],
"extensions": [
{
"name": "ci-info"
}
]
}
TIP
You can find more configuration options in the Extensions documentation.
Results Configuration ​
type
(string): type of result.testng
,junit
,cucumber
,mocha
,jmeter
,mochawesome
,xunit
,nunit
files
(array): list of paths to the test results files.
{
"api_key": "<api-key>",
"targets": [
{
"name": "slack",
"inputs": {
"url": "<slack-incoming-webhook-url>"
}
}
],
"results": [
{
"type": "testng",
"files": [
"path/to/testng-results.xml",
"path/to/another/testng-results.xml"
"path/to/wildcard/testng-*.xml"
]
}
]
}