How to use get_tests_for_suite method in Testify

Best Python code snippet using Testify_python

run-jstests.py

Source:run-jstests.py Github

copy

Full Screen

...33from os import linesep, path34from subprocess import run, TimeoutExpired, STDOUT, PIPE, DEVNULL35from time import perf_counter36from collections import OrderedDict37def get_tests_for_suite(suite, mongo_root, test_binary):38 cmd = test_binary + ['--suites={}'.format(suite), '-n']39 proc = run(cmd, stdout=PIPE, cwd=mongo_root)40 out = proc.stdout.decode('utf-8').splitlines()41 tests = [path.join(mongo_root, line) for line in out if line.startswith(42 'jstests') and line.endswith('.js')]43 return tests44def get_cmd_args():45 parser = ArgumentParser(46 description='Run jstests/core tests with resmoke.py')47 parser.add_argument('-m', '--mongo-root', required=True,48 help='Path to mongo source root directory.abs')49 parser.add_argument('-d', '--dbpath', required=True,50 help='Directory where database is created.')51 parser.add_argument('-s', '--suite', required=True, help='Suite to run.')52 parser.add_argument('--timeout', type=int, default=5 *53 60, help='Test case timeout in seconds.')54 parser.add_argument(55 '-t',56 '--tests',57 nargs='+',58 help='Tests from selected suite to run, default: run all.')59 return parser.parse_args()60def execute_tests(args):61 test_dir = path.join(args.mongo_root, 'jstests', args.suite)62 test_binary = [path.join(args.mongo_root, 'buildscripts', 'resmoke.py')]63 test_args = ['--continueOnFailure',64 '--storageEngine=pmse',65 '--suites={}'.format(args.suite),66 '--dbpath={}'.format(args.dbpath)]67 if args.tests:68 tests = args.tests69 else:70 tests = get_tests_for_suite(args.suite, args.mongo_root, test_binary)71 failed = []72 passed_warnings = OrderedDict()73 timeout = []74 out = ''75 margin = len(max(tests, key=len)) + 876 for test in sorted(tests):77 cmd = test_binary + test_args78 cmd.append(path.join(test_dir, test))79 print_output = False80 skipped = False81 print('{} ...'.format(test).ljust(margin), end='', flush=True)82 start = perf_counter()83 try:84 proc = run(cmd, stderr=STDOUT, stdout=PIPE,...

Full Screen

Full Screen

GetTests.py

Source:GetTests.py Github

copy

Full Screen

...30 data = {GetSuiteInfo.SUITE_PATH: suite_path,31 GetSuiteInfo.SUITE_SHORT_PATH: GetSuiteInfo.get_short_path(suite_path)}32 else:33 variables = [{"VarName": v.name, "VarValue": v.value} for v in suite_data.variable_table.variables]34 tests, children = GetSuiteInfo.get_tests_for_suite(suite_path)35 data = {GetSuiteInfo.SUITE_NAME: suite_data.name,36 GetSuiteInfo.SUITE_ID: secrets.token_hex(8),37 GetSuiteInfo.SUITE_PATH: os.path.abspath(suite_data.source),38 GetSuiteInfo.SUITE_SHORT_PATH: GetSuiteInfo.get_short_path(suite_path),39 GetSuiteInfo.SUITE_VARIABLES: variables,40 GetSuiteInfo.SUITE_TESTS: tests,41 GetSuiteInfo.SUITE_TEST_NUMBERS: len(tests) if tests else 0}42 if data.get(GetSuiteInfo.SUITE_NAME) is not None:43 suites_data.append(data)44 return suites_data45 @staticmethod46 def get_tests_for_suite(path_to_suite: str = None, parent: TestData = None):47 """48 Args:49 path_to_suite: the string representation of path to x.robot file50 parent: suite type, used for children to recursively find all children51 Returns:52 list of all test cases in the suite and its children53 """54 try:55 tests_data = TestData(parent=parent, source=path_to_suite)56 except NoTestsFound:57 return [], []58 else:59 tests = []60 text_index = 0...

Full Screen

Full Screen

test_runner_test.py

Source:test_runner_test.py Github

copy

Full Screen

...84 yield85 def test_get_tests_for_suite_in_suite(self):86 self.in_suite_mock.return_value = True87 instance = test_runner.TestRunner(mock.sentinel.test_class)88 ret = instance.get_tests_for_suite(mock.sentinel.selected_suite_name)89 assert_equal(list(ret), [self.mock_test_method])90 def test_get_tests_for_suite_not_in_suite(self):91 self.in_suite_mock.return_value = False92 instance = test_runner.TestRunner(mock.sentinel.test_class)93 ret = instance.get_tests_for_suite(mock.sentinel.selected_suite_name)...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Testify automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful