Giter VIP home page Giter VIP logo

mageteststand's Introduction

MageTestStand

This tool is used to build a minimal Magento environment that allows to run PHPUnit tests for a Magento module on Travis CI.

It uses following tools:

Requirements

  • Main Database: defaults to 'mageteststand' (user 'root', blank password) This is the database Magento uses
  • Test Database: main database name with '_test' appended: 'mageteststand_test' (host, username, password and port are the same as the main database) This is the dummy database EcomDev_PHPUnit will use. Although you can configure this to use the original database, some tests (including fixtures) will behave differently...
  • You can override the default database credentials using following environment variables:
    • MAGENTO_DB_HOST
    • MAGENTO_DB_PORT
    • MAGENTO_DB_USER
    • MAGENTO_DB_PASS
    • MAGENTO_DB_NAME
  • In case you want to allow EcomDev_PHPUnit to use the main database instead of the test database you can set following environment variable to 1. This might be required if you're planning on writing integration tests.
    • MAGENTO_DB_ALLOWSAME
  • Environment variable MAGENTO_VERSION with valid Magento version for n98-magerun's install command

General usage

  • Set the environment variable MAGENTO_VERSION to the desired version, e.g. magento-ce-1.9.0.1
  • Set the environment variable WORKSPACE to the directory of the magento module
  • checkout your magento module
  • run curl -sSL https://raw.githubusercontent.com/AOEpeople/MageTestStand/master/setup.sh | bash as the build step, this will do everything automatically in a temporary directory
  • you can use the script contents as a build step for sure, but this way it's easier ;)

Travis CI configuration

Example .travis.yaml file (in the Magento module you want to test):

language: php
php:
  - 5.3
  - 5.4
  - 5.5
  - 5.6
  - hhvm
matrix:
  allow_failures:
  - php: 5.6
  - php: hhvm
env:
#  global:
#    - MAGENTO_DB_ALLOWSAME=1
#    - SKIP_CLEANUP=1
  - MAGENTO_VERSION=magento-ce-1.9.0.1
  - MAGENTO_VERSION=magento-ce-1.8.1.0
  - MAGENTO_VERSION=magento-ce-1.8.0.0
  - MAGENTO_VERSION=magento-ce-1.7.0.2
script:
  - curl -sSL https://raw.githubusercontent.com/AOEpeople/MageTestStand/master/setup.sh | bash
notifications:
  email:
    recipients:
      - [email protected]
    on_success: always
    on_failure: always

Jenkins configuration

  • create a new multiconfiguration project and check out your Magento Module.
  • create a new axis on the configuration matrix, named "MAGENTO_VERSION" and add the following values
magento-ce-1.9.0.1
magento-ce-1.8.1.0
magento-ce-1.8.0.0
magento-ce-1.7.0.2
  • Make sure that the configurations are build sequentiell, otherwise you might run into database issues!
  • use the following script as a shell build step curl -sSL https://raw.githubusercontent.com/AOEpeople/MageTestStand/master/setup.sh | bash

Unittest your Module directly from bash/zsh/shell

  • Set up your environment
export WORKSPACE=/full/path/to/your/module
export MAGENTO_VERSION=magento-ce-1.9.0.1

# if necessary
export MAGENTO_DB_HOST=somewhere
export MAGENTO_DB_PORT=somenum
export MAGENTO_DB_USER=someone
export MAGENTO_DB_PASS=something
export MAGENTO_DB_NAME=somename
  • Run MageTestStand:
curl -sSL https://raw.githubusercontent.com/AOEpeople/MageTestStand/master/setup.sh | bash

Misc

Skip cleanup

If you're running this in an CI environment that will delete the workspace after the run (e.g. Travis CI) you might not want to wait for this script to explicitely cleanup. Using SKIP_CLEANUP parameter you can make MageTestStand skip this step.

This parameter can be set via an environment variable (Travis CI supports that via env/global) or from command line:

export SKIP_CLEANUP=1

mageteststand's People

Contributors

bastianccm avatar fbrnc avatar sprankhub avatar schmengler avatar jadhub avatar mzeis avatar therouv avatar ktomk avatar

Watchers

James Cloos avatar Bryan "BJ" Hoffpauir 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.