Re: [racket-users] Are there any BDD testing frameworks for Racket?

2015-07-12 Thread WarGrey Gyoudmon Ju
I just finished my test framework, based on Scribble and RackUnit.
https://github.com/digital-world/DigiGnome
http://gyoudmon.org/~wargrey:DigiGnome

At the beginning, I focused on BDD,
later I noticed that BDD is a thinking patten more than a coding pattern,
and to not lose the purpose of communicating between coder and businessmen,
finally I choose Literate Programming rather than defining sugar syntaxes.

As a normal racket module, its output looks like hspec;
as a scribble module, it also embeds a perl prove-like report.

Also, there are two more test types for TODO and SKIP.

On Mon, Jul 13, 2015 at 1:08 PM, Alexis King  wrote:

> > 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.
>

-- 
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.


Re: [racket-users] Are there any BDD testing frameworks for Racket?

2015-07-12 Thread Alexis King
> 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.


Re: [racket-users] Re: Are there any BDD testing frameworks for Racket?

2015-07-12 Thread Rickard Andersson
I would encourage you to release this no matter the situation in this 
thread, Jack, as it sounds very interesting.


On Sun, 12 Jul 2015, Jack Firth wrote:


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.

--
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.



--
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.


[racket-users] Re: Are there any BDD testing frameworks for Racket?

2015-07-12 Thread Jack Firth
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.

-- 
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.


[racket-users] Is there a sequence combinator with a for*-like behavior?

2015-07-12 Thread Alexander D. Knauth
I'm wondering if there's anything I can use so that

(for/whatever ([(v1 v2 v3) (in-for*-sequence seq1 seq2 seq3)])
  )

Would be equivalent to

(for*/whatever ([v1 seq1] [v2 seq2] [v3 seq3])
  )

The reason I want this because with using for*, I'm constrained by the syntax, 
and I can't use apply when given a list of sequences that I want to combine in 
a for*-like manner.

If I understand correctly, this is similar to what cartesian-product from 
unstable/list does, so another way to put it would be asking if there is a 
sequence version cartesian-product.
http://docs.racket-lang.org/unstable/list.html#%28def._%28%28lib._unstable%2Flist..rkt%29._cartesian-product%29%29

Also a related question, is there a sequence equivalent to take on lists?

I found stream-tail and sequence-tail, which if I understand correctly are 
analogous to drop, but I couldn't find a take variant.


-- 
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.


Re: [racket-users] Are there any BDD testing frameworks for Racket?

2015-07-12 Thread Greg Hendershott
By the way eCukes is here:

  https://github.com/ecukes/ecukes

> ...  At most I've been tempted
> to poach some of the Elisp definitions underlying the Gherkin DSL and
> use them directly.

What I meant here is the step definitions in eSpuds:

  https://github.com/ecukes/espuds

-- 
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.