How to use update_testcases method in lettuce-tools

Best Python code snippet using lettuce-tools_python

features_manager.py

Source:features_manager.py Github

copy

Full Screen

...41 data_feature.pop(0)42 except:43 print >>stream, Fore.RED + "Error de carga de archivo"44 # Publish all the test cases not published before in Jira45 scenarios_key = update_testcases(data_feature, [], jira_project)46 # Creates links in Jira between Test cases and User Stories47 jira_project.link_testcases(scenarios_key, user_story_key)48 # Process the feature description and removes html formating elements49 sain_feature = sanitize_feature(description)50 # Compose updated feature with the information downloaded from jira51 if not (summary and sain_feature):52 # Keep the current feature if there were problems getting it from Jira53 old_feature.extend(data_feature)54 header.extend(old_feature)55 ready_feature = header56 else:57 ready_feature = compose_feature(header, sain_feature, data_feature, summary)58 try:59 with open(root + "/" + files, mode="w") as toupdate_feature:60 toupdate_feature.truncate()61 toupdate_feature.seek(0)62 for writeline in ready_feature:63 if "Scenario" in writeline and not not scenarios_key and \64 writeline.find(jira_project.project + "-") == -1:65 writeline = writeline.replace("\n", "") + "_" + scenarios_key.pop(0) + "\n"66 toupdate_feature.write(writeline)67 toupdate_feature.flush()68 except:69 print >>stream, Fore.RED + "Error de escritura de archivo"70 print >>stream, Fore.GREEN + "\t\tIssue: " + user_story_key + " has been updated \n"71def sanitize_feature(feature):72 """ Removes html formating characters and aligns the information contained in the feature"""73 feature = feature.replace("<br />", "\n")74 feature = feature.replace("</p>", "\n")75 feature = re.sub(r'<[^>]*?>', '', feature) # remove the rest of the html tags76 featuresplit = feature.splitlines()77 sanitized = ["\t" + item + '\n' for item in featuresplit if item != ""]78 return sanitized79def compose_feature(header, sain_feature, scenarios, summary):80 """ Composes feature file with the header, the information updated from Jira, the sanitized feature81 description and the scenarios"""82 sain_feature.insert(0, "Feature: " + summary + "\n\n")83 sain_feature.append(" \n")84 sain_feature.extend(scenarios)85 header.extend(sain_feature)86 return header87def update_testcases(pending_scenarios, scenarios_key, jira_project):88 init(wrap=False)89 stream = AnsiToWin32(sys.stderr).stream90 scenario_counter = 091 scenario = []92 scenarios = []93 scenarios.extend(pending_scenarios)94 # Start the scenario with first "Scenario definition" in the list95 try:96 scenario.append(scenarios.pop(0))97 for item in scenarios:98 if ("Scenario") in item:99 break100 scenario_counter = scenario_counter + 1101 for item in range(scenario_counter):102 scenario.append(scenarios.pop(0))103 #check if the Test case has been published previously based on the issue key and requests the publication104 try:105 test_key = jira_project.project + (scenario[0].split("_" + jira_project.project)[1]).replace("\n", "")106 print >>stream, Fore.MAGENTA + "\t Scenario detected to be updated" + Fore.YELLOW107 jira_project.publish_testcase(scenario, test_key)108 except:109 print >>stream, Fore.MAGENTA + "\t Scenario detected to be published" + Fore.YELLOW110 scenarios_key.append(jira_project.publish_testcase(scenario, ""))111 update_testcases(scenarios, scenarios_key, jira_project)112 except:113 print >>stream, Fore.WHITE + "\t No more scenarios to be processed \n"...

Full Screen

Full Screen

integration_tests.py

Source:integration_tests.py Github

copy

Full Screen

1import os2import os.path as op3import shutil4import subprocess5import tempfile6import unittest7# Set this to True to update the test case data in place.8UPDATE_TESTCASES = bool(os.environ.get("UPDATE_TESTCASES", False))9def run_nmssearch(args, **kwds):10 proc = subprocess.run(["../build/nmssearch"] + args, check=True, encoding="utf-8", **kwds)11 return proc12class NMSSearchTestCase:13 def _build(self):14 index_name = op.join(self.d, "index.bin")15 run_nmssearch(self.build_parameters + ["build", self.seqs_file, index_name])16 return index_name17 def _run(self, index_name):18 proc = run_nmssearch(19 self.query_parameters + ["query", index_name, self.query_file],20 stdout=subprocess.PIPE,21 )22 return proc.stdout23 def test_build_then_query(self):24 self.d = d = tempfile.mkdtemp()25 try:26 index_name = self._build()27 output = self._run(index_name)28 if UPDATE_TESTCASES:29 with open(self.output_file, "wt", encoding="utf-8") as fp:30 fp.write(output)31 with open(self.output_file, encoding="utf-8") as fp:32 expected = fp.read()33 self.assertMultiLineEqual(output, expected)34 finally:35 shutil.rmtree(d)36class TestHNSWAlignSmall(unittest.TestCase, NMSSearchTestCase):37 build_parameters = []38 query_parameters = []39 seqs_file = "data/seqs-small.fa"40 query_file = "data/query-small.fa"41 output_file = "data/output/hnsw-align-small.tsv"42class TestVPTreeAlignSmall(unittest.TestCase, NMSSearchTestCase):43 build_parameters = ["--algorithm", "vptree"]44 query_parameters = ["--algorithm", "vptree"]45 seqs_file = "data/seqs-small.fa"46 query_file = "data/query-small.fa"47 output_file = "data/output/hnsw-align-small.tsv"48class TestBruteforceAlignSmall(unittest.TestCase, NMSSearchTestCase):49 build_parameters = ["--algorithm", "bruteforce"]50 query_parameters = ["--algorithm", "bruteforce"]51 seqs_file = "data/seqs-small.fa"52 query_file = "data/query-small.fa"53 output_file = "data/output/hnsw-align-small.tsv"54 def _build(self):55 return self.seqs_file56class TestHNSWSpectrumSmall(unittest.TestCase, NMSSearchTestCase):57 build_parameters = ["--kmer-length", "2", "--algorithm", "hnsw-kmer"]58 query_parameters = ["--kmer-length", "2", "--algorithm", "hnsw-kmer"]59 seqs_file = "data/seqs-small.fa"60 query_file = "data/query-small.fa"61 output_file = "data/output/hnsw-spectrum-small.tsv"62class TestBruteforceSpectrumSmall(unittest.TestCase, NMSSearchTestCase):63 build_parameters = ["--kmer-length", "2", "--algorithm", "bruteforce-kmer"]64 query_parameters = ["--kmer-length", "2", "--algorithm", "bruteforce-kmer"]65 seqs_file = "data/seqs-small.fa"66 query_file = "data/query-small.fa"67 output_file = "data/output/hnsw-spectrum-small.tsv"68if __name__ == "__main__":...

Full Screen

Full Screen

manage.py-tpl

Source:manage.py-tpl Github

copy

Full Screen

...14 type=str,15 help="Jenkins build url")16 args = parser.parse_args()17 if args.operation == 'uploadTestCases':18 return update_testcases()19 else:20 build_url = args.build_url21 return update_result(build_url)22if __name__ == '__main__':...

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 lettuce-tools 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