author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Thu, 26 Aug 2010 11:35:02 +0200 | |
branch | stable |
changeset 6160 | 12038ca95f0f |
parent 5995 | b9c612274af7 |
child 6424 | f443a2b8a5c7 |
permissions | -rw-r--r-- |
5995
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
1 |
import os, os.path as osp |
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
2 |
|
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
3 |
from cubicweb.devtools import cwwindmill |
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 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
6 |
class CubicWebWindmillUseCase(cwwindmill.CubicWebWindmillUseCase): |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
7 |
"""class for windmill use case tests |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
8 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
9 |
From test server parameters: |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
10 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
11 |
:params ports_range: range of http ports to test (range(7000, 8000) by default) |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
12 |
:type ports_range: iterable |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
13 |
:param anonymous_logged: is anonymous user logged by default ? |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
14 |
:type anonymous_logged: bool |
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 |
The first port found as available in `ports_range` will be used to launch |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
17 |
the test server |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
18 |
|
5995
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
19 |
Instead of toggle `edit_test` value, try `pytest -i` |
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
20 |
|
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
21 |
From Windmill configuration: |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
22 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
23 |
:param browser: browser identification string (firefox|ie|safari|chrome) (firefox by default) |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
24 |
:param test_dir: testing file path or directory (./windmill by default) |
5995
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
25 |
:param edit_test: load and edit test for debugging (False by default) |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
26 |
""" |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
27 |
#ports_range = range(7000, 8000) |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
28 |
anonymous_logged = False |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
29 |
#browser = 'firefox' |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
30 |
#test_dir = osp.join(os.getcwd(), 'windmill') |
5995
b9c612274af7
[test] improve windmill integration, new test on relation edition
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
5675
diff
changeset
|
31 |
#edit_test = False |
5675
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
32 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
33 |
# If you prefer, you can put here the use cases recorded by windmill GUI |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
34 |
# (services transformer) instead of the windmill sub-directory |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
35 |
# You can change `test_dir` as following: |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
36 |
#test_dir = __file__ |
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 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
39 |
from windmill.authoring import WindmillTestClient |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
40 |
def test_usecase(): |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
41 |
client = WindmillTestClient(__name__) |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
42 |
import pdb; pdb.set_trace() |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
43 |
client.open(url=u'/') |
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 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
46 |
|
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
47 |
if __name__ == '__main__': |
4535f8e57580
[web test] add basic windmill tests and documentation
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
diff
changeset
|
48 |
cwwindmill.unittest_main() |