Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 9 days ago
JSON representation
this repo hosts the code for mocha test reporter for splunk
- Host: GitHub
- URL: https://github.com/arociris/mocha-splunk
- Owner: arociris
- License: gpl-3.0
- Created: 2021-12-28T07:11:10.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-04T09:45:33.000Z (over 2 years ago)
- Last Synced: 2024-04-20T05:21:45.144Z (7 months ago)
- Topics: automation, mocha, mocha-chai, mocha-reporter, mocha-splunk, mocha-tests, mochajs, reporter, splunk
- Language: JavaScript
- Homepage:
- Size: 142 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.