(t *testing.T)
| 27 | } |
| 28 | |
| 29 | func TestRunPassed(t *testing.T) { |
| 30 | context := test.NewContextBuilder(). |
| 31 | WithDefinition("studio", studio.StudioDefinition). |
| 32 | WithCommandPlugin(NewTestRunCommand()). |
| 33 | WithUrlResponse("/my-org/my-tenant/orchestrator_/odata/Folders?$filter=FullyQualifiedName eq 'Shared'", http.StatusOK, `{"value":[{"Id":938064,"FullyQualifiedName":"Shared"}]}`). |
| 34 | WithUrlResponse("/my-org/my-tenant/orchestrator_/api/PackageFeeds/GetFolderFeed?folderId=938064", http.StatusOK, `null`). |
| 35 | WithUrlResponse("/my-org/my-tenant/orchestrator_/odata/Processes/UiPath.Server.Configuration.OData.UploadPackage", http.StatusOK, `{}`). |
| 36 | WithUrlResponse("/my-org/my-tenant/orchestrator_/odata/Releases?$filter=ProcessKey eq 'MyProcess_Tests'", http.StatusOK, `{"value":[]}`). |
| 37 | WithUrlResponse("/my-org/my-tenant/orchestrator_/odata/Releases", http.StatusCreated, `{"name":"MyProcess_Tests","processKey":"MyProcess_Tests","processVersion":"1.0.195912597"}`). |
| 38 | WithUrlResponse("/my-org/my-tenant/orchestrator_/api/TestAutomation/CreateTestSetForReleaseVersion", http.StatusCreated, "25819"). |
| 39 | WithUrlResponse("/my-org/my-tenant/orchestrator_/api/TestAutomation/StartTestSetExecution?testSetId=25819&triggerType=ExternalTool", http.StatusOK, "349562"). |
| 40 | WithUrlResponse("/my-org/my-tenant/orchestrator_/odata/TestSets(25819)?$expand=TestCases($expand=Definition;$select=Id,Definition,DefinitionId,ReleaseId,VersionNumber),Packages&$select=TestCases,Name", http.StatusOK, |
| 41 | `{ |
| 42 | "TestCases":[{ |
| 43 | "Id":169537, |
| 44 | "Definition":{ |
| 45 | "Name":"MyTestCase", |
| 46 | "PackageIdentifier":"1.1.1" |
| 47 | } |
| 48 | }], |
| 49 | "Packages":[{ |
| 50 | "PackageIdentifier":"MyTestPackage", |
| 51 | "VersionMask":"1.2.3" |
| 52 | }] |
| 53 | }`). |
| 54 | WithUrlResponse("/my-org/my-tenant/orchestrator_/odata/TestSetExecutions(349562)?$expand=TestCaseExecutions($expand=TestCaseAssertions)", http.StatusOK, |
| 55 | `{ |
| 56 | "Name":"Automated - MyProcess_Tests - 1.0.195912597", |
| 57 | "TestSetId":25819, |
| 58 | "StartTime":"2025-03-17T12:10:09.053Z", |
| 59 | "EndTime":"2025-03-17T12:10:18.183Z", |
| 60 | "Status":"Passed", |
| 61 | "Id":349562, |
| 62 | "TestCaseExecutions":[{ |
| 63 | "Id":704170, |
| 64 | "TestCaseId":169537, |
| 65 | "EntryPointPath":"TestCase.xaml", |
| 66 | "StartTime":"2025-03-17T12:10:09.087Z", |
| 67 | "EndTime":"2025-03-17T12:10:18.083Z", |
| 68 | "Status":"Passed", |
| 69 | "JobId":12345, |
| 70 | "JobKey":"b6dd3f45-03c6-46c2-98ad-95a05f59905d", |
| 71 | "DataVariationIdentifier":"1", |
| 72 | "VersionNumber":"2.2.2", |
| 73 | "InputArguments":"{}", |
| 74 | "OutputArguments":"{}" |
| 75 | }] |
| 76 | }`). |
| 77 | Build() |
| 78 | |
| 79 | source := test.NewCrossPlatformProject(t). |
| 80 | Build() |
| 81 | result := test.RunCli([]string{"studio", "test", "run", "--source", source, "--organization", "my-org", "--tenant", "my-tenant"}, context) |
| 82 | |
| 83 | stdout := test.ParseOutput(t, result.StdOut) |
| 84 | expected := map[string]interface{}{ |
| 85 | "testSetExecutions": []interface{}{ |
| 86 | map[string]interface{}{ |
nothing calls this directly
no test coverage detected