Hi,
I’m trying to run through a complete application and do task, after task, after task within the same session.
I notice that setUp and tearDown run on each function. How can I have only 1 inital Setup and then a final tearDown at the end?
Here is my code:
Thanks
'''
Created on Nov 17, 2014
@author: Paul
'''
import time
import os
import unittest
from appium import webdriver
class Test(unittest.TestCase):
def setUp(self):
"Setup for the test"
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.4'
desired_caps['deviceName'] = 'Android Emulator'
# Returns abs path relative to this file and not cwd
desired_caps['app'] = os.path.abspath(os.path.join(os.path.dirname(__file__),'com.tinder-4.0.1-APK4Fun.com.apk'))
desired_caps['appPackage'] = 'com.tinder'
desired_caps['appActivity'] = 'com.tinder.activities.ActivitySplashLoading'
desired_caps['appium-version'] = '1.1'
self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
def tearDown(self):
"Tear down the test"
self.driver.quit()
def test_login(self):
time.sleep(10)
el = self.driver.find_element_by_xpath('//android.widget.Button[contains(@text, "Sign in with Facebook")]')
el.click()
def test_credentials(self):
time.sleep(40)
textfields = self.driver.find_elements_by_class_name("//android.widget.EditText")
print(textfields)
#textfields[4].send_keys("Appium User")
#textfields[3].send_keys("[email protected]")
#---START OF SCRIPT
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(Test)
unittest.TextTestRunner(verbosity=2).run(suite)