Hi
I’d like to get some ideas and feedback as to how you would tackle the task of parsing this file.
I basically need the name and status of each subtests between “Starting Test” and “Finished Test”
The issue is that sometimes there is no “Finished” and it goes straight to start due to a test crash.
I started my script going line by line trying to tackle all the scenarios but the logic started to get complex and convoluted so I couldn’t help but think there must be a smarter approach to this.
Any ideas, code, pseudocode would be greatly appreciated.
myfile.log
****Starting test of test1
Message: Total Tests: 5
Log 23w4arg
Log 3958300
Message: PASS : test1SubTest1(): Pass
Log 23w4arg
Log efasf0
Message: PASS : test1SubTest2(): Pass
Log eafsarg
Log 3asf0
Message: FAIL: test1SubTest3(): Pass
Log 23asffg
Log 3fsaf00
Message: PASS : test1SubTest4(): Pass
Log 23fsafg
Log 3ag300
Message: PASS : test1SubTest5(): Pass
Message: Totals: 4 passed, 1 failed, 0 skipped
****Finished testing test1
Log 3ag3aw0
Log 3ag340
****Starting test of test2
Message: Total Tests: 3
Log 23w4arg
Log 3958300
Message: PASS : test2SubTest1(): Pass
Log 23w4arg
Log efasf0
Message: PASS : test2SubTest2(): Pass
Log 3ag340
****Starting test of test3
Log 234rg
Log 394w300
Message: PASS : test3SubTest1(): Pass
Log 23w4gdg
Log esdsf0
Message: PASS : test3SubTest2(): Pass
Log eafjhg
Log 3hj0
Message: FAIL: test3SubTest3(): Pass
Message: Totals: 2 passed, 0 failed, 0 skipped
****Finished testing test3
I would add in some checking for failed tests and stuff, but this should be enough to get you started.