Code Monkey home page Code Monkey logo

multicontextbddtalk's Introduction

Multi-context BDD Talk

Travis CI build status Code Climate Test Coverage

Demo for talk on how Behaviour Driven Development (BDD) can be used to test multiple contexts for modern websites separated into single page applications and REST APIs

This demonstrates how you can spin up a front-end and back-end container (which in reality would live in separate repositories) and run behavioural tests against one and both independently

Installation

For this demo to work you'll need Docker installed

Setup Swarm and deploy the Stack

docker swarm init
docker stack deploy -c docker-compose.yml bddtalk

You should see the following output if this works successfully

Creating network bddtalk_default
Creating service bddtalk_testrunner
Creating service bddtalk_frontend
Creating service bddtalk_backend

Use the application

Add a host entry

Because the behavioural tests rely on internal DNS within the Docker Swarm, you will need a local hosts file entry to point the Angular application at the REST API

127.0.0.1 backend

Accessing the applications

The container running the single page JavaScript application should be available locally on port 8888 (which is forwarded to port 80 in the container)

http://localhost:8888

The container running the REST API should display Swagger Open API documentation locally on port 9999

http://localhost:9999

Running the tests

There are scripts to run the tests within their respective containers. If these are non-executable you'll need to allow them to be run

chmod +x bdd-tests.sh

Behavioural tests

There is a shortcut script provided which will determine which container is the test runner then run the Behat tests on it

./bdd-tests.sh

Unit and Integration tests

cd backend && bin/phpspec run && cd -
cd backend && bin/phpunit --coverage-php data/coverage/phpunit_coverage.cov && cd -

multicontextbddtalk's People

Contributors

magickatt avatar

Watchers

Yanko Simeonoff avatar 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.