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: WEB and CLI
- 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 yourproperties.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 theconffolder. - Run the application with
./gradlew run.
- Clone the repository
- Create an
executable jarby running./gradlew shadowJarfrom the command line. - Move you
generated jarfile frombuild/libsfolder to the installation location. - Move the
conffolder to the installation location. - Setup your database connection strings and scenario location settings in
db.ymlandproperties.yml - Run the application:
- In web mode:
java -jar trycatch-all.jar - In CLI mode:
java -jar trycatch-all.jar cli
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):
- Standard:
gradle run - Continuous:
gradle run -t
If you don't have gradle installed:
- Standard:
./gradlew run - Continuous:
./gradlew run -t
To start frontend development server you have two options(from the folder src/ratpack/static):
- Standard:
npm run build - Continuous with auto reload:
npm start
Note that you need to have run npm install before starting developing on the frontend.
MIT