Skip to content

Commit 7387786

Browse files
committed
Add Format Test Results As A JSON File as an RSpec TIL
1 parent 5e63e42 commit 7387786

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010

1111
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
1212

13-
_1338 TILs and counting..._
13+
_1339 TILs and counting..._
1414

1515
---
1616

@@ -1020,6 +1020,7 @@ _1338 TILs and counting..._
10201020

10211021
- [Check Specific Arguments To Received Method](rspec/check-specific-arguments-to-received-method.md)
10221022
- [Find Minimal Set Of Tests Causing A Flicker](rspec/find-minimal-set-of-tests-causing-a-flicker.md)
1023+
- [Format Test Results As A JSON File](rspec/format-test-results-as-a-json-file.md)
10231024
- [Run Tests With Documentation Formatting](rspec/run-tests-with-documentation-formatting.md)
10241025
- [Use Specific Cache Store In A Single Test](rspec/use-specific-cache-store-in-a-single-test.md)
10251026

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Format Test Results As A JSON File
2+
3+
The most common output format for RSpec test results is _progress_ which shows
4+
the dot (`.`) or `F` for each test pass and fail. RSpec supports other formats,
5+
including JSON.
6+
7+
You'd typically want to use the JSON format when you want to programmatically
8+
work with the results. And the results would be most accessible if they ended
9+
up in a file.
10+
11+
So, when formatting the results to JSON, we typically also want to specify an
12+
output file. We'll need to use two flags — `--format` and `--out`.
13+
14+
```bash
15+
$ rspec --format json --out test_run_1.json
16+
```
17+
18+
When this test run completes, we will have the results in JSON format in the
19+
newly created `test_run_1.json` file in the current directory.
20+
21+
See `rspec --help` for more details.

0 commit comments

Comments
 (0)