51Testing软件测试论坛
标题:
加急 Pycharm 提示 Empty test suite. case 一个都没跑
[打印本页]
作者:
芭比哇玩123
时间:
2017-6-14 10:15
标题:
加急 Pycharm 提示 Empty test suite. case 一个都没跑
本帖最后由 芭比哇玩123 于 2017-6-14 10:17 编辑
# urs/bin/python
# encoding:utf-8
import time
from appium import webdriver
import unittest
class MyTestCase(unittest.TestCase):
def setUp(self):
self.desired_caps = {}
self.desired_caps['platformName'] = 'Android'
self.desired_caps['platformVersion'] = '7.0'
self.desired_caps['deviceName'] = '8223d2ed'
self.desired_caps['appPackage'] = 'com.doro'
self.desired_caps['appActivity'] = '.MainActivity '
self.desired_caps["unicodeKeyboard"] = "True"
self.desired_caps["resetKeyboard"] = "True"
self.desired_caps['automationName'] = 'Uiautomator2'
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', self.desired_caps)
def cameraCase(self):
time.sleep(1)
self.driver.press_keycode(3)
time.sleep(1)
self.driver.tap([(359, 1247)])
time.sleep(1)
self.driver.tap([(359, 1247)])
time.sleep(2)
input = self.driver.find_element_by_id("com.doro.apps.launcher3:id/search_box_input")
input.send_keys("Ca")
time.sleep(1)
# self.driver.find_element_by_xpath("//android.widget.FrameLayout[contains(@content-desc ,'Camera')]").click()
self.driver.tap([(550, 500)])
self.driver.find_element_by_id("com.mediatek.camera:id/shutter_button_photo")
time.sleep(1)
self.driver.find_element_by_id("com.mediatek.camera:id/thumbnail").click()
time.sleep(1)
self.driver.get_screenshot_as_file("Camera shut.png")
def wifiCase(self):
self.driver.press_keycode(3)
time.sleep(1)
self.driver.flick(360, 0, 360, 1000)
time.sleep(1)
self.driver.tap([(550, 500)], 2)
self.driver.find_element_by_id("com.android.settings:id/switch_widget")
self.driver.find_elements_by_xpath("//android.widget.FrameLayout [contains(@content-desc,'CKT,,Wifi signal full')]").click()
password = self.driver.find_element_by_id("com.android.settings:id/password")
password.send_keys("ck88888!")
self.driver.find_element_by_id("android:id/button1").click()
def tearDown(self):
self.driver.quit()
if __name__ == '__main__':
unittest.main()
![](/uploads/photo/2017/b66d5ad3-2a0b-4ed6-a512-1d3210fac116.jpg!large)
复制代码
能看出是哪里出问题了吗?
作者:
若尘_51
时间:
2017-6-14 10:21
测试case的名字都要以"test_"开头,不然不认识。
作者:
测试的味道
时间:
2017-6-14 15:41
用例用test开头,如testWifiCase
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2