New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experiment with ShoesSpec #115
Conversation
|
I think we're going to have to start moving a lot of the mocking stuff from the spec files (where you normally have them with RSpec) to the actual mock files, for this to work. Also, I suspect that we're going to need a lot of |
|
I played with it a little today and I think it'll be fine. Making the gui mock into a null object made almost all of the Line specs pass with the Swt backend. I'll push that code soon. Fundamentally, we just have to make sure that the backend classes share the same interface, and then only use that interface in the specs. Then the objects should duck type and make us happy. We just don't have a compiler to help us ;) |
|
Are you sure w/ the "null object" that you have no false-positives in the Just being wary of the fabled "null object" in general. Could be ok here. Kindest Regards, On Fri, Sep 7, 2012 at 4:25 PM, Eric Watson notifications@github.comwrote:
|
Well, in this particular case, I'm pretty sure, since I have been testing it manually in apps. However, in general, I am skeptical of the null object. This was just an experiment to see how little code I would have to change to get specs running (answer: very little). I'll try substituting "real" objects for the test doubles next. Thanks for keeping us honest :) |
|
I'm also skeptical of the null object, although it is highly dependent on the context... Using straight up real objects could be cumbersome as well since probably that would really create gui elements while running the test suite and make it noticeably slower... So I don't know :-/ |
|
Ok. The point of a ShoesSpec is to help us be confident that all of the backends behave "the same". So it makes sense that we should use as much of the real stack as possible. I have done only a brief experiment with using real objects in place of mocks (usually its the App objects), but it will work fine. Not _too_ much more work than the null object route. It doesn't seem too slow, either ;) A great side effect of this exercise is that it exposes a bunch of places where our code is too tightly coupled. Listen to the tests! |
|
Sounds good :-) Would have to try it out myself though. I'm not too much concerned about speed though... we can worry about that when it becomes a problem. Because generally, I'm more happy with tests that really test something than fast tests. Point taken, thanks Eric! |
|
If you want to check out the specs, I've pushed up to my shoesspec branch the two strategies.
I think strategy 2 (real Shoes objects) is the way to go (not much harder), but check it out yourself and see what you think. Remember that,
|
|
Just an update: I'm now down to only 59 failures out of 561 specs when I run the whole suite with the Swt backend. The specs do take about 10 times as long to run as when they're run with the mock backend :( Still, in my limited number of runs, that run time is only 10 to 23 seconds, vs 1 to 2 seconds for the mock suite. |
|
HI Eric. Where is your code again? I want to see and understand. Peter Fitzgibbons On Sat, Sep 15, 2012 at 11:54 PM, Eric Watson notifications@github.comwrote:
|
Yep, that's the classic problem with integration tests. Don't mean it's not worth it, but thank $DIETY for Travis! |
|
@pjfitzgibbons it's on the shoesspec branch of wasnotrice/shoes4. This is the latest commit. |
|
@pjfitzgibbons Actually, just view this pull request on github and you can see all of the relevant commits ;) |
|
@davorb I'm updating TextBlock specs to run using Swt backend. It seems to me that the "font styles" specs are not actually implemented in Swt, so I should mark them as not implemented in Swt. Does that sound right? |
This commit deletes a spec that describes a behavior that doesn't actually occur in the code.
Also refactor Check and Radio specs to eliminate duplication
|
Current status: getting closer! |
|
:D |
|
Sorry for the late response! Been really busy... Yeah, that's fine. In fact, I did the same thing when I converted I'll see if I can push that code to the repo tonight...Davor Babic Eric Watson wrote:
|
Also add MSpec-style guard to only run a group of specs when using a given backend
rake spec:swt Run all Swt backend isolation specs and all
integration specs using the Swt backend
rake spec:swt:integration Run all integration specs using the Swt
backend
rake spec:swt:isolation Run all Swt backend isolation specs
When passed a class/module name as an argument, each of these commands
(like the other spec commands) will run only those specs that mention
the argument in the description, e.g. rake spec:swt[Arc] will run both
isolation and integration specs for Arc.
|
As of 634a1cd, all Shoes specs pass using the Swt backend as well as the mock backend. I think we have a ShoesSpec! I have updated the rake commands so you can choose which specs to run. Now we have: Give it a whirl. What do you think? |
|
Wow awesome! =) I'll give it a whirl either today or tomorrow! Thank you @wasnotrice ! |
|
yep, I got green! Peter Fitzgibbons On Fri, Sep 21, 2012 at 5:25 AM, Tobias Pfeiffer
|
|
@wasnotrice Great work! Thanks! |
|
Later then promised, but works beautifully and is still fast. Thank you so much! |
We have discussed using the specs in spec/shoes as a sort of ShoesSpec, like RubySpec for Shoes.
This commit modifies the
spec:swtRake task so that, in addition to the running the swt-specific tasks it also runs the Shoes DSL specs with the Swt backend.Currently almost all of the Shoes DSL specs fail with the Swt backend. Mostly (at this point anyway) this is because of mock objects receiving unexpected messages.
Let's have a conversation about how to make these specs work well. @alindeman, I think you had some ideas about this at one point?