This is an application used by Coveros to demonstrate a multitude of good software practices.
- Download this repo: https://github.com/7ep/demo/archive/master.zip
- unzip the file to a directory.
- On the command line in that directory, run gradlew check , then gradlew appRun
- visit the application at http://localhost:8080/demo
It has to be Java 8. Specifically, Mockito and Checker Framework are reliant on the system using Java 8. Mockito issue and Checker Framework issue
make sure that the Chromedriver executable is installed in one of the directories that is on your path. To see your path, type the following in a command line:
on Windows:
echo %PATH%
On Mac/Linux:
echo $PATH
To run API tests and Selenium tests, an easy way to handle its dependencies is to use pipenv. To get this installed, first download get-pip.py, and run the following on the command line:
python get-pip.py
Then,
pip install pipenv
And in the demo directory,
pipenv install
On the command line, run the following:
On Mac/Linux
./gradlew check
On Windows
gradlew check
On the command line, run the following:
On Mac/Linux
./gradlew appRun
On Windows
gradlew appRun
Then, head to http://localhost:8080/demo
Note: The app has to be already running for these tests to pass, and you need to have installed Python and Chromedriver.
On the command line, run the following:
On Mac/Linux
./gradlew runAllTests
On Windows
gradlew runAllTests
- http://localhost:8080/demo - the main application
- http://localhost:8080/demo/console - the database viewer - use URL of jdbc:h2:mem:training and no user or password
-
gradlew appRun - runs the application
-
gradlew check - runs all tests possible with only dependency being Java 8. No need for app to be running.
-
gradlew runAllTests - runs the whole set of tests**
-
gradlew clean - cleans build products and installs pre-push hook. (see the file in this directory, pre-push)
-
gradlew runBehaveTests - runs the UI tests**
-
gradlew runApiTests - runs the API tests**
-
gradlew generateCucumberReport - runs cucumber and creates a nice-looking HTML report
-
gradlew pitest - runs mutation testing (see http://pitest.org/)
-
gradlew dependencyCheckAnalyze - analyzes security reports for the dependencies of this project. See https://www.owasp.org/index.php/OWASP_Dependency_Check
-
gradlew sonarqube - runs static analysis using SonarQube. Sonarqube must be running - check http://localhost:9000
-
gradlew fastIntegrationTest - runs the database integration tests
-
gradlew startH2Console - Starts a console to examine the H2 database file. (user and password are empty, URL to use is jdbc:h2:./build/db/training)
-
gradlew <task 1>... taskTree - a utility that will show the task tree for a particular task
** Requires the app to be running (usually in another terminal) and all optional dependencies installed.
Demo consists of a simple web application and tests. Its goal is to provide an environment suitable for demonstration and practice in valuable development techniques. Some of the techniques exemplified are:
- Unit tests using Junit and Mockito, with coverage reports.
- BDD-style tests using gherkin
- Integration tests that test the database
- Database versioning, with Flyway
- Uses H2 database to simplify operation
- Security analysis using DependencyCheck
- Nulls not allowed by using Checker Framework
- Uses Gretty which allows us to hot swap Java code at runtime.
Its essential goals:
- Just works, any platform.
- As simple as possible
- Minimal system requirements
- Fast and easy to install and to run
- High test coverage
- Multiple business domains
- Easy to maintain and improve
- Well documented
- High performance
- Illustrates maximum number of techniques
- Easy to get up to speed
Follow the directions to create a Jenkins box and a UI-testing-box, per the instructions in docs. or, see the appliance notes below.
- Instructions for setting up virtual machines (with VirtualBox).
- A fully functioning demonstration CI/CD pipeline using Jenkins.
- Incorporates static analysis using SonarQube
- Zap attack proxy security analysis
- UI tests running on Chrome
I've stored an appliance for running the pipeline here. Details for using the appliance are in the README there.