我试图测量并增加测试用例的执行时间。我正在做的是:
void testAbc(){
startTime = System.nanoTime();
//no modification to the initialization part
//testing abc part is modified by placing it in a for loop to increase its
//execution time.
for(int i=0 ; i < 100; i++)
{
//test abc code goes here ...
abcTime += abc();
}
//assertion part wasn't modified
testEndTime = System.nanoTime - startTime;
}
通过重复测试部分,我认为abcTime和testEndTime之间的比率会增加(通过显着增加abcTime),然而,它根本不是我的意思,它是45-50%。
我的问题: