【问题标题】:Functional test of an android app using appium and python使用 appium 和 python 对安卓应用进行功能测试
【发布时间】:2016-03-09 06:33:43
【问题描述】:

这是检查录音是否正常的python代码:

   def setUp(self):"Setup for the test"
       desired_caps = {}
       desired_caps['browserName']=''
       desired_caps['platformName'] = 'Android'
       desired_caps['platformVersion'] = '4.4.2'
       desired_caps['deviceName'] = 'd65d04425101de'
       # Returns abs path relative to this file and not cwd
       desired_caps['app'] = '/home/karthik/appiumworkspace/tests/app-debug (2).apk'
       desired_caps['appPackage'] = 'com.prueba.maverick'
       desired_caps['app-activity'] = '.SplashActivity' 
       desired_caps['app-wait-activity'] = '.MainActivity' 
       self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

   def tearDown(self):
       "Tear down the test"
       self.driver.quit()


    def test_whether_app_is_installed(self):
        "Test if the app has been installed correctly"
        self.driver.is_app_installed('com.prueba.maverick')

        print('APP HAS BEEN INSTALLED')


    def test_record_the_audio(self):
       "Test it clicks on Record button correctly"
        element = WebDriverWait(self.driver, 15).until(EC.presence_of_element_located((By.NAME, "PRESS TO RECORD")))
        element.click()
        time.sleep(10)
        element = WebDriverWait(self.driver, 15).until(EC.presence_of_element_located((By.NAME, "RECORDING PRESS TO STOP")))
        element.click()
        print('AUDIO RECORDED SUCCESSFULLY')        

   if __name__ == '__main__':
       suite = unittest.TestLoader().loadTestsFromTestCase(MaverickAndroidTests)
       unittest.TextTestRunner(verbosity=2).run(suite)

到这里为止一切正常..

现在我必须检查物理设备,录音是否真的存在..

我必须前往设备文件管理器,检查是否存在录制的音频(recording.mp3)

我怎样才能为此编写测试用例??

【问题讨论】:

    标签: android python automation functional-testing python-appium


    【解决方案1】:

    您可以打开 文件管理器 应用并导航到应用文件夹并检查该文件夹中是否存在 recording.mp3 文件。

    【讨论】:

      猜你喜欢
      • 2012-02-28
      • 1970-01-01
      • 2018-07-06
      • 2022-09-23
      • 1970-01-01
      • 2015-01-04
      • 1970-01-01
      • 1970-01-01
      • 2014-10-28
      相关资源
      最近更新 更多