芭比哇玩123 发表于 2017-6-14 10:15:31

加急 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").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 ").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)
能看出是哪里出问题了吗?
https://testerhome.com/uploads/photo/2017/baab6b4c-cf6e-4cdc-b024-c99290f559bd.jpg!large

若尘_51 发表于 2017-6-14 10:21:51

测试case的名字都要以"test_"开头,不然不认识。

测试的味道 发表于 2017-6-14 15:41:08

用例用test开头,如testWifiCase
页: [1]
查看完整版本: 加急 Pycharm 提示 Empty test suite. case 一个都没跑