datadriven
php-easycheck
datadriven | php-easycheck | |
---|---|---|
2 | 1 | |
39 | 0 | |
- | - | |
2.0 | 10.0 | |
2 months ago | over 8 years ago | |
Go | PHP | |
Apache License 2.0 | - |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
datadriven
-
Prefer table driven tests (2019)
Table driven tests are a lot better than a bunch of imperative tests but they rapidly become unwieldy to debug, maintain, and evolve. Their readability often isn’t great.
If you’re using go, check out https://github.com/cockroachdb/datadriven. It takes a little bit of effort to craft a testing dsl, but it is so worth it.
Also, snapshot style testing where the test writes out its expectations and you just inspect it and save it (part of datadriven) is wonderful.
I’ve been using insta in rust lately and it’s some of what I want but not quite datadriven.
-
Ask HN: What's your favorite software testing framework and why?
I’ve found the datadriven[1] testing approach in go to be quite effective. The idea is that you leverage a standardized file structure to construct a little DSL for testing your code. This allows you to write expressive tests that print the state of the code and then look at it. Rewrite is also very powerful.
This is all inspired by the sqllite logic test framework.
[1]: https://github.com/cockroachdb/datadriven
php-easycheck
-
Ask HN: What's your favorite software testing framework and why?
I tend to use anything that offers property-testing, since tests are much shorter to write and uncover lots more hidden assumptions.
My go-to choices per language are:
- Python: Hypothesis https://hypothesis.readthedocs.io/en/latest (also compatible with PyTest)
- Scala: ScalaCheck https://scalacheck.org (also compatible with ScalaTest)
- Javascript/Typescript: JSVerify https://jsverify.github.io
- Haskell: LazySmallCheck2012 https://github.com/UoYCS-plasma/LazySmallCheck2012/blob/mast...
- When I wrote PHP (over a decade ago) there was no decent property-based test framework, so I cobbled one together https://github.com/Warbo/php-easycheck
All of the above use the same basic setup: tests can make universally-quantified statements (e.g. "for all (x: Int), foo(x) == foo(foo(x))"), then the framework checks that statement for a bunch of different inputs.
Most property-checking frameworks generate data randomly (with more or less sophistication). The Haskell ecosystem is more interesting:
- QuickCheck was one of the first property-testing frameworks, using random genrators.
- SmallCheck came later, which enumerates data instead (e.g. testing a Float might use 0, 1, -1, 2, -2, 0.5, -0.5, etc.). That's cute, but QuickCheck tends to exercise more code paths with each input.
- LazySmallCheck builds up test data on-demand, using Haskell's pervasive laziness. Tests are run with an error as input: if they pass, we're done; if they fail, we're done; if they trigger the error, they're run again with slightly more-defined inputs. For example, if the input is supposed to be a list, we try again with the two forms of list: empty and "cons" (the arguments to cons are both errors, to begin with). This exercises even more code paths for each input.
- LazySmallCheck2012 is a more versatile "update" to LazySmallCheck; in particular, it's able to generate functions.
What are some alternatives?
jsverify - Write powerful and concise tests. Property-based testing for JavaScript. Like QuickCheck.
embedded-postgres - Java embedded PostgreSQL component for testing
greenlight - Clojure integration testing framework
testy - test helpers for more meaningful, readable, and fluent tests
vitest - Next generation testing framework powered by Vite.
ospec - Noiseless testing framework
LazySmallCheck2012 - Lazy SmallCheck with functional values and existentials!