doc/book/en/tutorials/tools/windmill.rst
branchstable
changeset 7529 2fdc310be7cd
parent 6880 4be32427b2b9
equal deleted inserted replaced
7528:11659cbe5eea 7529:2fdc310be7cd
    21 
    21 
    22 The simplest solution is to use a *setuptools/pip* command (for a clean
    22 The simplest solution is to use a *setuptools/pip* command (for a clean
    23 environment, take a look to the `virtualenv
    23 environment, take a look to the `virtualenv
    24 <http://pypi.python.org/pypi/virtualenv>`_ project as well)::
    24 <http://pypi.python.org/pypi/virtualenv>`_ project as well)::
    25 
    25 
    26     pip install windmill
    26     $ pip install windmill
    27     curl -O http://github.com/windmill/windmill/tarball/master
    27     $ curl -O http://github.com/windmill/windmill/tarball/master
    28 
    28 
    29 However, the Windmill project doesn't release frequently. Our recommandation is
    29 However, the Windmill project doesn't release frequently. Our recommandation is
    30 to used the last snapshot of the Git repository:
    30 to used the last snapshot of the Git repository::
    31 
    31 
    32 .. sourcecode:: bash
    32     $ git clone git://github.com/windmill/windmill.git HEAD
    33 
    33     $ cd windmill
    34     git clone git://github.com/windmill/windmill.git HEAD
    34     $ python setup.py develop
    35     cd windmill
       
    36     python setup.py develop
       
    37 
    35 
    38 Install instructions are `available <http://wiki.github.com/windmill/windmill/installing>`_.
    36 Install instructions are `available <http://wiki.github.com/windmill/windmill/installing>`_.
    39 
    37 
    40 Be sure to have the windmill module in your PYTHONPATH afterwards::
    38 Be sure to have the windmill module in your PYTHONPATH afterwards::
    41 
    39 
    42     python -c "import windmill"
    40     $ python -c "import windmill"
    43 
    41 
    44 X dummy
    42 X dummy
    45 -------
    43 -------
    46 
    44 
    47 In order to reduce unecessary system load from your test machines, It's
    45 In order to reduce unecessary system load from your test machines, It's
    58     line to Driver "dummy" and remove any other ati specific options from the
    56     line to Driver "dummy" and remove any other ati specific options from the
    59     Device section.
    57     Device section.
    60 
    58 
    61     *From: http://www.x.org/wiki/XorgTesting*
    59     *From: http://www.x.org/wiki/XorgTesting*
    62 
    60 
    63 Then, you can run the X server with the following command :
    61 Then, you can run the X server with the following command ::
    64 
    62 
    65     /usr/bin/X11/Xvfb :1 -ac -screen 0 1280x1024x8 -fbdir /tmp
    63     $ /usr/bin/X11/Xvfb :1 -ac -screen 0 1280x1024x8 -fbdir /tmp
    66 
    64 
    67 
    65 
    68 Windmill usage
    66 Windmill usage
    69 ==============
    67 ==============
    70 
    68 
    80 
    78 
    81 .. _Usage: http://wiki.github.com/windmill/windmill/running-tests
    79 .. _Usage: http://wiki.github.com/windmill/windmill/running-tests
    82 
    80 
    83 If you are using firefox as client, consider the "firebug" option.
    81 If you are using firefox as client, consider the "firebug" option.
    84 
    82 
    85 If you have a running instance, you can refine the test by the *loadtest* windmill option:
    83 If you have a running instance, you can refine the test by the *loadtest* windmill option::
    86 
    84 
    87     windmill -m firebug loadtest=<test_file.py> <instance url>
    85     $ windmill -m firebug loadtest=<test_file.py> <instance url>
    88 
    86 
    89 Or use the internal windmill shell to explore available commands:
    87 Or use the internal windmill shell to explore available commands::
    90 
    88 
    91     windmill -m firebug shell <instance url>
    89     $ windmill -m firebug shell <instance url>
       
    90 
       
    91 And enter python commands:
    92 
    92 
    93 .. sourcecode:: python
    93 .. sourcecode:: python
    94 
    94 
    95     >>> load_test(<your test file>)
    95     >>> load_test(<your test file>)
    96     >>> run_test(<your test file>)
    96     >>> run_test(<your test file>)
   123 You can easily run your windmill test suite through `pytest` or :mod:`unittest`.
   123 You can easily run your windmill test suite through `pytest` or :mod:`unittest`.
   124 You have to copy a *test_windmill.py* file from :mod:`web.test`.
   124 You have to copy a *test_windmill.py* file from :mod:`web.test`.
   125 
   125 
   126 To run your test series::
   126 To run your test series::
   127 
   127 
   128     % pytest test/test_windmill.py
   128     $ pytest test/test_windmill.py
   129 
   129 
   130 By default, CubicWeb will use **firefox** as the default browser and will try
   130 By default, CubicWeb will use **firefox** as the default browser and will try
   131 to run test instance server on localhost. In the general case, You've no need
   131 to run test instance server on localhost. In the general case, You've no need
   132 to change anything.
   132 to change anything.
   133 
   133 
   142 * edit_test
   142 * edit_test
   143   load and edit test for debugging (False by default)
   143   load and edit test for debugging (False by default)
   144 
   144 
   145 Examples:
   145 Examples:
   146 
   146 
       
   147 .. sourcecode:: python
       
   148 
   147     browser = 'firefox'
   149     browser = 'firefox'
   148     test_dir = osp.join(__file__, 'windmill')
   150     test_dir = osp.join(__file__, 'windmill')
   149     edit_test = False
   151     edit_test = False
   150 
   152 
   151 If you want to change cubicweb test server parameters, you can check class
   153 If you want to change cubicweb test server parameters, you can check class
   160     class NewCubicWebServerTC(CubicWebServerTC):
   162     class NewCubicWebServerTC(CubicWebServerTC):
   161         configcls = OtherCubicWebServerConfig
   163         configcls = OtherCubicWebServerConfig
   162 
   164 
   163 For instance, CubicWeb framework windmill tests can be manually run by::
   165 For instance, CubicWeb framework windmill tests can be manually run by::
   164 
   166 
   165     % pytest web/test/test_windmill.py
   167     $ pytest web/test/test_windmill.py
   166 
   168 
   167 Edit your tests
   169 Edit your tests
   168 ---------------
   170 ---------------
   169 
   171 
   170 You can toggle the `edit_test` variable to enable test edition.
   172 You can toggle the `edit_test` variable to enable test edition.
   171 
   173 
   172 But if you are using `pytest` as test runner, use the `-i` option directly.
   174 But if you are using `pytest` as test runner, use the `-i` option directly.
   173 The test series will be loaded and you can run assertions step-by-step::
   175 The test series will be loaded and you can run assertions step-by-step::
   174 
   176 
   175     % pytest -i test/test_windmill.py
   177     $ pytest -i test/test_windmill.py
   176 
   178 
   177 In this case, the `firebug` extension will be loaded automatically for you.
   179 In this case, the `firebug` extension will be loaded automatically for you.
   178 
   180 
   179 Afterwards, don't forget to save your edited test into the right file (no autosave feature).
   181 Afterwards, don't forget to save your edited test into the right file (no autosave feature).
   180 
   182