You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So this commit is massive. Sorry about that. I got carried
away adding -watch support and ended up improving a lot of
other things along the way.
Current qa -watch features include runtime dependency analysis
of any require, load, and require_relative. Editing a test
file will re-run all test cases in that file, but editing
a dependency of a single test will only re-run test that
use that functionality. Future work may introduce finer-
grained logic.
Debut (and rename) "qa auto" as "qa watch". This functionality is
available on any qa test run command. For example:
qa minitest -watch
Globs used by the -watch option support {foo,bar} style
expressions (in addition to * and **), so you can do obscene things
like:
qa test-unit -watch 'test/{unit,functional}/**/test*.rb'
Note the single quotes so the shell doesn't expand the pattern
and prevent the filesystem watcher from discovering new tests
that fit the pattern.
Split -warmup into -warmup and -eager-load. This way we can avoid
-eager-load when capturing runtime dependencies, which would
introduce noise. Make -warmup default to true again, so basic
rails tests can pass out of the box with a -jobs value > 1.
Make test filter for rspec deterministic across runs (other
frameworks already had this property). This was required for
-watch functionality.
Add -memprofile and -heapdump command line options to help
diagnose memory usage problems within qa itself. This was
important for getting heap usage low enough for -watch to
be useful on large rails projects like discourse.
Improve support for syntax and load errors during test runs. This
was also important for -watch to be useful in the real word.
Also add automated demo asciicast creation. A decent amount
of work in this behemoth of a change was thanks to iterating
on qa so the demo asciicasts would look reasonable. For example:
- Strip minitest paths from backtraces.
- Refine normal qa run output to be tighter and easier to scan.
- Tweak colors and ordering of snail report.
- Fix test seeding to actually generate different values each
qa run, discovered while trying to generate interesting data for
a `qa flaky` demo.
- `qa flaky` output has color and no more cruft.
- `qa flaky` shows error messages in overview.
- `qa flaky` shows relative frequency of each type of error.
Other changes that got sucked into this change and couldn't
escape its gravity well:
- Rename tapjio event types to have more regular, sane names.
- Fix a bug in minitest spec support that caused problems
for tests that had different but identically named describe
blocks. Thanks to @halostatue for reporting it!
- Add framework-specific commands, so tab completion works. So
instead of:
qa run minitest:test/**/test*.rb
use
qa minitest test/**/test*.rb
- Fix hang after ctrl-c of qa run command.
- Enable local variable capture by default on macOS, leave disabled by
default on Linux (for stability reasons).
Finally, update README.md and include the most basic asciicast.
Copy file name to clipboardexpand all lines: README.md
+23-18
Original file line number
Diff line number
Diff line change
@@ -2,35 +2,39 @@
2
2
3
3
QA is a lightweight tool for running your tests *fast*.
4
4
5
-
For years, the software testing ecosystem has lagged behind other parts of the software development pipeline. Advances in type systems, compiler technology, and prototyping environments (to name a few) have helped make software engineers much more productive. QA is an effort to make similar strides for automated testing tools.
Advances in type systems, compiler technology, and prototyping environments (to name a few) have helped make many software engineering activities more productive. QA is an effort to make similar strides for automated testing tools.
6
8
7
9
## What can QA help me do today?
8
10
9
-
1. Run your tests faster. Run `qa run <type>` in your project directory and watch your test results scream by as they run in parallel. QA provides a beautiful, easy to understand report. No Rakefile necessary!
11
+
1. Run your tests faster. Run `qa rspec`, `qa minitest`, or `qa test-unit` in your project directory and watch your test results scream by as they run in parallel. QA provides a beautiful, easy to understand report. No Rakefile necessary!
10
12
11
-
2. See which tests are slowing down your testrun. QA highlights tests that are dramatically slower than the average test duration. Look for the 🐌 at the end of successful testrun!
13
+
2. See which tests are slowing you down. QA highlights tests that are dramatically slower than average. Look for the 🐌 at the end of successful testrun!
12
14
13
15
3. See per-test stderr and stdout. Even when running tests in parallel!
14
16
15
17
4. Investigate test performance by generating flamegraphs (or icicle graph) for the entire testrun. See `-save-flamegraph`, `-save-icegraph`, and `-save-palette`.
16
18
17
-
5. Run your tests in parallel. QA does this for you automatically, for test types `rspec`, `rspec-pendantic`, `minitest`, `minitest-pendantic`, `test-unit`, and `test-unit-pendantic`. The`-pendantic` suffix runs each *method* in a separate child process. (Versus each *case* in its own worker process.)
19
+
5. Run your tests in parallel. QA does this for you automatically. Use`-squash=none` to run each *method* in a separate child process. The default is `-squash=file`, which runs each *file* in its own process.
18
20
19
-
6. Analyze and eliminate [test flakiness](#whatis_flaky). The `-archive-base-dir` option for `qa run`records test outcomes across different runs. Use the `qa flaky` command with the same `-archive-base-dir` option to identify and diagnose flaky tests. This is new functionality, so please [open an issue](https://github.com/ajbouh/qa/issues/new) with questions and feedback!
21
+
6. Analyze and eliminate [test flakiness](#whatis_flaky). The `-archive-base-dir` option records test outcomes across different runs. Use the `qa flaky` command with the same `-archive-base-dir` option to identify and diagnose flaky tests. This is new functionality, so please [open an issue](https://github.com/ajbouh/qa/issues/new) with questions and feedback!
20
22
21
23
7. Track threads, GC, require, SQL queries, and other noteworthy operations in a tracing format that can be used with the `chrome://tracing` tool, using `-save-trace` option.
22
24
23
-
8. See source code snippets and (with the experimental `-errors-capture-locals`) actual values of local variables for each from of an error's stack trace.
25
+
8. See source code snippets and actual values of local variables for each frame of an error's stack trace.
24
26
25
27
9. Record test output as TAP-J, using `-save-tapj` option.
26
28
27
29
10. Automatically partition Rails tests across multiple databases, one per worker (Using custom ActiveRecord integration logic). If the required test databases do not exist, they will be setup automatically before tests begin. NOTE This functionality is highly experimental. Disable it with `-warmup=false`. Please [open an issue](https://github.com/ajbouh/qa/issues/new) if you have trouble.
28
30
29
31
## What languages and test frameworks does QA support?
30
32
31
-
Ruby's RSpec, MiniTest, test-unit. Be sure to use `bundle exec` when you run qa, if you're managing dependencies with Bundler. For example, if you're using rspec:
33
+
Ruby 2.3+, and any of: RSpec, MiniTest, test-unit.
34
+
35
+
Be sure to use `bundle exec` when you run qa, if you're managing dependencies with Bundler. For example, if you're using Rspec:
32
36
```
33
-
bundle exec qa run rspec
37
+
bundle exec qa rspec
34
38
```
35
39
36
40
## What will QA help me do tomorrow?
@@ -66,15 +70,15 @@ test/
66
70
Example usage and output:
67
71
```
68
72
> cd $project
69
-
> qa run minitest
73
+
> qa minitest
70
74
...
71
75
```
72
76
73
77
## Troubleshooting QA
74
78
75
79
Since QA is still in alpha, there are a number of rough edges.
76
80
77
-
If `qa run` seems to be acting strangely and isn't providing a reasonable error message, you may be experiencing a bug relating to swallowed error output. This is tied to QA's stdout and stderr capture logic. Adding the `-capture-standard-fds=false` option will disable the capture logic and should allow the original error to bubble up. Please [open an issue](https://github.com/ajbouh/qa/issues/new) with the error output.
81
+
If `qa` seems to be acting strangely and isn't providing a reasonable error message, you may be experiencing a bug relating to swallowed error output. This is tied to QA's stdout and stderr capture logic. Adding the `-capture-standard-fds=false` option will disable the capture logic and should allow the original error to bubble up. Please [open an issue](https://github.com/ajbouh/qa/issues/new) with the error output.
78
82
79
83
## What are flaky tests?<aname="whatis_flaky"></a>
80
84
@@ -87,21 +91,21 @@ So that's the bad news: by their very nature, flaky tests are hard to avoid. In
87
91
## How do I use QA to detect flaky tests?
88
92
An example session
89
93
```
90
-
$ qa run -archive-base-dir ~/.qa/archive
94
+
$ qa minitest -archive-base-dir ~/.qa/archive
91
95
# ... unexpected test failure
92
-
$ qa run -archive-base-dir ~/.qa/archive
96
+
$ qa minitest -archive-base-dir ~/.qa/archive
93
97
# ... that same test now passes
94
98
```
95
99
96
-
To analyze the last few days worth of test results, you can use the `qa flaky` command. It's important to use the same value for `-archive-base-dir` as given to `qa run`. For example, continuing the session from above:
100
+
To analyze the last few days worth of test results, you can use the `qa flaky` command. It's important to use the same value for `-archive-base-dir` as given to other `qa` commands. For example, continuing the session from above:
97
101
98
102
```
99
103
$ qa flaky -archive-base-dir ~/.qa/archive
100
104
```
101
105
102
106
## How does QA detect flaky tests?
103
107
104
-
At a high level, QA considers a test to be flaky if, for a particular code revision, that test has both passed and failed. That's why you should provide a `-suite-coderef` value to `qa run`.
108
+
At a high level, QA considers a test to be flaky if, for a particular code revision, that test has both passed and failed. That's why you should provide a `-suite-coderef` value to `qa` commands.
105
109
106
110
At a low level, QA uses a few tricks to find as many examples of a flaky failure as it can. The actual algorithm for discovering flaky tests is:
107
111
- Fingerprint all failures using:
@@ -111,8 +115,8 @@ At a low level, QA uses a few tricks to find as many examples of a flaky failure
111
115
- Find all tests that, for a single revision, have both passed and failed.
112
116
- Put test failures from different revisions in the same bucket if their fingerprint matches a known flaky test
113
117
114
-
## How will QA help me with test flakiness?
115
-
Now the good news: with QA, we've set out to address the shortcomings we see with today's testing tools. We want a toolset that's *fast* and gives us more firepower for dealing with the reality of flaky tests.
118
+
## How will future versions of QA help me with test flakiness?
119
+
With QA, we've set out to address the shortcomings we see with today's testing tools. We want a toolset that's *fast* and gives us more firepower for dealing with the reality of flaky tests.
116
120
117
121
-**Testing code that includes dependencies you didn't write?** QA will isolate tests from network services using an OS-specific sandbox.
118
122
@@ -153,7 +157,7 @@ Now the good news: with QA, we've set out to address the shortcomings we see wit
153
157
-[X] Add TAP-J analysis tools, to detect rates of flakiness in tests
154
158
-[ ] Add support for marking some tests as (implicitly?) new, forcing them to be run many times and pass every time
155
159
-[ ] Add support for marking tests as flaky, separating their results from the results of other tests
156
-
-[] For tests that are failing flakily, show distribution of which line failed, test duration, version of code
160
+
-[x] For tests that are failing flakily, show distribution of which line failed, test duration, version of code
157
161
158
162
### Continuous integration
159
163
-[ ] Add support for auto-filing issues (or updating existing issues) when a merged test fails that should not be flaky
@@ -162,7 +166,8 @@ Now the good news: with QA, we've set out to address the shortcomings we see wit
162
166
### Local development
163
167
-[ ] Order test run during local development based on what's failed recently
164
168
-[ ] Line-level code coverage report
165
-
-[ ] Rerunning tests during local development affected by what code you just modified (test code or AUT, using code coverage analysis)
169
+
-[x] Rerunning tests during local development affected by what code you just modified (test code or AUT, using code coverage analysis)
170
+
-[ ] Line-level test rerunning, using code coverage
166
171
-[ ] Limit tests to files that are open in editor (open test files, open AUT files, etc)
167
172
-[ ] Can run with git-bisect to search for commit that introduced a bug
168
173
-[ ] Suggest which failing tests to debug first (based on heuristics)
0 commit comments