Functional test of an Android application using appium and python

This is python code to check if a record works well:

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) 

It works fine so far.

Now I need to check the physical device whether the record is present or not.

I need to go to the File Manager device to check for the presence of recorded sound (recording .mp3)

How can I write a test case for this?

+5
source share
1 answer

You can open the File Manager application and go to the application folder and check the existence of the record.mp3 file in this folder.

+4
source

Source: https://habr.com/ru/post/1244714/


All Articles