/demo

A demonstration of a web application with tests

Primary LanguageJavaMIT LicenseMIT

Demo - demonstrates an application and tests

Dependencies:

Optional Dependencies - needed for API testing and Selenium testing.

Java notes

It has to be Java 8. Don't use Java 10, it will error out because Mockito doesn't work with Java 10.

Python notes

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

python get-pip.py

Then,

pip install pipenv

And in the demo directory,

pipenv install   

To build and run tests:

On Mac/Linux

./gradlew check

On Windows

gradlew check

To run the web application:

On Mac/Linux

./gradlew appRun

On Windows

gradlew appRun

Then, head to http://localhost:8080/demo

To run API and UI tests:

Note: The app has to be already running for these tests to pass, and you need to have installed Python and Chromedriver.

On Mac/Linux

./gradlew runAllTests

On Windows

gradlew runAllTests    

Interesting links when the system is up:

Summary:

This is a tool for use in teaching software development best practices.
It consists of a simplistic web application. 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
  • 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

The whole shebang - a CI/CD pipeline

Follow the directions to create a Jenkins box and a UI-testing-box, per the instructions in docs. or, see the appliance notes below.

Features of the pipeline:
  • 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

Appliance

I've stored an appliance for running the pipeline here. Details for using the appliance are in the README there.


##Screenshots: Cucumber report Feature file Jenkins pipeline Webapp Zap attach proxy SonarQube analysis Running performance tests