Skip to content

Improved code for updating testRun #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/main/java/com/rmn/testrail/entity/TestRunUpdater.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.rmn.testrail.entity;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;

/**
* @author Sergey Franchuk
* This class has fields which are available for uptating testRun.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class TestRunUpdater extends BaseEntity {

@JsonProperty("name")
private String name;
public String getName() { return name; }
public void setName(String name) { this.name = name; }

@JsonProperty("description")
private String description;
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }

@JsonProperty("milestone_id")
private Integer milestoneId;
public Integer getMilestoneId() { return milestoneId; }
public void setMilestoneId(Integer milestoneId) { this.milestoneId = milestoneId; }

@JsonProperty("include_all")
private Boolean includeAll;
public Boolean isIncludeAll() { return includeAll; }
public void setIncludeAll(Boolean includeAll) { this.includeAll = includeAll; }

@JsonProperty("case_ids")
private Integer[] caseIds;
public Integer[] getCaseIds() { return caseIds; }
public void setCaseIds(Integer[] caseIds) { this.caseIds = caseIds; }
}
13 changes: 13 additions & 0 deletions src/main/java/com/rmn/testrail/service/TestRailService.java
Original file line number Diff line number Diff line change
Expand Up @@ -779,15 +779,28 @@ public TestRun addTestRun(int projectId, TestRunCreator run) {
}

/**
* This method is deprecated, because some redundant fields for updating are present in TestRun object and some supported fields are absent. <br/>
* Use {@link #updateTestRun(int, TestRunUpdater)} method. <br/>
* Updates an existing test run (partial updates are supported, i.e. you can submit and update specific fields only).
* @param runId The ID of the test run
* @param testRun the TestRun object with updated fields
* @return the updated test run
*/
@Deprecated
public TestRun updateTestRun(int runId, TestRun testRun) {
return postRESTBodyReturn(TestRailCommand.UPDATE_RUN.getCommand(), Integer.toString(runId), testRun, TestRun.class);
}

/**
* Updates an existing test run (partial updates are supported, i.e. you can submit and update specific fields only).
* @param runId The ID of the test run
* @param testRunUpdater the {@link TestRunUpdater} object with available for updating fields
* @return the updated test run
*/
public TestRun updateTestRun(int runId, TestRunUpdater testRunUpdater) {
return postRESTBodyReturn(TestRailCommand.UPDATE_RUN.getCommand(), Integer.toString(runId), testRunUpdater, TestRun.class);
}

/**
* Closes an existing test run and archives its tests and results.
* Please note: Closing a test run cannot be undone.
Expand Down