aft-reporting-filesystem
Version:
Automated Functional Testing (AFT) reporting plugin package supporting logging to files
56 lines (51 loc) • 3.43 kB
Markdown
Automated Functional Testing (AFT) package providing a Filesystem Logging Plugin that generates .log files based on the `ReportingManager.name` and appends log lines using a customisable date format
## Installation
`> npm i aft-reporting-filesystem`
## Configuration
this plugin accepts configuration options in the following format:
`aftconfig.json`
```json
{
"plugins": [
{"name": "filesystem-reporting-plugin", "searchDir": "./node_modules"}
],
"FilesystemReportingPluginConfig": {
"logLevel": "trace",
"outputPath": "./full/path/or/relative/path/to/directory",
"includeResults": false,
"dateFormat": "YYYY-MM-DD HH:mm:ss.SSS",
"maxFilenameLength": 222,
"ellipsisLocation": "middle"
}
}
```
- **logLevel** - a `string` containing a valid `LogLevel` _(defaults to `trace` if not set)_
- **outputPath** - a `string` with either an absolute path or a relative path from the `process.cwd()` where .log files will be created _(defaults to `path.join(process.cwd(), 'logs')`)_
- **includeResults** - a `boolean` indicating whether calls to any `ReportingManager.submitResult` function will output the `TestResult` to the .log file _(defaults to `true`)_
- **dateFormat** - a `string` that can include Date Formatting as outlined at the [date-and-time](https://github.com/knowledgecode/date-and-time#formatdateobj-arg-utc) npm package
- **maxFilenameLength** - a `number` representing the maximum length log filename allowed before truncation occurs using the `ellide` helper _(defaults to `222`)_
- **ellipsisLocation** - a `EllipsisLocation` type of `'beginning'`, `'middle'`, or `'end'` that is used if the filename is truncated _(defaults to `'middle'`)_
all log files are written using UTF-8 encoding and by default will resemble the following:
`./logs/your_value_for_LogName.log`
```
[] - STEP - 1: navigate to LoginPage...
[] - STEP - 2: login
[] - INFO - sending tomsmith to the Username Input
[] - INFO - username entered
[] - INFO - sending SuperSecretPassword! to the Password Input
[] - INFO - password entered
[] - INFO - clicking Login Button...
[] - INFO - Login Button clicked
[] - STEP - 3: wait for message to appear...
[] - STEP - 4: get message...
[] - PASS - C3456
[] - PASS - C2345
[] - PASS - C1234
[] - PASS - {"testId":"C3456","created":1656523137189,"resultId":"b259d87b-ccb6-4ace-b3a8-9ea08a8f578d","status":"Passed","metadata":{"durationMs":13168,"buildName":"unknown","buildNumber":"unknown"}}
[] - PASS - {"testId":"C2345","created":1656523137253,"resultId":"3f404419-1240-44fe-b6e1-e1072f5af787","status":"Passed","metadata":{"durationMs":13231,"buildName":"unknown","buildNumber":"unknown"}}
[] - PASS - {"testId":"C1234","created":1656523137255,"resultId":"6be91db1-9523-434f-8349-a1a19e2ed282","status":"Passed","metadata":{"durationMs":13233,"buildName":"unknown","buildNumber":"unknown"}}
[] - DEBUG - closing driver instance...
[] - DEBUG - driver instance closed.
```