On 10/30/07, Christopher Schultz <[EMAIL PROTECTED]> wrote: > All, > > I recently added a JIRA enhancement and included a patch. I want to add > a unit test (for my changes to the LinkTool) to the existing tests, but > I'm having trouble doing so. > > First, the test system itself is cumbersome (to me). It tries to start > servlet container instances and stuff like that, and anytime something > goes wrong, that server stays running and I can't run a test without > manually stopping it (which was a hunt to figure out how to do it properly).
yeah, we should make that "ant test.stop" target a little more obvious.. sorry. > Second (and more importantly, since I hacked the test script to ignore > all the stuff that wasn't working for me), what is the best way to > represent the standard servlet container objects when doing unit testing? not sure. though i imagine people have already written mocks (or whatever the term is) for this stuff. i'm still trying to educate myself on this testing stuff too. most of the test code there was not written by me, and i'd be lying if i said i understood it all. > I started by looking at the existing ViewToolTests (which already has a > testLinkTool method) and I couldn't make head or tail of what's going > on. It looks like the test is attempting to use the on-the-fly-deployed > webapp for a real roundtrip, and then the output is tested against > expected output. Is there no good way to test the component directly? i'm sure there is. and if/when you/we/whoever finds it, we can just add those tests alongside, rather than try and work them into the existing framework or replace the existing ones. i don't mind having competing sets of tests. the more, the merrier. > I was expecting to actually instantiate a LinkTool, configure it > (probably using mock objects) and then poke and prod it to make sure > that it behaves the way I expected it. That does not appear to be > possible using the existing libraries and infrastructure. > > Does anyone have any good ideas for how to do this? two ideas: 1) find out what other projects with similar needs use. 2) search google for libs to support this > -chris > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
