On 20/08/2013 14:13, Nick Williams wrote: > I'm working on implementing bugzilla 55317. It's a pretty important > change (weaving) to a pretty import class (WebappClassLoader), so it > obviously needs some unit tests. However, I need some guidance: > > 1) I've never gotten all the existing tests to pass on my machine. > Last time I ran them it took 45 minutes (holy crap) and about 1/3 of > them failed. This is obviously something wrong with my configuration > and not with Tomcat. I'd like to avoid running all tests for this > reason and only run the particular tests I'm working on. How would I > do this? Is this even possible with Ant?
ant test -Dtest.entry=org.apache.catalina.TestClassToExecute svn co ... ant clean test should work on Windows, Linux and OSX for all three connectors. There are some tests that are 'fragile'. They need some time spent on them to figure out if they fail because the tests have a subtle timing bug (like the one I fixed this morning) or if the code does. One or two failures wouldn't surprise me. 1/3 failing suggests a problem with the environment. > 2) I'm not sure exactly how to approach testing this particular > feature. It's obviously not completely straightforward. This is > weaving we're talking about, so somehow I have to load a class and > weave it to test that it's properly woven. Suggestions on where to > get started / what tools to use? As much as I hate it, part of me is > saying that functional testing is really the best course here, in > which case this is all moot. Using weaving to add functionality that is easily tested to see if it is present? > 3) I'm not even sure how to approach testing in Tomcat in general. > I've seen a lot of "unit tests" that look more like integration > tests, at least according to my training. Are there general > guidelines for writing "correct" unit tests in Tomcat, or is in > generally accepted as long as it passes? Ideally, they should look like unit tests but a lot of the Tomcat code is not suited to that style of testing. There is nothing wrong with a little refactoring to aid testing but obviously there is a balance to strike. Any test that a) provides value and b) passes is likely to be accepted. As an aside, I'm fairly sure there is a huge amount of code duplication in the tests. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org