Permalink
Browse files

Added installation instructions and changed code blocks to allow synt…

…ax highlighting.
  • Loading branch information...
1 parent 263ed35 commit d3417394beca30228d691c1b691341e4a40d75da @OniOni committed Jun 5, 2012
Showing with 13 additions and 14 deletions.
  1. +13 −14 README.md
View
@@ -1,7 +1,9 @@
# python-parallel-wd -- Run selenium test in multiple browsers easily - Python flavor
## Install
-...
+```shell
+pip install python-wd-parallel
+```
## Authors
@@ -11,34 +13,31 @@
* License - Apache 2: http://www.apache.org/licenses/LICENSE-2.0
-## Usage
-...
-
## Writing a test !
Start by importing the module
-<pre>
+```python
import wd.parallel
-</pre>
+```
The test should be implemented as a unittest TestCase. So go ahead and do that
-<pre>
+```python
class Selenium2OnSauce(unittest.TestCase):
-</pre>
+```
In the set up you should create your browsers configurations. Or you could just load them from a json file.
-<pre>
+```python
def setUp(self):
self.drivers = wd.parallel.Remote()
self.drivers.load_config_file(/path/to/your/config/file.json)
-</pre>
+```
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.
-<pre>
+```python
@wd.parallel.multiply
def test_sauce(self):
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
body = self.driver.find_element_by_xpath('//body')
self.assertTrue('I am some other page content' in body.text)
-</pre>
+```
The tear down method works just like the test cases. Just work as if there was one browser and add the @multiply decorator.
-<pre>
+```python
@wd.parallel.multiply
def tearDown(self):
self.driver.quit()
if __name__ == '__main__':
unittest.main()
-</pre>
+```
## Supported Methods
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 comments on commit d341739

Please sign in to comment.