Skip to content

Commit

Permalink
save overwrite existing test step
Browse files Browse the repository at this point in the history
  • Loading branch information
tamvanvo committed Jan 18, 2018
1 parent fb2d0bd commit 421a5b6
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ public Publisher newInstance(StaplerRequest req, JSONObject formData) throws hud
configuration.setReadFromJenkins(formData.getBoolean("readFromJenkins"));
configuration.setEachMethodAsTestCase(formData.getBoolean("eachMethodAsTestCase"));
configuration.setContainerJSONSetting(formData.getString("containerJSONSetting"));
configuration.setOverwriteExistingTestSteps(formData.getBoolean("overwriteExistingTestSteps"));
configuration = ConfigService.validateConfiguration(configuration, formData);

//if have url, we try to update configuration to qTest
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/com/qasymphony/ci/plugin/model/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class Configuration extends AbstractDescribableImpl<Configuration> {

private boolean submitToContainer;
private String containerJSONSetting;
private boolean overwriteExistingTestSteps;
/**
* Read from testResult action from jenkins
*/
Expand All @@ -53,14 +54,14 @@ public void setContainerJSONSetting(String containerJSONSetting) {

public static Configuration newInstance() {
return new Configuration(0L, "", "", 0, "", 0L, "", 0, "",
0, 0, false, "", false, "{}");
0, 0, false, "", false, "{}", false);
}

@DataBoundConstructor
public Configuration(Long id, String url, String appSecretKey, long projectId,
String projectName, long releaseId, String releaseName, long environmentId,
String environmentName, long testSuiteId, long moduleId, Boolean readFromJenkins, String resultPattern,
Boolean submitToContainer, String containerJSONSetting) {
Boolean submitToContainer, String containerJSONSetting, Boolean overwriteExistingTestSteps) {
this.url = url;
this.appSecretKey = appSecretKey;
this.projectId = projectId;
Expand All @@ -76,6 +77,7 @@ public Configuration(Long id, String url, String appSecretKey, long projectId,
this.resultPattern = resultPattern;
this.submitToContainer = submitToContainer;
this.containerJSONSetting = containerJSONSetting;
this.overwriteExistingTestSteps = overwriteExistingTestSteps;
}

public Long getId() {
Expand Down Expand Up @@ -223,6 +225,14 @@ public Configuration setSubmitToContainer(boolean submitToContainer) {
return this;
}

public boolean isOverwriteExistingTestSteps() {
return overwriteExistingTestSteps;
}

public void setOverwriteExistingTestSteps(boolean overwriteExistingTestSteps) {
this.overwriteExistingTestSteps = overwriteExistingTestSteps;
}

public boolean isCreateNewTestSuiteEveryBuild() {
try {
JSONObject json = JSONObject.fromObject(this.containerJSONSetting);
Expand Down Expand Up @@ -271,6 +281,7 @@ public Setting toSetting() {
.setProjectId(this.projectId)
.setModuleId(this.moduleId)
.setEnvironmentId(this.environmentId)
.setOverwriteExistingTestSteps(this.overwriteExistingTestSteps)
.setTestSuiteId(this.testSuiteId);

if (this.submitToContainer) {
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/qasymphony/ci/plugin/model/qtest/Setting.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public class Setting {
@JsonProperty("ciid")
private String serverId;

@JsonProperty("overwrite_existing_test_steps")
private Boolean overwriteExistingTestSteps;

public String getCiType() {
return ciType;
}
Expand Down Expand Up @@ -144,6 +147,15 @@ public Setting setServerId(String serverId) {
return this;
}

public Boolean getOverwriteExistingTestSteps() {
return overwriteExistingTestSteps;
}

public Setting setOverwriteExistingTestSteps(Boolean overwriteExistingTestSteps) {
this.overwriteExistingTestSteps = overwriteExistingTestSteps;
return this;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Setting{");
Expand All @@ -163,6 +175,7 @@ public String toString() {
sb.append(", testSuiteId=").append(testSuiteId);
sb.append(", moduleId=").append(moduleId);
sb.append(", environmentId=").append(environmentId);
sb.append(", overwriteExistingTestSteps=").append(overwriteExistingTestSteps);
sb.append(", serverId='").append(serverId).append('\'');
sb.append('}');
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
.container-pid-input {
width: 15%;
}
.createNewTestSuiteCheckbox {
.checkbox-input {
top: 0 !important;
}
.container-link {
Expand Down Expand Up @@ -56,10 +56,6 @@
value="${instance.configuration.releaseId}"/>
<f:textbox name="config.environmentId" field="environmentId"
value="${instance.configuration.environmentId}"/>
<f:textbox name="config.containerId" field="containerId"
value="${instance.configuration.containerId}"/>
<f:textbox name="config.containerType" field="containerType"
value="${instance.configuration.containerType}"/>

<f:textbox name="config.projectName" field="projectName"
value="${instance.configuration.projectName}"/>
Expand Down Expand Up @@ -102,7 +98,7 @@
</f:entry>
<f:entry field="checkedCreateNewTestRuns">
<f:checkbox id="createNewTestRun" name="config.createNewTestSuiteEveryBuild" checked="${instance.configuration.createNewTestSuiteEveryBuild}"
class="createNewTestSuiteCheckbox" value="true"/>
class="checkbox-input" value="true"/>
<label for="createNewTestRun">${%label.checkedNewTestRuns}</label>
</f:entry>
</f:radioBlock>
Expand All @@ -115,8 +111,14 @@
<i>${%env.inactive}</i>
</span>
</f:entry>

<f:entry field="jenkinsProjectName">

<f:block>
<f:checkbox id="overwriteExistingTestSteps" name="config.overwriteExistingTestSteps" checked="${instance.configuration.overwriteExistingTestSteps}"
class="checkbox-input" value="true"/>
<label for="overwriteExistingTestSteps">${%label.overwriteExistingTestSteps}</label>
</f:block>

<f:entry field="jenkinsProjectName">
<f:radioBlock inline="true" name="config.readFromJenkins" checked="${instance.configuration.readFromJenkins}"
title="${%label.autoScan}" value="true">
<f:description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ label.class_mode=Each JUnit Test Suite (class) = a qTest Test Case
label.method_mode=Each JUnit Test Case (method) = a qTest Test Case
label.releaseOption = Submit test result to a Release as settings in your qTest Manager
label.existingContainerOption = Submit test results to an existing container
label.overwriteExistingTestSteps = Overwrite existing test steps and test step logs
label.container = Container
label.checkedNewTestRuns = Create new Test Runs every build date
instruction.testLog= * Test Logs submitted to qTest will be associated with the target Release
Expand Down

0 comments on commit 421a5b6

Please sign in to comment.