parser func split output per testcase
- split_output_per_testcase(regex, measurements, info_follows_regex)
It scans the test log using the provided python regular expression, and collects lines from the test log that are either before or after the lines that match the regular expression, and puts groups of lines into separate files, assigning each group of lines to each testcase in the measurements list.
These files are referenced by the HTML generator for tables that appear in the Jenkins interface for the job related to this run. Thus, the user can click on a link in the HTML table and see the text for just that test case.
See the output for Functional.jpeg for an example.
- regex - is a python regular expression string used to identify the testcase result data line
- measurements - is the list of testcase results
- (optional) info_follows_regex - if true, indicates that the data lines following a match should be used, rather than the data lines preceding the match.
Regex and measurements are usually the same as used with the process function.
Here is an example of standard formatting:
start lines data1 more data1 TEST 1 PASS data2 data2 foo bar TEST 2 FAIL more lines
In this case, if the regex was "TEST (\d+) (.*)$" the line would be split into the groups:
start lines more data1 TEST 1 PASSand
data2 data2 foo bar TEST 2 FAIL
These would be referenced as testcase "test1" and testcase "test2", in the json file (if that's how the parser labeled them - which is what the example below does).
Note that the groups of output from the log are assigned to testcases by matching the corresponding position in the list of testcases in the measurements data structure (which is a python list). That is, the block of text is assigned to the first testcase listed in measurements; the second block of text to the second testcase, etc.
By default, the data lines preceding a matching result line are coalesced into the block of lines for that testcase. However, some programs may format their data with the data following the result line. In this case, the argument info_follows_regex argument should be set to True.
Note: test_start.log may contain information that precedes the first test case, and test_end.log may contain information that follows the last test case.