Try-Catch Boundary testing
Code is easy, state is hard
Try-Catch is a test utility to automate labourious API call + database checking tasks when doing manual testing. The utility follows three simple steps to accomodate full end-to-end test of your API exposing web application:
- Initialize Database with wanted values
- Make an API call and check that the response from API matches expected
- Run a database query and assert that expected rows are returned.
The application has two modes:
- On web mode you can navigate to
localhost:7357with your browser and use the GUI to build, test and save your test cases.
- On CLI mode the application reads scenario JSON files from your
scenario-folderthat you have set in your
properties.yaml. These scenarios are run automatically and result are printed out to the console.
- Clone the repository.
- Set up you database connection strings in
db.ymlfile that you can find from the
- Run the application with
To deploy and distribute
- Clone the repository
- Create an
executable jarby running
./gradlew shadowJarfrom the command line.
- Move you
generated jarfile from
build/libsfolder to the installation location.
- Move the
conffolder to the installation location.
- Setup your database connection strings and scenario location settings in
- Run the application:
- In web mode:
java -jar trycatch-all.jar
- In CLI mode:
java -jar trycatch-all.jar cli
To develop further
The web application is built using
Ratpack on top of
Kotlin on the backend and
React on the frontend. API calls are made using
okHttp3 and responses are wrapped in
RxJava/RxKotlin observables. Database connection is handled by JDBC and
HikariCP, sessions are handled by
KotlinQuery. Database responses are again wrapped in
RxJava/RxKotlin observables. React components are loosely typed with the help of
Flow. Dependency injection framework in use is
Guice. Build processes are handled by
Gradle in the backend and
Webpack on the frontend.
To startup the
Ratpack server on dev mode you have two options (from the root folder of the project):
gradle run -t
If you don't have
./gradlew run -t
frontend development server you have two options(from the folder
npm run build
- Continuous with auto reload:
Note that you need to have run
npm install before starting developing on the frontend.