python-wd-parallel

Lets you easily run your test in multiple browsers
Download

python-wd-parallel Ranking & Summary

Advertisement

  • Rating:
  • License:
  • The Apache License 2.0
  • Price:
  • FREE
  • Publisher Name:
  • Mathieu Sabourin
  • Publisher web site:
  • https://github.com/OniOni

python-wd-parallel Tags


python-wd-parallel Description

python-wd-parallel is a Python module to run selenium test in multiple browsers easily.Writing a test !Start by importing the moduleimport wd.parallelThe test should be implemented as a unittest TestCase. So go ahead and do thatclass Selenium2OnSauce(unittest.TestCase):In the set up you should create your browsers configurations. Or you could just load them from a json file. def setUp(self): self.drivers = wd.parallel.Remote() self.drivers.load_config_file(/path/to/your/config/file.json)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 selenium documentation for available methods. @wd.parallel.multiply def test_sauce(self): self.driver.get('http://saucelabs.com/test/guinea-pig') self.assertTrue("I am a page title - Sauce Labs" in self.driver.title); self.driver.find_element_by_id('comments').send_keys('Hello! I am some example comments. I should appear in the page after you submit the form') self.driver.find_element_by_id('submit').click() comments = self.driver.find_element_by_id('your_comments') self.assertTrue('Your comments: Hello! I am some example comments. I should appear in the page after you submit the form' in comments.text) body = self.driver.find_element_by_xpath('//body') self.assertFalse('I am some other page content' in body.text) self.driver.find_elements_by_link_text('i am a link').click() body = self.driver.find_element_by_xpath('//body') self.assertTrue('I am some other page content' in body.text)The tear down method works just like the test cases. Just work as if there was one browser and add the @multiply decorator. @wd.parallel.multiply def tearDown(self): self.driver.quit()if __name__ == '__main__': unittest.main()Supported MethodsCheck out the Python wd implementation it has all the documentation about actual tests.More docs!WD is simply implementing the Selenium JsonWireProtocol, for more details see the official docs: - http://code.google.com/p/selenium/wiki/JsonWireProtocolProduct's homepage


python-wd-parallel Related Software