Skip to content

Pragmatists/testing-examples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java application testing examples

BUILD

mvn clean package

RUN

You can launch the Java server within your IDE, by running the Application class at the root of your application's Java package. As it is a simple "Main" class, it is the easiest and quickest way to run and debug the application. If you prefer to use Maven, you can also run your application by typing:

mvn spring-boot:run

The application will be available on http://localhost:8080

TESTS examples

Application is tested using different kids of test:

  • Unit

src/test/java/com/pik/contact/unit/ContactTest.java

  • Unit with mocks

src/test/java/com/pik/contact/service/unit/ContactServiceTest.java

  • Integration test

src/test/java/com/pik/contact/service/integration/ContactServiceTest.java

  • Spring mvc test for REST endpoint

src/test/java/com/pik/contact/api/ContactControllerTest.java

  • Cucumber acceptance test

src/test/java/com/pik/contact/cucumber/RunCukesTest.java src/test/resources/com/pik/contact/cucumber/contacts.feature

  • GUI test with Selenium (with Page Object pattern)

src/test/java/com/pik/contact/gui/selenium/test/ContactsTest.java

alternative is to use Geb testing framework (https://github.com/geb/geb)

PIT is configured in maven src/pom/xmland can be run with: mvn pitest:mutationCoverage

  • Code coverage report by Jacoco

About

Examples of different test in Java application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 74.9%
  • HTML 9.9%
  • CSS 7.8%
  • JavaScript 6.5%
  • Gherkin 0.9%