Today with my colleague Luca Pucacco i've searched a method to detect which (junit) test are slow without any known or reasonable motivation. When you run a junit suite with eclipse you can see the execution time but you are not able to see an order.
So:
- export Test run with the gui; let's call this file SuiteOutput.xml
- Open a shell and write:
- cat SuiteOutput.xml | grep "<testsuite" | sed 's/\(.*time="\)\([^"]*\)\(.*\)/\2\1\2\3/' | sort -rg
With cat SuiteOutput.xml | grep "<testsuite" you are simply extracting the interesting rows
With sed s/..../../ we are going to substitute something. In details. Let's assume a row is in the form of:
<testsuite name="xxxTest" time="10.0">
The first group (.*time="\) is the first part of the row ( <testsuite name="xxxTest" time=" )
The second group ([^"]*\) is all before the " character ( the 10.0 string)
The last group is the rest ( ">)
The final row contains as the first information the execution time. The last operation is sorting these data by evaluating it like a number and not like a string.
Nessun commento:
Posta un commento