How to use report_test_success method in Slash

Best Python code snippet using slash

run_multiuser_tests.py

Source:run_multiuser_tests.py Github

copy

Full Screen

...65 except DXJobFailureError:66 print("Error: analysis failed {}.{}".format(exec_name, i))67 failures.append((exec_name, exec_obj, i))68 return successes, failures69def report_test_success(tname):70 print("Test {} succeeded".format(tname))71def report_test_failure(tname):72 print("Test {} failed".format(tname))73def test_global_wf_from_wdl():74 # As Alice, compile workflow and create global workflow75 login_alice()76 tname = "global_wf_from_wdl"77 wf_source = os.path.join(os.path.abspath(TEST_DIR), "multi_user", "{}.wdl".format(tname))78 compiler_flags = ["-instanceTypeSelection", "dynamic"]79 workflow_id = util.build_executable(80 source_file=wf_source,81 project=PROJECT,82 folder=specific_applet_folder(tname),83 top_dir=TOP_DIR,84 version_id=VERSION_ID,85 compiler_flags=compiler_flags)86 full_workflow_id = "{}:{}".format(PROJECT.get_id(), workflow_id)87 print("Compiled {}".format(full_workflow_id))88 # Strictly increasing global WF version89 global_workflow_version = "1.0.{}".format(int(time.time()))90 print("Global workflow version {}".format(global_workflow_version))91 # Build global workflow from workflow92 global_workflow_name = "globalworkflow-{}".format(tname)93 print("Global workflow name {}".format(global_workflow_name))94 global_wf_build_cmd = [95 "dx",96 "build",97 "--globalworkflow",98 "--from",99 full_workflow_id,100 "--version",101 global_workflow_version,102 "--bill-to",103 BILLING_ORG104 ]105 global_wf_publish_cmd = [106 "dx",107 "publish",108 "{}/{}".format(global_workflow_name, global_workflow_version)109 ]110 try:111 print(" ".join(global_wf_build_cmd))112 subprocess.check_call(global_wf_build_cmd)113 print(" ".join(global_wf_publish_cmd))114 subprocess.check_call(global_wf_publish_cmd)115 except subprocess.CalledProcessError as cpe:116 print("Error building global workflow from {}\n stdout: {}\n stderr: {}".format(117 workflow_id,118 cpe.stdout,119 cpe.stderr120 ))121 raise122 # Do some developer actions on global workflow123 add_developers_cmd = [124 "dx",125 "add",126 "developers",127 global_workflow_name,128 "org-dnanexus_apps"129 ]130 add_users_cmd = [131 "dx",132 "add",133 "users",134 global_workflow_name,135 "user-dnanexus_apps_test_robot"136 ]137 add_categories_cmd = [138 "dx",139 "api",140 global_workflow_name,141 "addCategories",142 '{"categories":["category_1", "category_2"]}'143 ]144 remove_categories_cmd = [145 "dx",146 "api",147 global_workflow_name,148 "removeCategories",149 '{"categories":["category_1", "category_2"]}'150 ]151 add_tags_cmd = [152 "dx",153 "api",154 "{}/{}".format(global_workflow_name, global_workflow_version),155 "addTags",156 '{"tags":["tag_1", "tag_2"]}'157 ]158 remove_tags_cmd = [159 "dx",160 "api",161 "{}/{}".format(global_workflow_name, global_workflow_version),162 "removeTags",163 '{"tags":["tag_1", "tag_2"]}'164 ]165 update_metadata_cmd = [166 "dx",167 "api",168 "{}/{}".format(global_workflow_name, global_workflow_version),169 "update",170 '{"title":"Global WF from WDL 1", "summary":"Summary 1", "developerNotes":"Notes 1"}'171 ]172 try:173 print(" ".join(add_developers_cmd))174 subprocess.check_call(add_developers_cmd)175 print(" ".join(add_users_cmd))176 subprocess.check_call(add_users_cmd)177 print(" ".join(add_categories_cmd))178 subprocess.check_call(add_categories_cmd)179 print(" ".join(remove_categories_cmd))180 subprocess.check_call(remove_categories_cmd)181 print(" ".join(add_tags_cmd))182 subprocess.check_call(add_tags_cmd)183 print(" ".join(remove_tags_cmd))184 subprocess.check_call(remove_tags_cmd)185 print(" ".join(update_metadata_cmd))186 subprocess.check_call(update_metadata_cmd)187 except subprocess.CalledProcessError as cpe:188 print("Error during developer actions on {}\n stdout: {}\n stderr: {}".format(189 global_workflow_name,190 cpe.stdout,191 cpe.stderr192 ))193 raise194 # As Bob, run global workflow195 login_bob()196 exec_objs = util.run_executable(197 oid=global_workflow_name,198 project=PROJECT,199 test_folder=specific_test_folder(tname),200 test_name=tname201 )202 successes, failures = wait_for_completion(exec_objs)203 204 if len(successes) > 0:205 report_test_success(tname)206 elif len(failures) > 0:207 report_test_failure(tname)208 raise RuntimeError("Analysis failed in test {}".format(tname))209def main():210 argparser = argparse.ArgumentParser(211 description="Run dxCompiler multi-user tests on the platform"212 )213 argparser.add_argument(214 "--alice-token",215 help="Token for user-dnanexus_apps_robot on staging",216 required=True,217 )218 argparser.add_argument(219 "--bob-token",...

Full Screen

Full Screen

reporter_interface.py

Source:reporter_interface.py Github

copy

Full Screen

...22 def report_test_start(self, test):23 pass24 def report_test_end(self, test, result):25 if result.is_success():26 self.report_test_success(test, result)27 elif result.is_skip():28 self.report_test_skip(test, result)29 elif result.is_error():30 self.report_test_error(test, result)31 elif result.is_interrupted():32 self.report_test_interrupted(test, result)33 else:34 assert result.is_failure()35 self.report_test_failure(test, result)36 def report_test_success(self, test, result):37 pass38 def report_test_skip(self, test, result):39 pass40 def report_test_error(self, test, result):41 pass42 def report_test_failure(self, test, result):43 pass44 def report_test_interrupted(self, test, result):45 pass46 def report_test_error_added(self, test, error):47 pass48 def report_test_failure_added(self, test, error):49 pass50 def report_test_skip_added(self, test, reason):...

Full Screen

Full Screen

report_test_success.py

Source:report_test_success.py Github

copy

Full Screen

1#!/usr/bin/env python32from utils.reporter import Reporter3if __name__ == '__main__':4 reporter = Reporter()...

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