How to use create_send_subtest_msg method in lisa

Best Python code snippet using lisa_python

xfstests.py

Source:xfstests.py Github

copy

Full Screen

...280 if self.node.shell.exists(exclude_file_path):281 self.node.shell.remove(exclude_file_path)282 echo = self.node.tools[Echo]283 echo.write_to_file(exclude_tests, exclude_file_path)284 def create_send_subtest_msg(285 self,286 test_result: TestResult,287 raw_message: str,288 test_type: str,289 data_disk: str,290 ) -> None:291 environment = test_result.environment292 assert environment, "fail to get environment from testresult"293 all_cases_match = self.__all_cases_pattern.match(raw_message)294 assert all_cases_match, "fail to find run cases from xfstests output"295 all_cases = (all_cases_match.group("all_cases")).split()296 not_run_cases: List[str] = []297 fail_cases: List[str] = []298 not_run_match = self.__not_run_cases_pattern.match(raw_message)299 if not_run_match:300 not_run_cases = (not_run_match.group("not_run_cases")).split()301 fail_match = self.__fail_cases_pattern.match(raw_message)302 if fail_match:303 fail_cases = (fail_match.group("fail_cases")).split()304 pass_cases = [305 x for x in all_cases if x not in not_run_cases and x not in not_run_cases306 ]307 results: List[XfstestsResult] = []308 for case in fail_cases:309 results.append(XfstestsResult(case, TestStatus.FAILED))310 for case in pass_cases:311 results.append(XfstestsResult(case, TestStatus.PASSED))312 for case in not_run_cases:313 results.append(XfstestsResult(case, TestStatus.SKIPPED))314 for result in results:315 # create test result message316 info: Dict[str, Any] = {}317 info["information"] = {}318 info["information"]["test_type"] = test_type319 info["information"]["data_disk"] = data_disk320 subtest_message = create_test_result_message(321 SubTestMessage,322 test_result.id_,323 environment,324 result.name,325 result.status,326 other_fields=info,327 )328 # notify subtest result329 notifier.notify(subtest_message)330 def check_test_results(331 self,332 raw_message: str,333 log_path: Path,334 test_type: str,335 result: TestResult,336 data_disk: str = "",337 ) -> None:338 self.create_send_subtest_msg(result, raw_message, test_type, data_disk)339 xfstests_path = self.get_xfstests_path()340 results_path = xfstests_path / "results/check.log"341 if not self.node.shell.exists(results_path):342 raise LisaException(343 f"Result path {results_path} doesn't exist, please check testing runs"344 " well or not."345 )346 results = self.node.tools[Cat].run(str(results_path), force_run=True, sudo=True)347 results.assert_exit_code()348 pass_match = self.__all_pass_pattern.match(results.stdout)349 if pass_match:350 pass_count = pass_match.group("pass_count")351 self._log.debug(352 f"All pass in xfstests, total pass case count is {pass_count}."...

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 lisa 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