Announcement

  •  » Engine
  •  » Functional tests

#1 2013-03-22 21:49:58

nicolas
Former Piwigo Team
2004-12-30
1170

Functional tests

Hi all,

Julien a few week ago wanted to make the postgresql support revive. I decided to help him. Our idea is to make a as large as possible features coverage of piwigo to add support with moe confidence.

I started a project on github : https://github.com/nikrou/phyxo
I didn't use the same name to avoid confusion but it's not a fork. We want to convince piwigo team to integrate our tests in piwigo core. We think it could help.

The tests we made used Behat
Behat is BDD tool. Tests are written in a natural langage (english but can be written in severals languages). They describe features used by users of the website. Features are for users and tests describe what was the benefit of a feature for a user.

An example :

Code:

Feature: Comment
  In order to show my favorites pictures
  As a user
  I need to be abble to add comments to pictures

 Scenario: Add a comment
    Given I am a register user
    When I go to a picture page
    And When I add a comment :
      """
      What a good pics !
      """
    Then I should see "Your comment has been registered"

That example presents comment in piwigo. The feature is for "a user". He wants to comment pictures. The "scenario" describe the feature. There can be severals scenario for a unique feature. Of course that feature is not complete to reveal the whole feature existing in piwigo : users can update thier comment, delete them, ...

Tests are not technical and any user can write somes. Of course, there are some code to convert sentence to "real" tests. For example the sentence "When I go to a picture page" is map to a request from a fake brower but to the real server. Behat analyse response (html received from server) and when we wrote "Then I should see "Your comment has been registered"", Behat make a test to search that sentence in the content received.

There are many features to describe and many tests to wrote.  I only wrote 15 scenrios for 6 features (comment, favorites, ...)

Any help is welcome. If you want to contribute, the preferal way is a pull request on github but any other way is accepted.

Nicolas

Offline

 
  •  » Engine
  •  » Functional tests

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2018 · Contact