JUnit中按照顺序执行测试方式
换成按字母排序
package com.netease.test.junit;
import org.apache.log4j.Logger;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
/**
* User: hzwangxx
* Date: 14-3-31
* Time: 15:35
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestOrder {
private static final Logger LOG = Logger.getLogger(TestOrder.class);
@Test
public void testFirst() throws Exception {
LOG.info("------1--------");
}
@Test
public void testSecond() throws Exception {
LOG.info("------2--------");
}
@Test
public void testThird() throws Exception {
LOG.info("------3--------");
}
}
/*
2014-03-31 16:10:25,360 0 [main] INFO - ------1--------
2014-03-31 16:10:25,361 1 [main] INFO - ------2--------
2014-03-31 16:10:25,362 2 [main] INFO - ------3--------
*/