from squad_client.core.models import Squad, ALL group_slug = 'lkft' project_slug = 'linux-mainline-master' group = Squad().group(group_slug) project = group.project(project_slug) builds = project.builds(count=10, created_at__lt='2020-09-30T20:40:50.341386Z') for build in builds.values(): print('Getting metrics for build %s' % build.version) metrics = Squad().metrics(fields='id,short_name,result,test_run,suite', ordering='name', count=ALL, test_run__build=build.id).values() for metric in metrics: print('\t%s: %.2f' % (metric.short_name, metric.result))
SquadApi.configure(url=args.server, token=args.token) def getid(url): matches = re.search('^.*/(\d+)/$', url) try: _id = int(matches.group(1)) return _id except ValueError: print('Could not get id for %s' % url) return -1 group = Squad().group(args.group) project = group.project(args.project) environments = project.environments(count=ALL) suites = project.suites(count=ALL) build = project.build(args.build) testruns = build.testruns(fields='id,environment') tests = build.tests( fields='id,short_name,status,environment,suite,test_run').values() metrics = Squad().metrics(fields='id,short_name,result,test_run,suite', count=ALL, test_run__build=build.id).values() env_summaries = { e.slug: { 'pass': 0, 'fail': 0, 'xfail': 0,
#!/usr/bin/env python3 import os import jinja2 import sys sys.path.append('..') from squad_client.core.api import SquadApi from squad_client.core.models import Squad SquadApi.configure(url='https://qa-reports.linaro.org/', token=os.getenv('QA_REPORTS_TOKEN')) group = Squad().group('schneider') project = group.project('schneider') build = project.build('184') testruns = build.testruns(bucket_suites=True, completed=True).values() templateLoader = jinja2.FileSystemLoader(searchpath="./") templateEnv = jinja2.Environment(loader=templateLoader) TEMPLATE_FILE = "schneider_template.html" template = templateEnv.get_template(TEMPLATE_FILE) outputText = template.render(group=group, project=project, build=build, testruns=testruns) with open('schneider_generated_report.html', 'w') as reportFile: reportFile.write(outputText)