{"id":20686863,"url":"https://github.com/betrcode/java-system-test-example","last_synced_at":"2026-05-09T16:58:19.218Z","repository":{"id":140780720,"uuid":"124681068","full_name":"betrcode/java-system-test-example","owner":"betrcode","description":"Example of a system test using Java and RestAssured, using JUnit as a test driver.","archived":false,"fork":false,"pushed_at":"2018-05-25T17:49:28.000Z","size":62,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-07T00:39:20.966Z","etag":null,"topics":["docker","dropwizard","jar","java","junit","restassured","testing"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/betrcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-10T17:39:09.000Z","updated_at":"2023-03-17T19:27:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"63a2c04d-1613-484f-8ce8-7a9dfc5e9f98","html_url":"https://github.com/betrcode/java-system-test-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/betrcode/java-system-test-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betrcode%2Fjava-system-test-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betrcode%2Fjava-system-test-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betrcode%2Fjava-system-test-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betrcode%2Fjava-system-test-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/betrcode","download_url":"https://codeload.github.com/betrcode/java-system-test-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betrcode%2Fjava-system-test-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274744062,"owners_count":25341136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","dropwizard","jar","java","junit","restassured","testing"],"created_at":"2024-11-16T22:37:08.600Z","updated_at":"2026-05-09T16:58:19.186Z","avatar_url":"https://github.com/betrcode.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"System tests example using Java and RestAssured\n===============================================\n\nThis is some example code of how you can create system tests to test a REST service.\n\nThe purpose of these system tests are to test a deployed system, or a dockerized system.\nThis can be needed to check that you have configured and wired things correctly.\n\nWe drive the system tests with good old _JUnit_. There is not always need for a more abstract BDD framework.\n\nWe use the _RestAssured_ framework which I like to use to test HTTP REST services.\n\nTo load configuration from a Yaml files, we use _SnakeYaml_ which requires very little code to get a structured\nyml file into a Java object.\n\n## Deployed system vs Dockerized system\nA \"deployed system\" is a system which is deployed to real machines, virtual or directly on metal, preferrably using the same provisioning as you do on your production environment.\n\nA \"dockerized system\" is a system where all of the services in the system are started as Docker containers, usually using Docker Compose and often in the same machine.\n\n## How to run tests\n\nWhen you are coding, you want to run the tests from IntelliJ. \nTo make it work, you need to specify which config file the tests should use.\nEdit the run configuration of the `ExampleTest` and add `-DconfigFile=./config/example-config.yml` to _VM Options_.\n\nYou can also run the tests using Gradle command line: \n`./gradlew clean build -DconfigFile=config/example-config.yml`\n\nWhen you run the tests in a Continuous Delivery pipeline, you probably want to\nrun them from a published artifact (a jar in this case). Here's an example of how to do that:\n`java -DconfigFile=\"config/example-config.yml\" -cp system-tests.jar org.junit.runner.JUnitCore se.bettercode.systemtest.suite.FirstTestSuite`\n\n## How to spin up a Dockerized system and run tests against it\n```bash\nmax@max-x1:~/work/system-tests$ docker-compose -f docker-compose/docker-compose.yml up -d\nCreating network \"dockercompose_default\" with the default driver\nCreating myapp-database\nCreating myapp-rabbit\nCreating external-nasty-xml-stub\nCreating myapp\nmax@max-x1:~/work/system-tests$ ./gradlew clean build -DconfigFile=config/dockerized-config.yml\nStarting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details\n\n\u003e Task :test \n\nse.bettercode.systemtest.suite.FirstTestSuite \u003e se.bettercode.systemtest.ExampleTest.restEndpointIsOK PASSED\n\nBUILD SUCCESSFUL in 13s\n4 actionable tasks: 4 executed\nmax@max-x1:~/work/system-tests$ docker-compose -f docker-compose/docker-compose.yml down\nStopping myapp ... done\nStopping myapp-rabbit ... done\nStopping external-nasty-xml-stub ... done\nStopping myapp-database ... done\nRemoving myapp ... done\nRemoving myapp-rabbit ... done\nRemoving external-nasty-xml-stub ... done\nRemoving myapp-database ... done\nRemoving network dockercompose_default\nmax@max-x1:~/work/system-tests$ \n\n```\n\n## How to build jar\n`./gradlew clean jar`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetrcode%2Fjava-system-test-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbetrcode%2Fjava-system-test-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetrcode%2Fjava-system-test-example/lists"}