According to Sarah's answer, I would prefer another solution:
Setup like Sarah wrote, but the Teardown should add the test name and the execution time in a list.
So you can evaluate this list, for sorting or whatever. I don't know Ruby, so I don't know if it would work.
Here is some Java code for JUnit to explain my thoughts...
public class ExecutionTimeTest {
public static ArrayList<Double> executionTimes;
public double start;
@BeforeClass
public static void initializeList() {
executionTimes = new ArrayList<Double>();
}
@AfterClass
public static void printExecutionTimes() {
int i = 1;
for (Double time : executionTimes) {
System.out.println("Test " + (i++) + ": " + time);
}
}
@Before
public void startExecutionTime() {
start = System.currentTimeMillis();
}
@After
public void calculateExecutionTime() {
executionTimes.add(System.currentTimeMillis() - start);
}
}