Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added installation instructions and changed code blocks to allow synt…

…ax highlighting.
  • Loading branch information...
commit d3417394beca30228d691c1b691341e4a40d75da 1 parent 263ed35
Mathieu Sabourin authored June 05, 2012

Showing 1 changed file with 13 additions and 14 deletions. Show diff stats Hide diff stats

  1. 27  README.md
27  README.md
Source Rendered
... ...
@@ -1,7 +1,9 @@
1 1
 # python-parallel-wd -- Run selenium test in multiple browsers easily - Python flavor
2 2
 
3 3
 ## Install
4  
-...
  4
+```shell
  5
+pip install python-wd-parallel 
  6
+```
5 7
 
6 8
 ## Authors
7 9
 
@@ -11,34 +13,31 @@
11 13
 
12 14
   * License - Apache 2: http://www.apache.org/licenses/LICENSE-2.0
13 15
 
14  
-## Usage
15  
-...
16  
-
17 16
 ## Writing a test !
18 17
 
19 18
 Start by importing the module 
20 19
 
21  
-<pre>
  20
+```python
22 21
 import wd.parallel
23  
-</pre>
  22
+```
24 23
 
25 24
 The test should be implemented as a unittest TestCase. So go ahead and do that 
26 25
 
27  
-<pre>
  26
+```python
28 27
 class Selenium2OnSauce(unittest.TestCase):
29  
-</pre>
  28
+```
30 29
 
31 30
 In the set up you should create your browsers configurations. Or you could just load them from a json file.
32 31
 
33  
-<pre>
  32
+```python
34 33
     def setUp(self):
35 34
         self.drivers = wd.parallel.Remote()
36 35
         self.drivers.load_config_file(/path/to/your/config/file.json)
37  
-</pre>
  36
+```
38 37
 
39 38
 Now just write your test as you would for a unique browser. Test should be run on the self.driver attribute. Just use the @multiply decoration to run the test in all the browser you set up. Check out the <a href='http://code.google.com/p/selenium/wiki/PythonBindings'>selenium</a> documentation for available methods.
40 39
 
41  
-<pre>
  40
+```python
42 41
     @wd.parallel.multiply
43 42
     def test_sauce(self):
44 43
         self.driver.get('http://saucelabs.com/test/guinea-pig')
@@ -54,18 +53,18 @@ Now just write your test as you would for a unique browser. Test should be run o
54 53
         body = self.driver.find_element_by_xpath('//body')
55 54
         self.assertTrue('I am some other page content' in body.text)
56 55
 
57  
-</pre>
  56
+```
58 57
 
59 58
 The tear down method works just like the test cases. Just work as if there was one browser and add the @multiply decorator.
60 59
 
61  
-<pre>
  60
+```python
62 61
     @wd.parallel.multiply
63 62
     def tearDown(self):
64 63
         self.driver.quit()
65 64
 
66 65
 if __name__ == '__main__':
67 66
     unittest.main()
68  
-</pre>
  67
+```
69 68
 
70 69
 ## Supported Methods
71 70
 Check out the python wd <a href='http://code.google.com/p/selenium/wiki/PythonBindings'>implementation</a> it has all the documentation about actual tests.

0 notes on commit d341739

Please sign in to comment.
Something went wrong with that request. Please try again.