{"id":14969348,"url":"https://github.com/7ep/demo","last_synced_at":"2025-10-26T07:31:35.237Z","repository":{"id":50754827,"uuid":"149144183","full_name":"7ep/demo","owner":"7ep","description":"A demonstration of a web application with tests","archived":false,"fork":false,"pushed_at":"2021-08-27T13:26:45.000Z","size":14122,"stargazers_count":53,"open_issues_count":4,"forks_count":46,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-31T16:53:47.916Z","etag":null,"topics":["automation","bdd","behave","cucumber","database","demonstration","gherkin","gradlew","java","jenkins","python","selenium","tdd","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/7ep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/security_testing/README.txt","support":null}},"created_at":"2018-09-17T15:10:17.000Z","updated_at":"2025-01-07T01:36:41.000Z","dependencies_parsed_at":"2022-09-04T00:22:19.244Z","dependency_job_id":null,"html_url":"https://github.com/7ep/demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7ep%2Fdemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7ep%2Fdemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7ep%2Fdemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/7ep%2Fdemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/7ep","download_url":"https://codeload.github.com/7ep/demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238284888,"owners_count":19446748,"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","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":["automation","bdd","behave","cucumber","database","demonstration","gherkin","gradlew","java","jenkins","python","selenium","tdd","unit-testing"],"created_at":"2024-09-24T13:41:43.800Z","updated_at":"2025-10-26T07:31:29.282Z","avatar_url":"https://github.com/7ep.png","language":"Java","readme":"## Demo - demonstrates an application and tests\n\nThis is an application by [Coveros](https://www.coveros.com/) to demonstrate good\nsoftware practices.  As we say in agile... _Working software over comprehensive \ndocumentation_ ... but that doesn't mean we can't have pretty good documentation too. \n\n#### Quick Start:\n\n* Install [Java](https://www.java.com/en/download/) if you don't already have it.\n* Clone or [download](https://github.com/7ep/demo/archive/master.zip) this repo.  (if you download, unzip the file to a directory.)\n* On the command line in the top directory of this repo, run `gradlew apprun`\n* Visit the application with your browser at http://localhost:8080/demo\n\n#### Summary:\n\nDemo consists of a simple web application and tests.  Its goal is to provide \nan environment suitable for demonstration and practice in valuable development\ntechniques.  Some of the techniques exemplified are:\n* [Unit](https://github.com/7ep/demo/blob/master/src/test/java/com/coveros/training/authentication/RegistrationUtilsTests.java) [tests](https://github.com/7ep/demo/blob/master/src/test/java/com/coveros/training/library/LibraryUtilsTests.java) developed by [TDD](https://en.wikipedia.org/wiki/Test-driven_development) using [Junit](https://junit.org/junit5/) as a driver and [Mockito](https://site.mockito.org/) for mocks, with coverage reports.\n* [UI tests](https://github.com/7ep/demo/blob/master/src/ui_tests/behave/features/librarian_ui.feature) using [multiple frameworks](https://github.com/7ep/demo/tree/master/src/ui_tests)\n* [BDD](https://en.wikipedia.org/wiki/Behavior-driven_development) [tests](https://github.com/7ep/demo/blob/master/src/bdd_test/resources/library/check_out_a_book.feature) using gherkin\n  * [Cucumber](https://docs.cucumber.io/) tests, with reports\n  * [Behave](https://behave.readthedocs.io/en/latest/) UI tests that use [Selenium](https://www.selenium.dev/) web driver.\n* [Integration tests](https://github.com/7ep/demo/blob/master/src/integration_test/java/com/coveros/training/persistence/PersistenceLayerTests.java) that test the [H2 database](https://www.h2database.com/html/main.html)\n* [Database versioning](https://github.com/7ep/demo/blob/master/src/main/resources/db/migration/V2__Rest_of_tables_for_auth_and_library.sql), with [Flyway](https://flywaydb.org/)\n* Security analysis using [DependencyCheck](https://www.owasp.org/index.php/OWASP_Dependency_Check)\n* Hot-swap code with [Gretty](https://github.com/gretty-gradle-plugin/gretty)\n* Enhanced type system using [Checker Framework](https://checkerframework.org/)\n* See its [architecture](https://github.com/7ep/demo/blob/master/docs/dev_notes/architecture.txt)\n\n\nIts essential goals:\n* Just works, any platform.\n* As simple as possible\n* Minimal system requirements\n* Fast and easy to install and to run\n* High test coverage\n* Multiple business domains\n* Easy to maintain and improve\n* Well documented\n* High performance\n* Illustrates maximum number of techniques\n* Easy to get up to speed\n\n#### Table of contents:\n1. [Optional dependencies](#optional-dependencies)\n1. [Chromedriver installation notes](#chromedriver-installation-notes)\n1. [Python installation notes](#python-installation-notes)\n1. [To build and run tests](#to-build-and-run-tests)\n1. [To run the application](#to-run-the-web-application)\n1. [To run API and UI tests](#to-run-api-and-ui-tests)\n1. [Summary of relevant Gradle commands](#summary-of-relevant-gradle-commands)\n1. [The whole shebang - CI/CD pipeline](#the-whole-shebang---a-cicd-pipeline)\n\n###### Optional Dependencies\nIf you want API testing and Selenium testing, you will need\nto visit these links and download / install the applications found there.\n* [Python](https://www.python.org/downloads/)\n* [Chromedriver](http://chromedriver.chromium.org/downloads)\n* [Chrome internet browser](https://www.google.com/chrome/)\n\n---\n\n#### Chromedriver installation notes\nmake sure that the [Chromedriver](https://chromedriver.chromium.org/) executable is installed in one of the directories that is \non your path.  To see your path, type the following in a command line: \n\non Windows:\n\n    echo %PATH%  \n    \nOn Mac/Linux:\n\n    echo $PATH\n    \nIf you run the command, `chromedriver` on the command  line, you should get a result similar to this:\n\n    Starting ChromeDriver ...\n        \n#### Python installation notes\nPython can be downloaded [here](https://www.python.org/downloads/)\n\nTo run API tests and Selenium tests, an easy way to handle its \ndependencies is to use *pipenv*.  To get this installed, first download\n[get-pip.py](https://bootstrap.pypa.io/get-pip.py), and run the following on the command line:\n\n    python get-pip.py\n    \nThen,\n\n    pip install pipenv\n   \nAnd in the demo directory,\n    \n    pipenv install   \n   \n#### To build and run tests:\nOn the command line, run the following:\n\nOn Mac/Linux\n\n    ./gradlew check\n\nOn Windows\n\n    gradlew check\n\n#### To run the web application:\nOn the command line, run the following:\n\nOn Mac/Linux\n\n    ./gradlew apprun\n\nOn Windows\n\n    gradlew apprun\n    \nThen, head to http://localhost:8080/demo    \n    \n\n#### To run API and UI tests:\nNote: The app has to be [already running](#to-run-the-web-application) for these tests to pass, and you _need_\nto have installed [Python] and [Chromedriver].\n\nIn a new terminal, separate from the one where the server is running, run the following:\n\nOn Mac/Linux\n\n    ./gradlew runAllTests\n\nOn Windows\n\n    gradlew runAllTests    \n    \n#### Summary of relevant Gradle commands\n* gradlew coveros - show a cheat sheet of commands for Demo\n* gradlew apprun - runs the application\n* gradlew check - runs all tests possible with only dependency being Java 8.  No need for app to be running.\n* gradlew runAllTests - runs the whole set of tests**  \n* gradlew clean - cleans build products and installs pre-push hook. (see the file in this directory, pre-push)\n* gradlew runBehaveTests - runs the UI tests**\n* gradlew runApiTests - runs the API tests**\n* gradlew generateCucumberReport - runs cucumber and creates a nice-looking HTML report\n* gradlew pitest - runs mutation testing (see http://pitest.org/)\n* gradlew dependencyCheckAnalyze - analyzes security reports for the dependencies of \n  this project.  See https://www.owasp.org/index.php/OWASP_Dependency_Check\n* gradlew sonarqube - runs static analysis using SonarQube.  Sonarqube must be running - check http://localhost:9000\n* gradlew integrate - runs the database integration tests\n* gradlew startH2Console - Starts a console to examine the H2 database file.  (user and\n  password are empty, URL to use is jdbc:h2:./build/db/training)\n* gradlew \u003ctask 1\u003e...\u003ctask N\u003e taskTree - a utility that will show the task tree for a particular task\n\n\n  ** Requires the app to be running \n     (usually in another terminal) and all optional dependencies installed.\n    \n#### The whole shebang - a CI/CD pipeline\n\nDetails on building out a CI/CD pipeline are found in the \"docs/ci_and_cd\" directory.\nFor example, to set it all up on a [local Windows box](https://raw.githubusercontent.com/7ep/demo/master/docs/ci_and_cd/ci_and_cd_for_localhost.txt) \n\n###### Features of the pipeline:\n* A fully functioning and documented demonstration CI/CD pipeline using Jenkins.\n* BDD tests run with a report generated\n* Static analysis quality-gating using SonarQube\n* UI tests running on Chrome\n* Performance testing with Jmeter\n* Security analysis with OWASP's \"DependencyCheck\"\n* Complex commands wrapped simply using Gradle\n* Mutation testing with Pitest\n* Javadocs built\n\n\n\n---\n\n## Screenshots:\n![Jenkins pipeline](https://c2.staticflickr.com/8/7889/33202009658_11422b7f20_b.jpg)\n\n![Zap attach proxy](https://c2.staticflickr.com/8/7905/33202009438_8f367e20ec_o.png)\n\n![SonarQube analysis](https://c2.staticflickr.com/8/7823/33202009548_e678128200_b.jpg)\n\n![Running performance tests](https://c2.staticflickr.com/8/7854/47077017751_7e045f68dd_b.jpg)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F7ep%2Fdemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F7ep%2Fdemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F7ep%2Fdemo/lists"}