/
test_run.go
57 lines (38 loc) · 1.37 KB
/
test_run.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package polarion
import "fmt"
func (s *Session) GetTestRunByID(projectID, id string) (*TestRun, error) {
request := NewGetTestRunByIDRequest(projectID, id)
response := &GetTestRunByIDResponseBody{}
err := s.request(testManagementService, request, response)
if err != nil {
return nil, err
}
if response.Fault.Faultcode != "" {
return nil, fmt.Errorf("getTestRunById request failed with error: %s", response.Fault.Faultstring)
}
return &response.TestRun, nil
}
func (s *Session) CreateTestRun(projectID, id, templateID string) (string, error) {
request := NewCreateTestRunRequest(projectID, id, templateID)
response := &CreateTestRunResponseBody{}
err := s.request(testManagementService, request, response)
if err != nil {
return "", err
}
if response.Fault.Faultcode != "" {
return "", fmt.Errorf("createTestRun request failed with error: %s", response.Fault.Faultstring)
}
return response.URI, nil
}
func (s *Session) UpdateTestRun(uri string, title string, isTemplate bool, plannedIn string) error {
request := NewUpdateTestRunRequest(uri, title, isTemplate, plannedIn)
response := &UpdateTestRunResponseBody{}
err := s.request(testManagementService, request, response)
if err != nil {
return err
}
if response.Fault.Faultcode != "" {
return fmt.Errorf("updateTestRun request failed with error: %s", response.Fault.Faultstring)
}
return nil
}