Best Python code snippet using uiautomator
run_tests.py
Source:run_tests.py  
1# -*- coding: utf-8 -*-23import sys4import unittest5import berrymq.berrymq as berrymq678def show_usage(alert_version=False):9    print("""berryMQ tests10  for Python 2.4, 2.5, 2.6 (current interpreter: %d.%d.%d)1112  run_tests.py [option] target:1314  *target15    --all:      run all test16    --basic:    test basic features only17    --pull:     test pull API18    --parallel: test multithreading feature only(slow)19    --jsonrpc:  test jsonrpc components(slow)20    --1st_node: network test(run this first)21    --2nd_node: network test(run this later)22""" % sys.version_info[:3])23    if alert_version:24        print("This test is able to be run on Python 2.X")25    sys.exit()262728def main():29    if sys.version_info[0] != 2:30        show_usage(alert_version=True)3132    if len(sys.argv) == 1 or "--help" in sys.argv or "-h" in sys.argv:33        show_usage()3435    if "--1st_node" in sys.argv:36        import tests.test_interprocess37        tests.test_interprocess.primary_node()38        sys.exit()39    if "--2nd_node" in sys.argv:40        import tests.test_interprocess41        tests.test_interprocess.secondary_node()42        sys.exit()4344    suite = unittest.TestSuite()4546    if "--basic" in sys.argv or "--all" in sys.argv:47        import tests.test_berrymq48        suite.addTest(tests.test_berrymq.test_setup(berrymq))4950    if "--pull" in sys.argv or "--all" in sys.argv:51        import tests.test_berrymq_pull52        suite.addTest(tests.test_berrymq_pull.test_setup(berrymq))5354    if "--parallel" in sys.argv or "--all" in sys.argv:55        import tests.test_berrymq_parallel56        suite.addTest(tests.test_berrymq_parallel.test_setup(berrymq))5758    if "--jsonrpc" in sys.argv or "--all" in sys.argv:59        import tests.test_jsonrpc60        suite.addTest(tests.test_jsonrpc.test_setup())6162    if suite.countTestCases():63        runner = unittest.TextTestRunner()64        runner.run(suite)65    else:66        show_usage()676869if __name__ == "__main__":
...test_jsonrpc.pyi
Source:test_jsonrpc.pyi  
1# Stubs for jsonrpc.tests.test_jsonrpc (Python 3)2#...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!!
