I'm writing a parser to generate JUnit-like files from a custom test format used in one of our products. The product is not writted in Java, so we cannot rewrite the tests to JUnit, but our build statistics tool only reads JUnit-format.
What I'd like some help with is evaluating if I'm doing this in a smart way, or if you can suggest a better one. Below is my current idea.
The files generated by our test tool look like this (part of acual output):
So each line is date, time, log severity, test facility and status message.
The approach I'm currently using reads the input into an arraylist of hashmaps, and removes header/footer and other "uninteresting" lines.
Then I iterate over the ArrayList, and depending on what is in the status field, I do different things.
However, I'm finding this increasingly difficult. The test is started with a line with a status "Test: <TESTNAME>...", then any output during the test, and then "Test: <TESTNAME> [ <TEST OUTCOME> ] ( <FAILED/TOTAL> )".
So I'd have to save a temporary var with the current test name, collect any lines in another temporary var, until I find the test name again.
Is this really a good strategy?
Also, is the JUnit-XML format specified somewhere? I've googled but haven't found anything. Since there are multiple Script-sections, I thought I'd create a separate <testsuite>, and thus file, for each. However, there are sometimes nested Scripts, how would you handle this?
[ July 03, 2008: Message edited by: Carl Pettersson ]