I have a log file containing such output:
[mvn] Running com.mypackage.MyTest
...
[mvn] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 104.648 sec
[mvn] Running com.mypackage.MyNotExecutedTest
...
[mvn] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.525 sec
[mvn] Running com.mypackage.AnotherNotExecutedTest
...
[mvn] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.569 sec
[mvn] Running com.mypackage.FailedTest
...
[mvn] Tests run: 5, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 22.357 sec
...
whereas there can be any arbitrary number of lines where “…” is (e.g. stack trace, some debug output). What I want to achieve is a list of tests which hasn’t been executed:
com.mypackage.MyNotExecutedTest
com.mypackage.AnotherNotExecutedTest
So my approach was to grep for pattern “Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed” but then I would somehow need a smart way to find out what Test belongs the grep pattern.
Any good/elegant solutions here? Thanks!
Write an
awkscript which stores the latestRunningline, then prints the stored line if it seesTests run: 0.Edit: I took out the line beginning anchors, in order to correctly cope with indented input.