author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Thu, 23 Jun 2016 15:45:30 +0200 | |
changeset 11363 | e5fe836df6f1 |
parent 10491 | c67bcee93248 |
child 12873 | de90a96be6f0 |
permissions | -rw-r--r-- |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
1 |
========================== |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
2 |
Use Windmill with CubicWeb |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
3 |
========================== |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
4 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
5 |
Windmill_ implements cross browser testing, in-browser recording and playback, |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
6 |
and functionality for fast accurate debugging and test environment integration. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
7 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
8 |
.. _Windmill: http://www.getwindmill.com/ |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
9 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
10 |
`Online features list <http://www.getwindmill.com/features>`_ is available. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
11 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
12 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
13 |
Installation |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
14 |
============ |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
15 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
16 |
Windmill |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
17 |
-------- |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
18 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
19 |
You have to install Windmill manually for now. If you're using Debian, there is |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
20 |
no binary package (`yet <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=579109>`_). |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
21 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
22 |
The simplest solution is to use a *setuptools/pip* command (for a clean |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
23 |
environment, take a look to the `virtualenv |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
24 |
<http://pypi.python.org/pypi/virtualenv>`_ project as well):: |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
25 |
|
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
26 |
$ pip install windmill |
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
27 |
$ curl -O http://github.com/windmill/windmill/tarball/master |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
28 |
|
5924
b218df942dd4
[book] update rql documentation and some erroneous/deprecated examples
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5905
diff
changeset
|
29 |
However, the Windmill project doesn't release frequently. Our recommandation is |
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
30 |
to used the last snapshot of the Git repository:: |
5924
b218df942dd4
[book] update rql documentation and some erroneous/deprecated examples
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5905
diff
changeset
|
31 |
|
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
32 |
$ git clone git://github.com/windmill/windmill.git HEAD |
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
33 |
$ cd windmill |
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
34 |
$ python setup.py develop |
5924
b218df942dd4
[book] update rql documentation and some erroneous/deprecated examples
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5905
diff
changeset
|
35 |
|
b218df942dd4
[book] update rql documentation and some erroneous/deprecated examples
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5905
diff
changeset
|
36 |
Install instructions are `available <http://wiki.github.com/windmill/windmill/installing>`_. |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
37 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
38 |
Be sure to have the windmill module in your PYTHONPATH afterwards:: |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
39 |
|
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
40 |
$ python -c "import windmill" |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
41 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
42 |
X dummy |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
43 |
------- |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
44 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
45 |
In order to reduce unecessary system load from your test machines, It's |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
46 |
recommended to use X dummy server for testing the Unix web clients, you need a |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
47 |
dummy video X driver (as xserver-xorg-video-dummy package in Debian) coupled |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
48 |
with a light X server as `Xvfb <http://en.wikipedia.org/wiki/Xvfb>`_. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
49 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
50 |
The dummy driver is a special driver available with the XFree86 DDX. To use |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
51 |
the dummy driver, simply substitue it for your normal card driver in the |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
52 |
Device section of your xorg.conf configuration file. For example, if you |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
53 |
normally uses an ati driver, then you will have a Device section with |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
54 |
Driver "ati" to let the X server know that you want it to load and use the |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
55 |
ati driver; however, for these conformance tests, you would change that |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
56 |
line to Driver "dummy" and remove any other ati specific options from the |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
57 |
Device section. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
58 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
59 |
*From: http://www.x.org/wiki/XorgTesting* |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
60 |
|
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
61 |
Then, you can run the X server with the following command :: |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
62 |
|
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
63 |
$ /usr/bin/X11/Xvfb :1 -ac -screen 0 1280x1024x8 -fbdir /tmp |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
64 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
65 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
66 |
Windmill usage |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
67 |
============== |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
68 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
69 |
Record your use case |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
70 |
-------------------- |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
71 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
72 |
- start your instance manually |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
73 |
- start Windmill_ with url site as last argument (read Usage_ or use *'-h'* |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
74 |
option to find required command line arguments) |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
75 |
- use the record button |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
76 |
- click on save to obtain python code of your use case |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
77 |
- copy the content to a new file in a *windmill* directory |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
78 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
79 |
.. _Usage: http://wiki.github.com/windmill/windmill/running-tests |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
80 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
81 |
If you are using firefox as client, consider the "firebug" option. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
82 |
|
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
83 |
If you have a running instance, you can refine the test by the *loadtest* windmill option:: |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
84 |
|
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
85 |
$ windmill -m firebug loadtest=<test_file.py> <instance url> |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
86 |
|
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
87 |
Or use the internal windmill shell to explore available commands:: |
5905
ed66f5a8d48a
[test] windmill: add a timeout between JS assertion in test_creation use case
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
88 |
|
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
89 |
$ windmill -m firebug shell <instance url> |
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
90 |
|
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
91 |
And enter python commands: |
5905
ed66f5a8d48a
[test] windmill: add a timeout between JS assertion in test_creation use case
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
92 |
|
ed66f5a8d48a
[test] windmill: add a timeout between JS assertion in test_creation use case
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
93 |
.. sourcecode:: python |
ed66f5a8d48a
[test] windmill: add a timeout between JS assertion in test_creation use case
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
94 |
|
ed66f5a8d48a
[test] windmill: add a timeout between JS assertion in test_creation use case
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
95 |
>>> load_test(<your test file>) |
ed66f5a8d48a
[test] windmill: add a timeout between JS assertion in test_creation use case
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
96 |
>>> run_test(<your test file>) |
ed66f5a8d48a
[test] windmill: add a timeout between JS assertion in test_creation use case
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
97 |
|
ed66f5a8d48a
[test] windmill: add a timeout between JS assertion in test_creation use case
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
98 |
|
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
99 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
100 |
Integrate Windmill tests into CubicWeb |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
101 |
====================================== |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
102 |
|
6424
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
103 |
Set environment |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
104 |
--------------- |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
105 |
|
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
106 |
You have to create a new unit test file and a `windmill` directory and copy all |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
107 |
your windmill use case into it. |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
108 |
|
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
109 |
.. sourcecode:: python |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
110 |
|
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
111 |
# test_windmill.py |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
112 |
|
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
113 |
# Run all scenarii found in windmill directory |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
114 |
from cubicweb.devtools.cwwindmill import (CubicWebWindmillUseCase, |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
115 |
unittest_main) |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
116 |
|
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
117 |
if __name__ == '__main__': |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
118 |
unittest_main() |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
119 |
|
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
120 |
Run your tests |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
121 |
-------------- |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
122 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
123 |
You can easily run your windmill test suite through `pytest` or :mod:`unittest`. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
124 |
You have to copy a *test_windmill.py* file from :mod:`web.test`. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
125 |
|
5995
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
126 |
To run your test series:: |
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
127 |
|
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
128 |
$ pytest test/test_windmill.py |
5995
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
129 |
|
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
130 |
By default, CubicWeb will use **firefox** as the default browser and will try |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
131 |
to run test instance server on localhost. In the general case, You've no need |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
132 |
to change anything. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
133 |
|
6424
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
134 |
Check :class:`cubicweb.devtools.cwwindmill.CubicWebWindmillUseCase` for |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
135 |
Windmill configuration. You can edit windmill settings with following class attributes: |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
136 |
|
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
137 |
* browser |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
138 |
identification string (firefox|ie|safari|chrome) (firefox by default) |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
139 |
* test_dir |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
140 |
testing file path or directory (windmill directory under your unit case |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
141 |
file by default) |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
142 |
* edit_test |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
143 |
load and edit test for debugging (False by default) |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
144 |
|
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
145 |
Examples: |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
146 |
|
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
147 |
.. sourcecode:: python |
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
148 |
|
6424
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
149 |
browser = 'firefox' |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
150 |
test_dir = osp.join(__file__, 'windmill') |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
151 |
edit_test = False |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
152 |
|
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
153 |
If you want to change cubicweb test server parameters, you can check class |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
154 |
variables from :class:`CubicWebServerConfig` or inherit it with overriding the |
6880
4be32427b2b9
[book] fixes some references and other doc construction pbs
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6424
diff
changeset
|
155 |
:attr:`configcls` attribute in :class:`CubicWebServerTC` :: |
6424
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
156 |
|
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
157 |
.. sourcecode:: python |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
158 |
|
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
159 |
class OtherCubicWebServerConfig(CubicWebServerConfig): |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
160 |
port = 9999 |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
161 |
|
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
162 |
class NewCubicWebServerTC(CubicWebServerTC): |
f443a2b8a5c7
[devtools] refactor http server initialization in a much saner way
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6324
diff
changeset
|
163 |
configcls = OtherCubicWebServerConfig |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
164 |
|
5995
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
165 |
For instance, CubicWeb framework windmill tests can be manually run by:: |
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
166 |
|
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
167 |
$ pytest web/test/test_windmill.py |
5995
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
168 |
|
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
169 |
Edit your tests |
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
170 |
--------------- |
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
171 |
|
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
172 |
You can toggle the `edit_test` variable to enable test edition. |
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
173 |
|
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
174 |
But if you are using `pytest` as test runner, use the `-i` option directly. |
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
175 |
The test series will be loaded and you can run assertions step-by-step:: |
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
176 |
|
7529
2fdc310be7cd
[book] add autoload section from code and fix sphinx warnings
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6880
diff
changeset
|
177 |
$ pytest -i test/test_windmill.py |
5995
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
178 |
|
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
179 |
In this case, the `firebug` extension will be loaded automatically for you. |
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
180 |
|
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
181 |
Afterwards, don't forget to save your edited test into the right file (no autosave feature). |
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5924
diff
changeset
|
182 |
|
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
183 |
Best practises |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
184 |
-------------- |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
185 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
186 |
Don't run another instance on the same port. You risk to silence some |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
187 |
regressions (test runner will automatically fail in further versions). |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
188 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
189 |
Start your use case by using an assert on the expected primary url page. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
190 |
Otherwise all your tests could fail without clear explanation of the used |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
191 |
navigation. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
192 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
193 |
In the same location of the *test_windmill.py*, create a *windmill/* with your |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
194 |
windmill recorded use cases. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
195 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
196 |
|
6324
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
197 |
Caveats |
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
198 |
======= |
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
199 |
|
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
200 |
File Upload |
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
201 |
----------- |
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
202 |
|
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
203 |
Windmill can't do file uploads. This is a limitation of browser Javascript |
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
204 |
support / sandboxing, not of Windmill per se. It would be nice if there were |
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
205 |
some command that would prime the Windmill HTTP proxy to add a particular file |
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
206 |
to the next HTTP request that comes through, so that uploads could at least be |
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
207 |
faked. |
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
208 |
|
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
209 |
.. http://groups.google.com/group/windmill-dev/browse_thread/thread/cf9dc969722bd6bb/01aa18fdd652f7ff?lnk=gst&q=input+type+file#01aa18fdd652f7ff |
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
210 |
|
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
211 |
.. http://davisagli.com/blog/in-browser-integration-testing-with-windmill |
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
212 |
|
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
213 |
.. http://groups.google.com/group/windmill-dev/browse_thread/thread/b7bebcc38ed30dc7 |
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
214 |
|
bdb85e3602c8
[book] minor update about windmill + reformat
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
6183
diff
changeset
|
215 |
|
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
216 |
Preferences |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
217 |
=========== |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
218 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
219 |
A *.windmill/prefs.py* could be used to redefine default configuration values. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
220 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
221 |
.. define CubicWeb preferences in the parent test case instead with a dedicated firefox profile |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
222 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
223 |
For managing browser extensions, read `advanced topic chapter |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
224 |
<http://wiki.github.com/windmill/windmill/advanced-topics>`_. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
225 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
226 |
More configuration examples could be seen in *windmill/conf/global_settings.py* |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
227 |
as template. |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
228 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
229 |