Skip to content

Commit

Permalink
Merge pull request #28 from renzors/master
Browse files Browse the repository at this point in the history
Adding GetCasesWithCustomFields to map testcase custom fields
  • Loading branch information
educlos authored Sep 14, 2021
2 parents e6aa3dc + d462179 commit a998cc5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions case.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,24 @@ func (c *Client) GetCases(projectID, suiteID int, sectionID ...int) ([]Case, err
return returnCases, err
}

// GetCasesWithCustomFields returns a interface that can be mapped to an array that contains custom fields
// on project projectID for a Test Suite suiteID
// or for specific section sectionID in a Test Suite
func (c *Client) GetCasesWithCustomFields(projectID, suiteID int, customArray interface{}, sectionID ...int) error {
uri := fmt.Sprintf("get_cases/%d&suite_id=%d", projectID, suiteID)
if len(sectionID) > 0 {
uri = fmt.Sprintf("%s&section_id=%d", uri, sectionID[0])
}

var err error
if c.useBetaApi {
err = c.sendRequestBeta("GET", uri, nil, &customArray, "cases")
} else {
err = c.sendRequest("GET", uri, nil, &customArray)
}
return err
}

// GetCasesWithFilters returns a list of Test Cases on project projectID
// for a Test Suite suiteID validating the filters
func (c *Client) GetCasesWithFilters(projectID, suiteID int, filters ...RequestFilterForCases) ([]Case, error) {
Expand Down

0 comments on commit a998cc5

Please sign in to comment.