File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010
1111For 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
Original file line number Diff line number Diff line change 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.
You can’t perform that action at this time.
0 commit comments