Java code to parse and read csv (comma separated values file). This is for validation.
For example , if a CSV has below values (All the values will be string,values can be null)
COMMUNITY_ID,USERS,ACCT,REG,LOGIN_DATE 08BFJMCEAFTA,10001,xyz,Y,09/08/17 0901BFJ569892A,10041,ABC,N,09/01,18 0901BFJMCEAFTA,10001,pop,Y,09/08/17 0901TYRTJK892A,5,,N,09/01/18
After parsing the reading the file, values should be stored in a Map,List or Java object which ever so that While reading I should be able to fetch values on basis of first column(COMMUNITY_ID)
I should be able to run below Validation using assertions after parsing(example use cases) :
- Validate if particular COMMUNITY ID (for eg. 08BFJMCEAFTA) exist in file
- If Yes, I should be able to validate any value for COMMUNITY ID 08BFJMCEAFTA. for example: -- validate No of users are 100041 ( I wil be using assertions for this) -- validate SYNC is yes ( I wil be using assertions for this) -- If values match my test case will PASS otherwise fails
P.S: Actual file will have 20-30 columns and rows can be between 0 and 200
Aucun commentaire:
Enregistrer un commentaire