Pitfalls of Testing Scripts With Load - Part 1
Check out the full Testing Scripts with Load series: part 1, part 2, part 3
Previously it was shown how to use load to test scripts. As with all techniques, there are some drawbacks to using load
.
Hidden Require Dependency
Take script:
1 2 3 4 5 6 7 8 |
|
and passing spec:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
However, when the script is run standalone, it errors with:
1
|
|
Be aware that since load
happens in the current spec context, a missing require
may not be noticed if
it is required by the spec.
Whenever possible have at least one test that shells out as a sanity check.