(ctx plugin.ExecutionContext, results []testRunStatus, resultsOutput string, writer output.OutputWriter)
| 76 | } |
| 77 | |
| 78 | func (c TestRunCommand) writeOutput(ctx plugin.ExecutionContext, results []testRunStatus, resultsOutput string, writer output.OutputWriter) error { |
| 79 | var data []byte |
| 80 | var err error |
| 81 | if resultsOutput == "uipath" { |
| 82 | converter := newUiPathReportConverter() |
| 83 | report := converter.Convert(results) |
| 84 | data, err = json.Marshal(report) |
| 85 | if err != nil { |
| 86 | return fmt.Errorf("run command failed: %w", err) |
| 87 | } |
| 88 | } else { |
| 89 | client := api.NewOrchestratorClient(ctx.BaseUri, ctx.Organization, ctx.Tenant, nil, false, ctx.Settings, nil) |
| 90 | converter := newJUnitReportConverter(client) |
| 91 | report := converter.Convert(results) |
| 92 | data, err = xml.MarshalIndent(report, "", " ") |
| 93 | if err != nil { |
| 94 | return fmt.Errorf("run command failed: %w", err) |
| 95 | } |
| 96 | } |
| 97 | return writer.WriteResponse(*output.NewResponseInfo(http.StatusOK, "200 OK", "HTTP/1.1", map[string][]string{}, bytes.NewReader(data))) |
| 98 | } |
| 99 | |
| 100 | func (c TestRunCommand) prepareExecution(sources []string, timeout time.Duration, attachRobotLogs bool, folder string, logger log.Logger) ([]testRunParams, error) { |
| 101 | tmp, err := directories.Temp() |
no test coverage detected