Getting access to Context objects at runtime.

25 views
Skip to first unread message

Mike Charlton

unread,
Sep 15, 2011, 1:54:03 AM9/15/11
to igloo-...@googlegroups.com
I've been playing around with Igloo for a while now and I really like it.
Thanks for all the hard work! I have a request, though. I would
like to be able to get access to the Context objects that
are run through the test runner.

I'm playing around with some ideas for literate programming and
I've written my tests to be XP style stories. I have one Context
per story. In the Context, I want to declare a string containing
the English description of the story, a float containing the
effort of the story and a bool describing if the story has been
completed or not.

Then, similar to the test runner, I want to go through the
classes and create a report which lists the stories
that are in the current test executable (the iteration),
shows which stories are completed, whether all
the tests pass and also a "velocity" for the iteration so far
(essentially, the number of effort points divided by
the time that has elapsed since the start of the of the iteration).

Anyway, I can think of a number of ways to do this, but they
all require modifications to igloo. Although my use for this
functionality is admittedly a bit strange (doing all my planning
and project tracking in the test code ;-) ), I think the
functionality would be generally useful so I'm wondering
what your thoughts are, or if you were already planning
to do something that would enable this.

MikeC

Joakim Karlsson

unread,
Sep 15, 2011, 3:07:04 AM9/15/11
to Igloo-testing
I have to admit that's a scenario we haven't discussed.

We have discussed creating a way to register a test listener that gets
called for each context/spec during a test run.

I have also been thinking of adding attributes such as "ignore" or
"pending" to contexts and specs (though I have no idea how that would
look at the moment).

I don't know if we could add a way to add general attributes. But if
we could, perhaps those could be passed to the test listener, which in
turn could be used to create a report like the one you're talking
about.

Like I said, right now I don't know how this could be made to work
without being too clumsy.

If you have any idea how you would like it to work, don't hesitate to
fork so we can take a closer look.

/Joakim

Mike Charlton

unread,
Sep 15, 2011, 4:04:21 AM9/15/11
to igloo-...@googlegroups.com
On 15 September 2011 16:07, Joakim Karlsson <joa...@jkarlsson.com> wrote:
> If you have any idea how you would like it to work, don't hesitate to
> fork so we can take a closer look.

I have a couple of ideas. I think trying to pass arbitrary attributes
to the TestListener would be difficult, but you might be able to
at least pass the Context objects to the TestListener
before/after the tests are run. Then if you could store
lists of arbitrary data on the results objects you could
create a report for it. But none of this is necessarily
easy with the current implementation.

For my purposes it might just be easier to write a different
test runner that dealt with subclassed Context objects.
The information I'm collecting isn't really related to the
running of the tests, only the result.

Hopefully I'll have some time this weekend to try some
things (though I'm struggling with a hardware issue at the
moment).

Anyway, thanks again for igloo. I'm enjoying working with it.
I'm retired from the software world and have been puttering
away with Ruby for the last 5 years. For my C++ project
I was looking for something that would give me the same
comfort level as rspec. Igloo is well on it's way. All I
need now are mocks ;-)

On a kind of unrelated note, I really enjoyed watching your
Game of Life kata and I've recommended it to several
people who are new to TDD/BDD.

MikeC

Reply all
Reply to author
Forward
0 new messages