Data driven unit testing setup is created for this project. I have chosen excel for the data input as its easy to use and setup.
This project uses vite
and vitest
which requires node
(currently >=18). Other supported runtime environments should also
work but haven't tested. Feel free to modify and run with other environments.
- Run
npm install
to install the dependencies. In case you use any other package management tool please removepackage-lock.json
unless its supported. - Run
npm run build
to generate a compiled build insidedist
folder
- Rename file
tests/testCases.example.xlsx
totestCases.xlsx
. - Paste your test data in the excel sheet in the exact format. (DO NOT MODIFY EXCEL STRUCTURE)
- Run script
node scripts/prepareTestData.js
- A json file will be generated at
tests/testCases.json
- Run command
npm run test
Test case excel has following columns:
- name: name of the test case
- message: Actual SMS
- accountType: Expected account type (WALLET, BANK, CREDIT)
- accountName: Expected account name
- accountNumber: Expected account number
- transactionAmount: Transaction amount
- transactionType: Transaction type
- balanceAvailable: Available balance (if present)
- balanceOutstanding: Outstanding balance (in case of credit cards)
- merchantName: Name of the merchant (in case of UPI if upi reference number is not present)
- transactionId: Transaction reference number (currently only for UPI)
- On Android you can use SMS, Call - XML, PDF, CSV(Super Backup & Restore) to export inbox as csv
- Put the .csv files in
data/csv
- Run script
node scripts/prepareTestData.js
- 2 excel files will be generated
filtered.xlsx
andignored.xlsx
insidedata
- Append contents of
filtered.xlsx
totestCases.xlsx
Note: ignored.xlsx
might also contain transaction messages which library was not able to parse.