Actions

Proposals/Done/Acceptance testing: Difference between revisions

From Mahara Wiki

< Proposals‎ | Done
Line 10: Line 10:
** Selenium Server (optional).
** Selenium Server (optional).
* Instructions to run a test
* Instructions to run a test
# Install a Mahara site
 
# Launch the web server for testing
Step 1. Install a Mahara site
The current branch of mahara with behat is on [[[email protected]:~ngson2000/mahara/ngson2000s-mahara.git]]
Launch the web server for testing
For example, launch the built-in PHP server
For example, launch the built-in PHP server
  cd <mahara docroot>
  cd <mahara docroot>
  php -S localhost:8000
  php -S localhost:8000
The URL of the test site will be http://localhost:8000
The URL of the test site will be http://localhost:8000
# Edit htdocs/config.php adding the following lines
 
Step 2. Edit htdocs/config.php adding the following lines
  // Behat config
  // Behat config
  $cfg->behat_dbprefix = 'behat_'; // must not empty
  $cfg->behat_dbprefix = 'behat_'; // must not empty
  $cfg->behat_dataroot = '<path to behat dataroot>';
  $cfg->behat_dataroot = '<path to behat dataroot>';
  $cfg->behat_wwwroot = '<URL to the test site>';
  $cfg->behat_wwwroot = '<URL to the test site>';
# Edit test/behat/behat.yml changing the base_url  
 
Step 3. Edit test/behat/behat.yml changing the base_url  
  base_url: <URL to the test site>>
  base_url: <URL to the test site>>
# Initilise the behat environment
 
Step 4. Initilise the behat environment
  php test/behat/scripts/init.php
  php test/behat/scripts/init.php
# Run the selenium server in another terminal(optional)
 
Step 5. Run the selenium server in another terminal(optional)
  java -jar /path/to/your/selenium/server/selenium-server-standalone-2.NN.N.jar
  java -jar /path/to/your/selenium/server/selenium-server-standalone-2.NN.N.jar
# Run a test suite
 
Step 6. Run a test suite
  cd test/behat
  cd test/behat
  bin/behat
  bin/behat
This will run tests for all features in the folder test/behat/features
This will run tests for all features in the folder test/behat/features

Revision as of 14:50, 22 September 2014

Introduction

Like Moodle [1], we integrate Behat, a behavioural driven development (BDD) tool for describing Mahara's features and automatically testing them.

Getting started guide

This guide will show you how to start running Behat tests on a Mahara site

  • Requirements
    • PHP 5.3+
    • A standalone web server. If you are using PHP 4+, you can run the built-in PHP server insteads.
    • Selenium Server (optional).
  • Instructions to run a test

Step 1. Install a Mahara site The current branch of mahara with behat is on [email protected]:~ngson2000/mahara/ngson2000s-mahara.git

Launch the web server for testing

For example, launch the built-in PHP server

cd <mahara docroot>
php -S localhost:8000

The URL of the test site will be http://localhost:8000

Step 2. Edit htdocs/config.php adding the following lines

// Behat config
$cfg->behat_dbprefix = 'behat_'; // must not empty
$cfg->behat_dataroot = '<path to behat dataroot>';
$cfg->behat_wwwroot = '<URL to the test site>';

Step 3. Edit test/behat/behat.yml changing the base_url

base_url: <URL to the test site>>

Step 4. Initilise the behat environment

php test/behat/scripts/init.php

Step 5. Run the selenium server in another terminal(optional)

java -jar /path/to/your/selenium/server/selenium-server-standalone-2.NN.N.jar

Step 6. Run a test suite

cd test/behat
bin/behat

This will run tests for all features in the folder test/behat/features