(run)
| 61 | |
| 62 | |
| 63 | def getResultsForRun(run): |
| 64 | url = run["artifacts_url"] |
| 65 | print(f"Getting artifacts from {url}") |
| 66 | artifactsResponse = requests.get( |
| 67 | url, headers={"Accept": "application/vnd.github+json"} |
| 68 | ) |
| 69 | |
| 70 | if artifactsResponse.status_code != 200: |
| 71 | print(f"Error {artifactsResponse.status_code} getting artifacts") |
| 72 | return [] |
| 73 | |
| 74 | artifacts = artifactsResponse.json()["artifacts"] |
| 75 | |
| 76 | results = [] |
| 77 | for artifact in artifacts: |
| 78 | if ( |
| 79 | artifact["name"].startswith( |
| 80 | "TestResult-" # previous artifact name (pre ~2022-09-12) |
| 81 | ) |
| 82 | or artifact["name"].startswith( |
| 83 | "TestResults-" # previous performance tests artifact name |
| 84 | ) |
| 85 | or artifact["name"].startswith( |
| 86 | "TestLogs-" # consolidated artifact name, contains multiple files |
| 87 | ) |
| 88 | ): |
| 89 | print(f" retrieving {artifact['name']}") |
| 90 | rawData = getArtifactData(artifact["id"]) |
| 91 | testRunResults = getResultsJson(rawData) |
| 92 | results.append( |
| 93 | { |
| 94 | "scenario": artifact["name"], |
| 95 | "date": run["created_at"], |
| 96 | "runUrl": run["html_url"], |
| 97 | "data": testRunResults, |
| 98 | } |
| 99 | ) |
| 100 | print(f" {len(testRunResults)} results read") |
| 101 | |
| 102 | return results |
| 103 | |
| 104 | |
| 105 | def flattenTestResultsToFile(runResults, filename): |
no test coverage detected