OK, so it took me a while to figure this one out...
I would compile my project, would work fine, but when I ran the test, I would get "Object reference not set to the instance of an object" exception. I thought for the longest time it was my Mock object, but it wasn't.
The cause was because my method signature that I was stubbing was different than what I defined in my stub. So reflection couldn't find the method I was telling Rhino to stub.
Another interesting tidbit, the way I arranged my Given statements, I set an expectation on a Repository that method Get(int) would be called, then later in the Given I set the value of int. The mock was not prepared to handle "any" int, but only the one I set with the Expectation. Once I moved the assignment of int above the Mock Repository, it worked as expected.
As a side note, the order of the Given statements in the Feature determine the order the methods in the Spec are run. Interesting...
Showing posts with label cucumber. Show all posts
Showing posts with label cucumber. Show all posts
Wednesday, June 16, 2010
Wednesday, June 9, 2010
Cucumber Tags and CI
This is a cool post showing how to use the tagging feature of Cucumber to prevent certain tests from running. It also describes how to make Rake ignore those features and scenarios.
Subscribe to:
Posts (Atom)