????????????????????
???????????? ???????[ 2013/1/10 10:30:34 ] ????????
????Feed4JUnit ????????????????????????? – ??? (CSV ???? Excel )???????????????????
????????????÷????? Feed4JUnit ????????????????? Feeder.class??????????????????????????????????д?????????????????????????????????????????????
????1?????????????????????????? @RunWith(Feeder.class) ??
????2?????????? @Test ???????????????????
????3????? @Source ???????????????????????
????2.1 ??????????excel??csv????
????1????????????????′??? data.xls ??data.csv?????????????л?????????????????й????в??????????????
????2???????????????????????????????????????? @Source("Data.xls")??Excel ?е??????????????л?????????????????????????λ?????????????????????????λ??????????????????塣????????е? user ?е??????????????????????????????У?pw ?е??????????????????????????????????????й????У??????? Excel ????ж????У????????У??????????λ????????????????????У???а?????????????????????У?????????? Excel ?е?????н?????????????????????? Java ?е?????????????????????????????????????С??????????????????????????????λ?ò?????????
import static org.junit.Assert.assertEquals ;
import org.databene.benerator.anno.Source;
import org.databene.feed4junit.Feeder;
import org.junit.Test;
import org.junit.runner.RunWith;
import sample.junit.code.*;
@RunWith (Feeder.class )
public class Feed4junitSample {
@Test
@Source( "Data.csv" )//CSV source
public void testAccessCheck_CSV(String userName?? String pw?? boolean expected) {
assertEquals(expected?? UserAccess. accessCheck(userName?? pw));
}
@Test
@Source( "data.xls" )//Excel source
public void testAccessCheck_Excel(String userName?? String pw?? boolean expected) {
assertEquals(expected?? UserAccess. accessCheck(userName?? pw));
}
}
???????н?????£?
????3???????????????
?????????Feed4junit????????????????????????????????????????????????????????????????£?
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11