azure-devops-test-helper
Version:
Import JSON result with attachments into Azure Test Plan
26 lines (25 loc) • 975 B
JavaScript
import { getAutomatedTestPointIds } from "./case.js";
export async function createTestRun(azureClient, testCases, config, executedConfigurationIds) {
const testPointIds = getAutomatedTestPointIds(testCases, config.automatedStatus ?? "Planned", executedConfigurationIds, config.override);
const testRun = await azureClient.createTestRun({
name: config.runName,
pointIds: testPointIds.filter((id) => id),
configurationIds: executedConfigurationIds,
plan: {
id: `${config.planId}`,
name: config.runName,
},
automated: true,
build: {
id: String(config.buildId),
},
comment: config.comment,
}, config.project);
return testRun;
}
export async function setRunStatus(azureClient, config, testRunId, status) {
const inProgressRunModel = {
state: status,
};
return azureClient.updateTestRun(inProgressRunModel, config.project, testRunId);
}