java - JUnit - Only record test time on the actual @Test function -


i noticing junit (on eclipse indigo @ least) reporting time of each test, including @before , @after setup , tear down functions.

i'd see time takes individual @test functions run, sans overhead setup , teardown.

don't me wrong, can see why including setup , tear down can important, purposes, separating them more beneficial.

these tests ought take matter of milliseconds. can without having write own/use apache stopwatch function!

// using junit 4, java 6, eclipse indigo

could there way overload/override junit reported time of test run manual #?

update:

it appears timing of function in private methods found here: https://github.com/junit-team/junit/blob/72af03c49fdad5f10e36c7eb4e7045feb971d253/src/main/java/org/junit/runner/result.java

since aren't protected, don't think can override start , stop times...

you can include time stamp first line in @test functions, , time stamp last line in @test functions. simple calculation of difference between 2 times show how long test take without setup , tear down parts.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -