Giter Site home page Giter Site logo

hydpublic / batect-sample-ruby Goto Github PK

View Code? Open in Web Editor NEW

This project forked from batect/batect-sample-ruby

0.0 2.0 0.0 27 KB

A Ruby-based sample application for batect (https://github.com/charleskorn/batect)

Ruby 89.86% Shell 9.13% HTML 1.01%

batect-sample-ruby's Introduction

batect-sample-ruby

Build Status

A sample service with two dependencies (a database and another service) with batect-based build and testing environments.

Building, testing, running etc.

Run ./batect --list-tasks to see the available commands and their descriptions, then ./batect <task> to run <task>.

All of this is controlled by batect.yml, and it shows a number of common patterns you might adopt in your own application - things like tasks for different kinds of tests, a task to run the application, and a task to start a shell in your build environment.

Tests

There are three kinds of tests:

  • Unit tests (stored under spec/unit): exactly what it sounds like. This might also include contract tests.

  • Integration tests (stored under spec/integration): tests for individual components (eg. single methods or classes) that interact with an external dependency and that require that dependency (or a fake) to be running for the tests to pass. An example of something to test here is interactions with our database.

  • Journey tests (stored under spec/journey): tests that exercise one or more user journeys. Some people might call these functional tests or end-to-end tests. These tests require all external dependencies (or appropriate fakes) to be running for the tests to pass, and interact with the service as a user / consumer would (using its HTTP interface, for example). As these tests only use the external HTTP API, these could be written in a different language, but we use Ruby for everything for simplicity.

Important notes

As this is just a sample application used to demonstrate how to use batect, the code itself is definitely not production ready. A number of shortcuts have been taken, including:

  • There is no error checking or validation
  • There is no logging
  • Nothing is configurable (eg. port used for HTTP and database connection string are hard-coded)
  • The database schema is hardcoded into the database Docker container (ideally some kind of schema migrations system would be in place)
  • There are no consumer-driven contract tests in place
  • Many of the unit and integration tests are very simple, and many test cases are missing
  • Many things could be more efficient or done in a more maintainable way

Links

batect-sample-ruby's People

Contributors

charleskorn avatar

Watchers

James Cloos avatar  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.