51Testing软件测试论坛

标题: 加急 Pycharm 提示 Empty test suite. case 一个都没跑 [打印本页]

作者: 芭比哇玩123    时间: 2017-6-14 10:15
标题: 加急 Pycharm 提示 Empty test suite. case 一个都没跑
本帖最后由 芭比哇玩123 于 2017-6-14 10:17 编辑
  1. # urs/bin/python
  2. # encoding:utf-8
  3. import time
  4. from appium import webdriver
  5. import unittest


  6. class MyTestCase(unittest.TestCase):
  7.     def setUp(self):
  8.         self.desired_caps = {}
  9.         self.desired_caps['platformName'] = 'Android'
  10.         self.desired_caps['platformVersion'] = '7.0'
  11.         self.desired_caps['deviceName'] = '8223d2ed'
  12.         self.desired_caps['appPackage'] = 'com.doro'
  13.         self.desired_caps['appActivity'] = '.MainActivity '
  14.         self.desired_caps["unicodeKeyboard"] = "True"
  15.         self.desired_caps["resetKeyboard"] = "True"
  16.         self.desired_caps['automationName'] = 'Uiautomator2'
  17.         self.driver = webdriver.Remote('http://localhost:4723/wd/hub', self.desired_caps)

  18.     def cameraCase(self):
  19.         time.sleep(1)
  20.         self.driver.press_keycode(3)
  21.         time.sleep(1)
  22.         self.driver.tap([(359, 1247)])
  23.         time.sleep(1)
  24.         self.driver.tap([(359, 1247)])
  25.         time.sleep(2)
  26.         input = self.driver.find_element_by_id("com.doro.apps.launcher3:id/search_box_input")
  27.         input.send_keys("Ca")
  28.         time.sleep(1)
  29.         # self.driver.find_element_by_xpath("//android.widget.FrameLayout[contains(@content-desc ,'Camera')]").click()
  30.         self.driver.tap([(550, 500)])
  31.         self.driver.find_element_by_id("com.mediatek.camera:id/shutter_button_photo")
  32.         time.sleep(1)
  33.         self.driver.find_element_by_id("com.mediatek.camera:id/thumbnail").click()
  34.         time.sleep(1)
  35.         self.driver.get_screenshot_as_file("Camera shut.png")

  36.     def wifiCase(self):
  37.         self.driver.press_keycode(3)
  38.         time.sleep(1)
  39.         self.driver.flick(360, 0, 360, 1000)
  40.         time.sleep(1)
  41.         self.driver.tap([(550, 500)], 2)
  42.         self.driver.find_element_by_id("com.android.settings:id/switch_widget")
  43.         self.driver.find_elements_by_xpath("//android.widget.FrameLayout [contains(@content-desc,'CKT,,Wifi signal full')]").click()
  44.         password = self.driver.find_element_by_id("com.android.settings:id/password")
  45.         password.send_keys("ck88888!")
  46.         self.driver.find_element_by_id("android:id/button1").click()

  47.     def tearDown(self):
  48.             self.driver.quit()

  49. if __name__ == '__main__':
  50.     unittest.main()
  51. ![](/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