Best Python code snippet using Airtest
test.py
Source:test.py
1#!/usr/bin/env python32# -*- coding: utf-8 -*-3"""4Created on Sun Apr 18 02:15:11 20215@author: youssefbencheikh6"""7import unittest8import Logement 9#maison 110adresse = 'Somewhere in Earth'11proprietaire = 'Someone'12date_construction = '01/01/1999'13surface = 12014nb_fenetres = 2015maison1 = Logement.maison(adresse, proprietaire, date_construction, surface, nb_fenetres)16class TestMaison(unittest.TestCase):17 def test_getAdress(self):18 self.assertEqual(maison1.getAdress(), 'Somewhere in Earth', "Should be Somewhere in Earth")19 def test_getProp(self):20 self.assertEqual(maison1.getProp(), 'Someone', 'Should be Someone')21 def test_Surface(self):22 self.assertEqual(maison1.getSurface(), 120, 'Should be 120')23 def test_get_fenetres(self):24 self.assertEqual(maison1.getFenetres(), 20, 'Should be 20')25 26#immeuble 127adresse = 'Somewhere else in Earth'28proprietaire = 'Someone else'29date_construction = '01/01/1999'30nb_appartement = 6031ascenseur = True32immeuble1 = Logement.immeuble(adresse, proprietaire, date_construction, nb_appartement, ascenseur)33class TestImmeuble(unittest.TestCase):34 def test_getAdress(self):35 self.assertEqual(immeuble1.getAdress(), 'Somewhere else in Earth', "Should be 'Somewhere else in Earth'")36 def test_getProp(self):37 self.assertEqual(immeuble1.getProp(), 'Someone else', 'Should be Someone else')38 def test_nbApp(self):39 self.assertEqual(immeuble1.getNbApp(), 60, 'Should be 60')40 def test_Ascenseur(self):41 self.assertEqual(immeuble1.getAscn(), True, 'Should be True')42if __name__ == '__main__':...
test_device_info.py
Source:test_device_info.py
...15 print(android_version)16 assert isinstance(android_version, dict)17 version = android_version.get("Android Version") 18 assert len(version) > 019 def test_getprop(self):20 """21 Unit test for all getprop should return in dict22 """23 getprop = DeviceInfo.all_getprop(self.device)24 assert isinstance(getprop, dict)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!