http://testing.etao.com/node/626
http://iamzhongyong.iteye.com/blog/1757180
Options :
public class SimulatorTest {
private final static Logger logger = Logger.getLogger(SimulatorTest.class);
@BeforeClass
public static void setUpBeforeClass() throws Exception {
logger.info("======================================");
logger.info(" Performance Test Start");
logger.info("======================================");
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
logger.info(" Performance Test End");
}
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
@Rule
public ContiPerfRule cpr = new ContiPerfRule();
@Test
@PerfTest(invocations=2, threads=2)
//@PerfTest(threads=20, duration=25000, rampUp=1000, warmUp=19000)
//@Required(max=20000, average=5000)
public void testExecute() {
int i = 0 ;
boolean runFlag = true;
do
{
i++;
callSimulator();
System.out.println(new Date() + " : i = " + i);
try {
Thread.sleep(3600000);//1 hour
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (i==8) runFlag=false;
}
while (runFlag);
}
public void callSimulator(){
try {
System.out.println("callSimulator");
} catch (Exception e) {
fail("Exception catched : " + e.getMessage());
}
}
}