Hi
2007/3/29, Vincent Massol <vincent(a)massol.net>et>:
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?
Because I am not wokring with special tests - I am working with real
html files, mostly
exported from Office dcuments.
I have small tests to validate the simple stuff, but when I have a
"real-life" file a lot of
stuff can be different.
I'd say 1-3 lines should be enough no?
I depends.. if I am testing tables or styles 1-3 lines are not
enought. Have a look at this simple one:
String html = "<table>"
+ " <col/>"
+ " <col/>"
+ " <col/>"
+ " <thead>"
+ " <tr>"
+ " <th>Col 1</th>"
+ " <th>Col 2</th>"
+ " <th>Col 3</th>"
+ " </tr>"
+ " </thead>"
+ " <tbody>"
+ " <tr>"
+ " <td>Some content</td>"
+ " <td>in this table, not lots,
but</td>"
+ " <td>it varies.</td>"
+ " </tr>"
+ " <tr>"
+ " <td>This row has significantly more
words in it</td>"
+ " <td>Although not every cell does,
like the following cell is empty.</td>"
+ " <td> </td>"
+ " </tr>"
+ " </tbody>"
+ "</table>";
If you can tell me, how to do this in 3 lines.. than I am impressed.
You're writing unit tests right?
yes..
[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.
Because the "faked" html can not be compared to real life html.
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
This is what i am doing... but as I wrote in this answer, test can be huge.
WDYT? Am I not understanding what you're doing? :-) (very likely)
I a few words: Produce a good output (xwiki syntax) of html files,
which are exported from office documents.
Greets,
Christian