Giter VIP home page Giter VIP logo

scala-e2e-testing's Introduction

scala-e2e-testing

This is a sample project that shows how to write truly end-to-end tests in Scala. It accompanies a talk I gave at Scalapeno 2014 titled "True End-to-End Testing in Scala".

Project

This project uses:

  • Sbt for the build and the test harness
  • Vagrant for running the tests in
  • Ansible for deployment and automation
  • Maven repository for artifact publishing and distribution

Scala App

The app itself is a finatra-based "micro-service" (choosing finatra was an arbitrary decision, it could just as easily be another server framework/library, like Play, plain finagle, spray, etc.).

The simple example app is a notes-taking web service, which allows storing, retrieving, searching for and translating notes, and is named memento. It exposes a REST API and returns JSON.

The app is composed of two modules: core and finatra. The core contains as much of the code as possible, and includes unit and integration tests. The finatra module is the server aspect, and only contains the controller/http layer. It's modeled so we can later on easily replace the server module and use a different library/framework as our http server (or something else completely). Our end-to-end tests reside in this module.

Infrastructure/Architecture

The architecture includes:

  • Ubuntu for the operating system
  • HAProxy as a load balancer
  • Nginx as an http server in front of the finatra app server (reverse proxy)
  • Elasticsearch as the datastore

Git Repositories

The scala app and ansible playbooks are joined here in the same git repository mainly for brevity and ease-of-use. It is suggested that real projects separate them into two repositories (or more if you have more then one deployable) to allow more flexibility, but this is up to you.

Requirements

To run the tests the following should be installed on your dev machine:

Running The Tests

There are 3 testing modes:

  • test for running unit tests
  • it:test for running integration tests
  • e2e:test for running end-to-end tests

To run all tests together:

$ cd ./memento
$ sbt test-all

Running Ansible Manually

If you want to test only the ansible code, run:

$ ansible-playbook -i ansible/inventories/vagrant ansible/site.yml

scala-e2e-testing's People

Contributors

orrsella avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.