Automated testing

Stateless testing

Stateful testing

Verification testing

Stateless testing

  • Ensure functional behavior
  • No context interactions
  • Single component tests

Unit tests

  • Junit
  • Mocking
  • Instance-oriented

Stateful testing

  • Ensure components behavior
  • Context interactions
  • Multiple components tests

Integration tests

  • Arquillian container
  • JUnit
  • Temporal data

Verification testing

  • Ensure end-to-end results
  • Interactions oriented
  • Performed over running system

Sanity tests

  • JUnit or manual tests
  • Shipped with the application
  • Whole system test

Let's code!!

Domain

- Domain data (entities)

- Data access (queries/repositories)

 

Services

- General purpose services

- Specific business services

- Batch jobs

Adapters

- Outside-world interactions

- End points and controllers

- Request processors (servlet)

- Importers / Integrators

Our business is based on giving customers

work spaces, in which they have the change to create privileged users

Context

Requirements

Functionality Input Output
Grant workspace access - user name: string
- rights for the user: array[string]
- OK
- ERROR on exception
- DUPLICATED if user is already related to workspace
Revoke workspace access - user name: string - OK
- ERROR on exception
- INVALID if user is not related to workspace
  • Create the REST services
  • Create the tests (stateless, stateful,...) for them
  • Integrate them !!

Continuous integration

Advantages

  • Improved integration
  • Automated build process
  • Automated deployment process
  • Automated validations

Jenkins CI

Features

  • Standalone or hosted
  • 350+ plugins
  • Source control integration
  • Open source
  • Widely supported
  • Highly customizable

Let's install it!!

Setup

  • Download jenkins WAR
  • Install mercurial plugin
  • Install gradle plugin
  • Install Copy Artifacts
  • Rename your WEB project
  • Create a job with your project
http://20.20.100.2:8000/apps


java -jar jenkins.war

Setup

  • Create an INSTALL job
  • Copy the WAR file from the other job
  • Install it to a remote machine 20.20.100.2
 %JBOSS_HOME%\bin\jboss-cli.bat 
    --connect 
    --controller=20.20.100.2:9990 
    --user=admin 
    --password=1234 
    --commands="deploy rest/build/libs/rest.war --force" 
Made with Slides.com