librelist archives

« back to archive

Shoes-cucumber and mocks!

Shoes-cucumber and mocks!

From:
Tobias Pfeiffer
Date:
2011-09-19 @ 22:38
Hello everyone,

I'd like to update you on shoes-cucumber and shoes-mocks. It was the 
whyday project of Steve and I'm currently expanding on it. Neither Steve 
nor I am really sure where this is going (Steve, please correct me if 
I'm wrong) so I wanna present the (tiny) state of the art and some 
future ideas.

So where can you find this stuff?
https://github.com/PragTob/shoes-mocks Basically mocks whole shoes and 
its methods/elements in order to build some kind of structure on which 
you may run assertions.

https://github.com/PragTob/shoes-cucumber Defines cucumber steps for 
testing.

https://github.com/PragTob/shoes In the features directory you may find 
what I wrote up as features.

What does it look like?
Right now scenarios look something like this:

Scenario:Paragraphs should have a text
Given a Shoes application
When I append a paragraph with text "Hello world" to the main window
Then I should see a paragraph with text "Hello world"

So what it basically does is it builds up a shoes application and then 
makes assertions on it. This probably isn't what you want later on 
(please correct me if I'm wrong). I guess that later on you'd want 
something that takes an example program and then just executes it with 
all the mocking code and not the real shoes code. Then you could make 
assertions on it. The problem with this (as I see it) is that the 
shoes-mocks would always have to be up to date with the shoes 
implementation in order to be useful.

However I've never written a "testing framework" so I might be missing 
the obvious - so please enlighten me!

Is it clear what I mean? Sorry I'm tired and I got a little cold.. so 
good night and hopefully tomorrow I'll have some feedback and new ideas :-)

cheers and thanks to all of you!
Tobi

Re: [shoes] Shoes-cucumber and mocks!

From:
Steve Klabnik
Date:
2011-09-20 @ 15:14
> (Steve, please correct me if
> I'm wrong)

Nope, we're all trying to figure it out!


> So what it basically does is it builds up a shoes application and then
> makes assertions on it. This probably isn't what you want later on
> (please correct me if I'm wrong).

Sorta: there's two ways of doing testing:
http://martinfowler.com/articles/mocksArentStubs.html

We'll eventually want both ways. Mocks are easier to make right now.

Re: [shoes] Shoes-cucumber and mocks!

From:
Tobias Pfeiffer
Date:
2011-09-20 @ 16:24
On 09/20/2011 05:14 PM, Steve Klabnik wrote:
>> (Steve, please correct me if
>> I'm wrong)
> Nope, we're all trying to figure it out!
>
>
>> So what it basically does is it builds up a shoes application and then
>> makes assertions on it. This probably isn't what you want later on
>> (please correct me if I'm wrong).
> Sorta: there's two ways of doing testing:
> http://martinfowler.com/articles/mocksArentStubs.html
>
> We'll eventually want both ways. Mocks are easier to make right now.
Hey Steve,

sorry I haven't read the article yet (should rather read his article on 
distributed development as I got a paper on that due to sunday), but 
will definitely do so.

I just wanted to clarify what I meant. Rather than saying:

Given a shoes app
When I build up my whole damn shoes app here in "When" statements
Then I make I assertions

I think the following would be better:

Given my shoes app in 'my_shoes.rb'
Then I make assertions

or

Given my shoes app in 'my_shoes.rb'
When I make some actions like clicking or so
Then I make assertions

So that the mocking code, that is built now in shoes-mocks is used to 
"execute" the given program and build its "mock-model" of the program, 
though I'm not totally clear on how to do that. I think that this would 
be a direction we could go :-) But well later for now I stick to what's 
there and will try to wrap up pull requests this week or at the start of 
next week.

Thanks for your comments!
Tobi