Best Python code snippet using Airtest
admin.py
Source:admin.py
...41 machine=machine.no42 ).save()43 self.message_user(request, 'å·²ä¿åæµè¯ç»æå°æ¥å¿è®°å½')44 test_relay.short_description = 'æµè¯ 继çµå¨'45 def test_touch(self, request, queryset):46 for machine in queryset:47 record = test_touch()48 Touch(49 close=record.get('CT'),50 open=record.get('OT'),51 type=3,52 machine=machine.no53 ).save()54 Touch(55 close=record.get('NCR'),56 open=record.get('NOR'),57 type=2,58 machine=machine.no59 ).save()60 self.message_user(request, 'å·²ä¿åæµè¯ç»æå°æ¥å¿è®°å½')61 test_touch.short_description = 'æµè¯ 触ç¹'...
test_touch.py
Source:test_touch.py
1#!/usr/bin/python32import os3import subprocess4import time5import argparse6from common import *7###############################################################################8# class Test_touch9###############################################################################10class Test_touch(Test_basic):11 def __init__(self):12 Test_basic.__init__(self, 'touch')13 self.err_dict['NO_TOUCH'] = 'AR1100 HID-MOUSE not detected'14 15 def initialize(self):16 Test_basic.initialize(self)17 def finalize(self):18 try:19 Test_basic.finalize(self)20 except Test_error as e:21 sys.exit(-1)22 def check_touch(self):23 return subprocess.run(['sh', '-c', 'dmesg | grep AR1100'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 024###############################################################################25try:26 t = Test_touch()27 parser = argparse.ArgumentParser(description='Test touch')28 t.add_common_arguments(parser)29 args = parser.parse_args()30 t.copy_common_arguments(args)31 t.initialize()32 t.message('Check touch AR1100 HID-MOUSE')33 if not t.check_touch():34 raise Test_error(t, 'NO_TOUCH')35 t.success()36except Test_error as e:...
test_online.py
Source:test_online.py
1from unittest import TestCase2from dsplab.flow import online3class TestQueueFilter(TestCase):4 def test_touch(self):5 online.QueueFilter(101)6class TestDelayer(TestCase):7 def test_touch(self):8 online.Delayer(101)9class TestAnd(TestCase):10 def test_touch(self):11 online.And()12class TestOr(TestCase):13 def test_touch(self):14 online.Or()15class TestOnlineFilter(TestCase):16 def test_touch(self):...
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!!