IB IBCS API Test Tool
An auto IBCS API response status checking tool which test tax, address and account module.
Getting Started
Cd to the cloned directory
cd autotest
Run mvn to install it as a local package
mvn clean install
To use API test code
The code style is designed to be like DSL flavour All the test cases are only checking the expected HTTP status code currently RM & PASSWORD should be in Base64 encoded string(default RM and Password) HOST_NAME can be auto figured out to be localhost name by code
val user = LogInfo(RM, PASSWORD)
HOST_NAME doTest {
try {
login (user)
runBlocking {
tax {
getTaxRates()
getTaxCountries()
getTax()
updateTaxDetails()
updateDomesticTax()
updateForeignTaxResidency()
}
address {
getAddress()
updateAddress()
}
accounts {
getAccounts()?.getFirstAccountDetails()
}
}
} finally {
logout()
}
}
To enable verbose information
All the test function accept a boolean flag to enable the http debug trace and print out response body(Default is false) For example
getTaxRates(true)
Test failure log
As the code is using coroutine to test each API module independently, in order to not interrupt each other's running status, the error handler registered in the coroutine context and only failure log will be printed out if the expected http status code can't be met, EVEN THOUGH JUNIT RUNNING RESULT IS OK Example printout as below, only related call trace can be shown here
10:26:57,543 ERROR BaseRunner:111 - Caught Error: 1 expectation failed.
Expected status code <200> but was <204>.
tax.TaxApi at line 29 <-- tax.TaxApi at line 13 <-- tax.TaxApiTest$taxApiCheck$1$1$1 at line 27 <-- tax.TaxApiTest$taxApiCheck$1$1$1 at line 11 <-- tax.TaxApiTest$taxApiCheck$1 at line 21 <-- tax.TaxApiTest$taxApiCheck$1 at line 11 <-- tax.TaxApiTest at line 18