Git Product home page Git Product logo

prestashopautomationframework's Introduction

Table of Contents

PrestaShopAutomationFramework

This is a framework for writing functional tests for PrestaShop.

The tests are written in PHP, and communicate with a browser using Selenium.

Rudimentary API doc is on the gh-pages branch.

Framework Setup

The Framework should be working on any major platform where PHP runs.

It is being developed primarily for Linux, but special efforts are made to keep it compatible with Windows.

Windows compatibility is, however, much less tested (feedback welcome!).

The procedure to install on windows is roughly the same as outlined below, except you will need to add more binaries to your system PATH.

Preparing your system

Make sure your system is configured properly to use PrestaShop, i.e. that you can install PrestaShop without any error and preferably with all the optional parameters (as indicated by the installer) in the green.

In particular, you will need the php cURL extension.

Then check that the following other programs are installed and available in your PATH:

  • java
  • firefox
  • mysql, mysqldump, mysqladmin

Getting the framework's code

git clone https://github.com/PrestaShop/PrestaShopAutomationFramework

Installing the dependencies

cd PrestaShopAutomationFramework
php composer.phar install

Framework Usage

Setting up a PrestaShopAutomationFramework project

To run tests, you first need to setup a project.

Think of it as a testing environment. Its primary purpose is to define where to get the code to install PrestaShop, how to access the database, how to connect to Selenium, etc.

# create a folder to hold our files
mkdir ~/pstaf-project
cd ~/pstaf-project

# get the files against which we're going to run tests
git clone https://github.com/PrestaShop/PrestaShop -b 1.6 --recursive

# put the pstaf tool in the path, for convenience
export PATH=/path/to/PrestaShopAutomationFramework:$PATH

#initialize the project
pstaf project:init

When running pstaf project:init you will be asked a few questions to setup the project.

Most questions should be straightforward, let's give further details on 3 options:

Front-Office URL
Should be the URL at which the shop, once installed, is reachable by the browser.
If your PrestaShop repository folder is called `presta` then Front-Office URL should probably be 'http://localhost/presta'.
Path to original shop files
This is where the shop files should be taken from.
In our case, this would be 'PrestaShop' since we cloned the file to the `PrestaShop` sub folder of the `pstaf-project` folder.
Path to web root
This is the root folder of your virtual host, for instance `/var/www`.
That's where the framework will create the shops it needs.

Checking it works

Here we're going to try and install PrestaShop using the framework.

# fire up selenium
pstaf selenium:start

# install our shop
pstaf shop:install

Sit back and relax, if all goes well PrestaShop should install itself according to the settings you've input.

Running a test suite

All test suites live under the FunctionalTest folder of PrestaShopAutomationFramework.

Running all tests from the suite

To run all the tests contained in a test suite, type pstaf test:run TestName where test name is any filename from the FunctionalTest folder, without the 'Test' suffix nor the '.php' extension.

To run one of the simplest test suites:

pstaf test:run BackOfficeNavigation

On first run, it will make a fresh installation of PrestaShop, that's normal.

It will be put in cache for later tests.

The invoice case: running just one of the multiple invoice tests

pstaf test:run Invoice -ztestInvoice:^A1

This -z options instruct the test runner (only available with the default ptest runner) to filter the first argument passed to the testInvoice method, and only take the ones matching the ^A1 regexp, i.e. here only A1.json, which is a file living in the InvoiceTest examples folder.

Running all tests

# run all tests, in parallel, 4 at a time
pstaf test:run -ap4

Warning, this will take a looong time, unless you use an optimized testing setup.

Going further

prestashopautomationframework's People

Contributors

djfm 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.