How to add Tauk to existing Pyunit test cases?
34 lines
import unittest
import unittest
import sys
import sys
from time import sleep
from time import sleep
from appium import webdriver
from appium import webdriver
from selenium.common.exceptions import WebDriverException
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.common.by import By
from selenium.webdriver.common.by import By
from tauk.tauk_webdriver import Tauk
token = "YOURAPITOKEN"
projectid = "YOURPROJECTID"
Tauk(api_token = token, project_id=projectid)
class TestAndroidCreateWebSession(unittest.TestCase):
class TestAndroidCreateWebSession(unittest.TestCase):
def tearDown(self):
def tearDown(self):
self.driver.quit()
self.driver.quit()
def setUp(self):
def setUp(self):
caps = {}
caps = {}
caps['deviceName'] = 'Android'
caps['deviceName'] = 'Android'
caps['udid'] = 'YOURDEVICEID'
caps['udid'] = 'YOURDEVICEID'
caps['platformName'] = 'Android'
caps['platformName'] = 'Android'
caps['appPackage'] = 'org.zwanoo.android.speedtest'
caps['appPackage'] = 'org.zwanoo.android.speedtest'
caps['appActivity'] = 'com.ookla.mobile4.screens.main.MainActivity'
caps['appActivity'] = 'com.ookla.mobile4.screens.main.MainActivity'
caps['noReset'] = True
caps['noReset'] = True
self.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_capabilities=caps)
self.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_capabilities=caps)
@Tauk.observe(custom_test_name="test_speedtest")
def test_should_create_and_destroy_android_web_session(self):
def test_should_create_and_destroy_android_web_session(self):
Tauk.register_driver(self.driver)
self.driver.implicitly_wait(10)
self.driver.implicitly_wait(10)
self.driver.find_element(By.ID, "org.zwanoo.android.speedtest:id/go_button")
self.driver.find_element(By.ID, "org.zwanoo.android.speedtest:id/go_button")
self.driver.find_element(By.ID, "org.zwanoo.android.speedtest:id/go_button").click()
self.driver.find_element(By.ID, "org.zwanoo.android.speedtest:id/go_button").click()
if __name__ == '__main__':
if __name__ == '__main__':
unittest.main()
unittest.main()