Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/arociris/mocha-splunk

this repo hosts the code for mocha test reporter for splunk
https://github.com/arociris/mocha-splunk

automation mocha mocha-chai mocha-reporter mocha-splunk mocha-tests mochajs reporter splunk

Last synced: 1 day ago
JSON representation

this repo hosts the code for mocha test reporter for splunk

Awesome Lists containing this project

README

        

# mocha-splunk

This is a reporter for Mocha to log test results to Splunk.

**Installation**
To install run `npm install mocha-splunk`

**Usage**
This reporter will log below mentioned information to splunk
1. Test run number
2. Git branch
3. Test duration
4. Test title
5. Test result
6. Additional debug information
To use this in your Mocha tests, update your run command to use Mocha-Splunk reporter as below:
`mocha --reporter mocha-splunk --reporter-options testfiles.js`

To use the reporter, below is list of reporter options that needs to be setup

| Option | Required |Description |
|--|--|--|
| run_no | No| Test run number / build number|
| test_env| No| Test environment e.g. QA/UAT |
| git_branch| No| Git branch under test|
| splunk_host| Yes | Splunk host name e.g. splunk.com:8088|
| splunk_url| No| URL for event collector e.g. /services/collector|
| splunk_token| Yes | Splunk HTTP token|
| debug| No| print debug information from the reporter |
| useProcessVar|No| Whether to read options from environment variables|

Make sure to providing values mandatory options as outlined in above table to make sure smooth reporting on slack

**Quering splunk**
In the new search, mention your index and source type as http event. This will list your test results
![image](https://user-images.githubusercontent.com/31276396/147637937-a963e85e-3aa2-494d-953c-697f548fb93d.png)

Note: This reporter is based on [mochawesome](https://github.com/adamgruber/mochawesome). Many thanks to the maintainers.