How to use get_suites method in lisa

Best Python code snippet using lisa_python

runner.py

Source:runner.py Github

copy

Full Screen

1# coding=utf-82"""3using method:4 input command in cmd linke "python runner.py case_2 case_1"5"""6import os7import sys8import time9import datetime10from importlib import reload11__author__ = "zzh"12# 当前路径13path = os.path.abspath(__file__)14path = os.path.dirname(path)15print(path)16sys.path.insert(0, path + "/../../")17sys.path.insert(0, '..')18print(sys.path)19from runners.runner import get_suites20from runners.runner import report_parse21from runners.runner import HTMLTestRunner22from utils.global_var import GlobalVarClass23from utils.ding_msg_send import DingMsgSend24# 获取当前时间,组成文件名25date = time.strftime("%Y%m%d", time.localtime()) # 日期【20150213】26timestamp = str(int(time.time())) # 时间戳【1423813170】27report_file_name = date + timestamp + '.html'28if GlobalVarClass.get_now_time() == "":29 now_time = str(datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d_%H_%M_%S'))30 GlobalVarClass.set_now_time(now_time)31def run_test_cases(test_sets, report_dir, report_title):32 """33 运行测试用例34 test_sets:字典格式的测试集35 """36 # 判断报告文件夹是否存在,若不存在则创建37 is_exist = os.path.exists(report_dir)38 if is_exist is False:39 os.makedirs(report_dir)40 # 指定测试集41 root = os.path.dirname(os.path.abspath(__file__)) + "/../../testcases"42 test_suites = get_suites.generate_suites(root, test_sets) # 只运行指定测试用例集43 # test_suites = nose.collector() # 运行全部用例44 # 定义报告名称45 file_path = report_dir + '/' + report_file_name46 print("报告目录" + file_path)47 fp = open(file_path, 'wb')48 runner = HTMLTestRunner.HTMLTestRunner(49 stream=fp,50 title=report_title # 如:'共享平台接口测试[ApiTest for SDP]'51 )52 runner.run(test_suites)53def get_report_path(report_file):54 """55 根据配置的文件结构,生成文件路径56 path:当前路径57 """58 tmp = report_file.split('.')59 report_file_path = "test_reports"60 for i in tmp:61 report_file_path += "/"62 report_file_path += i63 report_dir = path + "/../../" + report_file_path64 return report_dir65if __name__ == "__main__":66 case_list = get_suites.set_case_list() # 获取划分的测试集信息列表67 if case_list is None:68 print("case_list is empty")69 exit()70 for case_info in case_list:71 # print "case_info: ", case_info72 report_file_dir = case_info[u'report_file']73 test_sets = case_info[u'cases']74 receivers = case_info[u'receivers']75 group = case_info[u'group']76 title = case_info[u'title']77 report_dir = get_report_path(report_file_dir)78 run_test_cases(test_sets, report_dir, title)79 res = report_parse.get_result(report_dir, title, report_file_name, date, timestamp)80 ding_send_msg = DingMsgSend(group[0])81 ding_send_msg.send_msg(res)82 # for g in group:83 # receivers.append(g)84 # mail = Mail()85 # mail.subject = "UI自动化测试结果"86 # mail.mail_to = receivers87 # mail.send_mail(res)...

Full Screen

Full Screen

suites.py

Source:suites.py Github

copy

Full Screen

...21 client.user = 'dmitriy.zverev@homecredit.ru'22 client.password = 'Qwerty_22'23 case = client.send_get('get_suite/51')24 pprint(case)25def get_suites():26 """27 Ручка для получения информации о сьютах в проекте.28 Входящий параметр: project_id29 """30 client = APIClient('https://testrail.homecred.it')31 client.user = 'dmitriy.zverev@homecredit.ru'32 client.password = 'Qwerty_22'33 case = client.send_get('get_suites/5')34 pprint(case)35def update_suite():36 """37 Ручка для изменения существующего сьюта.38 Входящий параметр: suite_id39 Data: name...

Full Screen

Full Screen

sous_suite_monotone.py

Source:sous_suite_monotone.py Github

copy

Full Screen

...9 """Renvoie les nombres du (ou des) fichier(s) dans une seule liste10 """11 with open(sys.argv[1], 'r') as file:12 return iter(file.read().split())13def get_suites():14 """Renvoie les suites monotones15 """16 numbers = get_numbers()17 suite = [next(numbers, None)]18 monotonie = None19 while numbers:20 try:21 first = suite[-1]22 second = next(numbers)23 #print("second", second)24 if second < first:25 #print("décroissante")26 if monotonie: #détecte le changement de monotonie27 yield suite28 suite = [first]29 suite.append(second)30 #print(suite)31 monotonie = 032 elif second > first:33 #print("croissante")34 if not monotonie: #détecte le changement de monotonie35 yield suite36 suite = [first]37 suite.append(second)38 #print(suite)39 monotonie = 140 elif second == first:41 suite.append(second)42 #print(suite)43 else:44 yield suite45 suite = [first]46 except StopIteration:47 yield suite48 break49def get_max_suite():50 """Get the biggest sequence51 """52 return max([suite for suite in get_suites()], key=len)53def main():54 """main function55 """56 biggest_suite = get_max_suite()57 print(biggest_suite)...

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