On Mar 29, 2007, at 3:01 PM, Christian Gmeiner wrote:
Hi,
Why do you have to work with files? If I were you I'd work with content in memory, not files. That's much better because:
I load the files into memory :)
1/ The test and the input data are in the same location making it easier to understand and maintain the test
Adding about 150 lines (html and xwiki) makes the test file very very big. I have here laying much bigger html files (400 lines because of the <style> stuff) and I dont want to add them.
2/ No IO thus less complex (your post proves it)
But is very hard to add 150 lines of a String to the source. Have a look at:
Why do you need 150 lines? I'd say 1-3 lines should be enough no? You're writing unit tests right? [snip]
3/ Much faster
For me its no problem if the test is a little bit slower... the quality of tests are much important.
I agree that quality is the most important and I don't see how you'll get more quality by having a big file with fixed content. I would have though it would be better to have small chunks of text with lots of variations to test all cases. Also if you have a big text it means you'll have a single test. Not good for debugging/finding issues. So instead of doing: testParsing() with a big file I think it would be better to have: testParsingTable() testParsingParaggrpah() testParsingParagraphWhenBadlyFormed() etc WDYT? Am I not understanding what you're doing? :-) (very likely) Thanks -Vincent