Guest User

Untitled

a guest
Nov 20th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. import os
  2. import sys
  3. import unittest
  4.  
  5. from appium import webdriver
  6.  
  7.  
  8. class TestBaseClass(unittest.TestCase):
  9. def setUp(self):
  10. # set all desired capabilities for Appium
  11. desired_caps = {
  12. 'platformName': 'iOS',
  13. 'platformVersion': '11.1',
  14. 'automationName': 'XCUITest',
  15. 'deviceName': 'iPhone 7',
  16. 'app': os.path.join('...')
  17. }
  18.  
  19. # Create driver object with Appium server address location
  20. self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_capabilities=desired_caps)
  21.  
  22. # grab the "WEBVIEW_*" context
  23. webview_context = self.driver.contexts[1]
  24.  
  25. # switch to the "WEBVIEW_*" context
  26. self.driver.switch_to.context(webview_context)
  27.  
  28. def tearDown(self):
  29. if sys.exc_info()[0]:
  30. self.driver.save_screenshot(f'{self._testMethodName}.png')
  31. self.driver.quit()
  32.  
  33. class ScientificCalcMath(TestBaseClass):
  34. # a bunch of test cases here...
  35.  
  36. if __name__ == '__main__':
  37. suite = unittest.TestLoader().loadTestsFromTestCase(ScientificCalcMath)
  38. unittest.TextTestRunner(verbosity=2).run(suite)
Add Comment
Please, Sign In to add comment