> Short version: I think it's a good idea. I don't know of anything like > that, yet. I'm interested in BDD, but not so much a Gherkin style DSL.
Yeah, I currently have no plans to implement something like Gherkin. All I care about for the time being is spec-style `describe`, `context`, `it`, and similar. I don’t really use Cucumber for much, but it would obviously be possible to build a DSL on top of a spec-style framework. > Out of curiosity, what are you looking to test? If it's an HTTP api, I've got > a ton of useful testing tools for that that I was just thinking of making > into a package. It’s nothing HTTP-related, just some plain old Racket code. I’m really just interested in having the ability to write spec-style tests in general. That said, I’m sure it would be nice to have that sort of thing in a package, anyway, so I’d still be interested to see what you have! Also, since Sam pointed out on IRC that some people might not know what BDD is, I’ll include a brief demonstration of what I’d sort of like to build. It’s mostly just a different API for writing tests that tries to be a little more declarative. For example, testing the `+` function might look like this: (describe "+" (context "when a single argument is provided" (it "is the identity" (expect (+ 1) (to equal? 1)) (expect (+ -1) (to equal? -1)))) (context "when multiple arguments are provided" (it "adds numbers" (expect (+ 1 2) (to equal? 3)) (expect (+ 1 -2) (to equal? -1))))) If a test fails, it provides some nicely-formatted information about the test and its context. For example, consider adding the following bogus test: (describe "+" (context "when a single argument is provided" (it "is the identity" (expect (+ 1) (to equal? 1)) (expect (+ -1) (to equal? 1)))) ; oops, typo (context "when multiple arguments are provided" (it "adds numbers" (expect (+ 1 2) (to equal 3)) (expect (+ 1 -2) (to equal -1))) (it "returns a positive number" ; this is just wrong (expect (+ 3 -5) (to be positive?))))) That might cause the following output: + ├── when a single argument is provided │ ✘ is the identity │ └── when multiple arguments are provided ✔︎ adds numbers ✘ returns a positive number Failures: 1) + is the identity when a single argument is provided Expectation: (expect (+ -1) (to equal? 1)) Expected: 1 Got: -1 ; ./sample-spec.rkt:12:6 2) + returns a positive number when multiple arguments are provided Expectation: (expect (+ 3 -5) (to be positive?)) Expected: value that satisfies ‘positive?’ Got: -2 ; ./sample-spec.rkt:18:6 3 examples, 2 failures, 0 pending The output format and the expectation syntax is entirely theoretical and subject to change, but that’s the basic idea. The good news is, I think all the basic operations can be defined in terms of existing RackUnit constructs, so the only difficulties would be implementing the output format and the expectations system. Ideally, though, this would provide some more semantic information both in how tests are written and in test failure messages. Alexis -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.