def run(self, active=True, status=None, labels=None): """Run the test suite. If active=True, only active tests will be run. If status is provided, only tests whose most recent run status matches the set provided will be executed. If labels is provided, only tests with those labels will be executed """ count, labels = self.project.find_tests(active, status, labels) self.run_status.set('Running...') self.run_summary.set('T:%s P:0 F:0 E:0 X:0 U:0 S:0' % count) self.stop_button.configure(state=NORMAL) self.run_all_button.configure(state=DISABLED) self.run_selected_button.configure(state=DISABLED) self.rerun_button.configure(state=DISABLED) self.progress['maximum'] = count self.progress_value.set(0) # Create the runner self.executor = Executor(self.project, count, labels) # Queue the first progress handling event self.root.after(100, self.on_testProgress)
async def run(self, active=True, status=None, labels=None): """Run the test suite. If active=True, only active tests will be run. If status is provided, only tests whose most recent run status matches the set provided will be executed. If labels is provided, only tests with those labels will be executed """ if labels: count = len(labels) else: count, labels = self.test_suite.find_tests(active, status) self.run_status.text = 'Running...' self.run_summary.text = 'T:{count} P:0 F:0 E:0 X:0 U:0 S:0'.format(count=count) self.stop_command.enabled = True self.run_all_command.enabled = False self.run_selected_command.enabled = False self.rerun_command.enabled = False self.progress.max = count self.progress.value = 0 # Create the executor... self.executor = Executor(self.test_suite, self) # ...and run it await self.executor.run(count, labels) # Once it's done, clean up. self.executor = None self.reset_button_states_on_end()
def test_run_methods_tests_in_different_tests_cases(self): ''' Test coverage in a test module, selecting test methods from different tests cases (but not all tests cases from a test module) ''' count, new_labels = self.project.find_tests(True, None, self.labels) self.executor = Executor(self.project, count, new_labels) self.executor.poll() self.assertEquals( self.executor.result_count.get(TestMethod.STATUS_PASS, 0), 4)
def test_run_methods_tests_in_different_tests_cases(self): ''' Test coverage in a test module, selecting test methods from different tests cases (but not all tests cases from a test module) ''' # count, new_labels = self.test_suite.find_tests(True, None, self.labels) count, new_labels = self.test_suite.find_tests(True, None) self.executor = Executor(self.test_suite) # self.executor.poll() loop = asyncio.get_event_loop() loop.run_until_complete(self.executor.run(count, new_labels)) loop.close() self.assertEquals( self.executor.result_count.get(TestMethod.STATUS_PASS, 0), count)