Changes between Version 7 and Version 8 of DeveloperGuidelines/Testing/Selenium


Ignore:
Timestamp:
05/04/12 04:49:28 (10 years ago)
Author:
coldblooded
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Testing/Selenium

    v7 v8  
    1 = Testing =
     1= Sahana Eden Testing functionality documentation: =
    22[[TOC]]
     3'''Introducing automated testing system built inside Sahana Eden (S3) framework.'''
     4
    35"A bug is a test case you haven't written yet" [[BR]]
    46"Unit Tests allow merciless [http://diveintopython.org/refactoring/refactoring.html refactoring]"
     
    1113* http://seleniumhq.org/docs/appendix_migrating_from_rc_to_webdriver.html#why-migrate-to-webdriver
    1214
     15== How does it work? ==
     16The system relies on Selenium web driver and IDE to execute and/or create automated test scripts.
     17Selenium provides the ability to test Sahana Eden as users see it - namely through a web browser. This therefore does end-to-end Functional Testing, however it can also be sued as Unit Testing.
     18
    1319These tests are stored in {{{eden/modules/tests}}}
    1420
    15 == Installation ==
    16 Install Selenium Python Client Driver into your running Python:
    17 * http://selenium.googlecode.com/svn/trunk/docs/api/py/index.html
     21== Installation of the testing environment in your machine ==
     22
     23In order to execute the automated Selenium powered test scripts, you must install the Selenium Web Drivers into Python as packages.[[BR]]
     24
     25''Windows & MAC OSx installation:''[[BR]]
     26
     27Download latest Selenium package:[[BR]]
     281) http://pypi.python.org/packages/source/s/selenium/selenium-2.20.0.tar.gz [[BR]]
     292) Extract it[[BR]]
     303) CMD/Terminal bash:
    1831{{{
    19 pip install -U selenium
    20 }}}
    21 or
    22 {{{
    23 wget http://pypi.python.org/packages/source/s/selenium/selenium-2.20.0.tar.gz
    24 tar zxvf selenium-2.20.0.tar.gz
    2532cd selenium-2.20.0
    2633python setup.py install
    2734}}}
    28 == Running Tests ==
     35
     36== Running / Executing Automated test scripts: ==
     37In Sahana Eden, the testing system is implemented in the directory: eden/modules/tests/ [[BR]]
     38Now that you have installed all the Selenium packages to your Python on your machine, you can now run them to test Eden module(s) functionalities. [[BR]][[BR]]
     39
    2940Before running the Selenium scripts, you should put your database into a known state:
    3041{{{
     
    3647deployment_settings.base.prepopulate = 2
    3748}}}
     49Run the whole test suite for the Eden application:[[BR]]
    3850
    39 Run the whole test suite for the 'eden' application:
    4051{{{
    4152cd web2py
    4253python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py
    4354}}}
    44 Run a single test for the 'eden' application:
     55
     56Run a single test script for the Eden application:[[BR]]
     57
    4558{{{
    4659cd web2py
    4760python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A mytestfunction
    4861}}}
     62[[BR]]
    4963
    50 == Writing Tests ==
    51 We aim to make it as easy as possible to write additional tests, which can easily be plugged into the suite.
     64== Writing / Creating your own test scripts:==
     65We aim to make it as easy as possible to write additional tests, which can easily be plugged into the testing suite or/and executed separately.[[BR]]
    5266
    53 An example has been created: {{{eden/modules/tests/hrm/staff.py}}}
     67Use the Selenium IDE to generate python codes. [[BR]]
     68
     69An example has been created: {{{eden/modules/tests/hrm/hrm001.py}}}
    5470
    5571New tests should be stored in a subfolder per module, adding the foldername to {{{eden/modules/tests/__init__.py}}} & creating an {{{__init__.py}}} in the subfolder.