Skip to content
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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ http://kiwitcms.org/blog/atodorov/2019/02/22/how-to-use-kiwi-tcms-plugins-pt-1/
Files signed with C0C5FF36, Kiwi TCMS <info@kiwitcms.org>


### 8.0 (09 Feb 2020)

This version works only with Kiwi TCMS v8.0 or later!

- Adjust field names for API changes coming in Kiwi TCMS v8.0
- Do not use deprecated `product` field when calling `TestCase.create()` API
- Bug-fix: take into account `TCMS_RUN_ID` environment variable
- Bump jackson-core from 2.10.0 to 2.10.2
- Bump maven-source-plugin from 3.2.0 to 3.2.1
- Bump maven-surefire-plugin from 3.0.0-M3 to 3.0.0-M4
- Bump mockito-core from 3.1.0 to 3.2.4


### 6.7.5 (10 Nov 2019)

Fixes moderate severity issue
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>org.kiwitcms.java</groupId>
<artifactId>kiwitcms-junit-plugin</artifactId>
<packaging>jar</packaging>
<version>6.7.5</version>
<version>8.0</version>

<name>kiwitcms-junit-plugin</name>
<description>JUnit 5 plugin for Kiwi TCMS.</description>
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/org/kiwitcms/java/api/RpcClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2018-2019 Aneta Petkova <aneta.v.petkova@gmail.com>
// Copyright (c) 2019 Alexander Todorov <atodorov@MrSenko.com>
// Copyright (c) 2019-2020 Alexander Todorov <atodorov@MrSenko.com>

// Licensed under the GPLv3: https://www.gnu.org/licenses/gpl.html

Expand Down Expand Up @@ -72,9 +72,8 @@ public void logout() {
}
}

public TestCase createTestCase(int productId, int categoryId, int priorityId, int caseStatusId, String summary) {
public TestCase createTestCase(int categoryId, int priorityId, int caseStatusId, String summary) {
Map<String, Object> params = new HashMap<>();
params.put("product", productId);
params.put("category", categoryId);
params.put("summary", summary);
params.put("is_automated", "true");
Expand All @@ -97,7 +96,7 @@ public TestCase getOrCreateTestCase(int productId, int categoryId, int priorityI
JSONArray jsonArray = (JSONArray) executeViaPositionalParams(TEST_CASE_FILTER, Arrays.asList((Object)filter));
if (jsonArray == null || jsonArray.isEmpty()) {
int caseStatusId = getConfirmedTCStatusId();
return createTestCase(productId, categoryId, priorityId, caseStatusId, summary);
return createTestCase(categoryId, priorityId, caseStatusId, summary);
}

try {
Expand Down Expand Up @@ -176,7 +175,7 @@ public int getTestPlanId(String name, int productId) {

public TestRun getRun(int runId) {
Map<String, Object> filter = new HashMap<>();
filter.put("run_id", runId);
filter.put("pk", runId);

JSONArray jsonArray = (JSONArray) executeViaPositionalParams(RUN_FILTER, Arrays.asList((Object) filter));
if (jsonArray == null || jsonArray.isEmpty()) {
Expand Down Expand Up @@ -263,7 +262,7 @@ public TestExecution updateTestExecution(int tcRunId, int status) {
values.put("status", status);

Map<String, Object> params = new HashMap<>();
params.put("case_run_id", tcRunId);
params.put("execution_id", tcRunId);
params.put("values", values);
JSONObject json = (JSONObject) executeViaNamedParams(TEST_EXECUTION_UPDATE, params);
try {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/kiwitcms/java/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ public String getPassword() {

public Integer getRunId() {
String runId = System.getenv("TCMS_RUN_ID");

if (runId == null) {
return null;
} else {
return Integer.getInteger(runId);
return Integer.parseInt(runId.trim());
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/kiwitcms/java/model/Build.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2019 Aneta Petkova <aneta.v.petkova@gmail.com>
// Copyright (c) 2020 Alexander Todorov <atodorov@MrSenko.com>

// Licensed under the GPLv3: https://www.gnu.org/licenses/gpl.html

Expand Down Expand Up @@ -36,7 +37,7 @@ public int getId() {
return id;
}

@JsonSetter("build_id")
@JsonSetter("id")
public void setId(int id) {
this.id = id;
}
Expand All @@ -51,4 +52,4 @@ public void setName(String name) {
}
}

//Choices are: build_id, build_run, description, is_active, name, product, product_id, testcaserun
//Choices are: id, build_run, description, is_active, name, product, product_id, testcaserun
4 changes: 2 additions & 2 deletions src/main/java/org/kiwitcms/java/model/TestCase.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2018-2019 Aneta Petkova <aneta.v.petkova@gmail.com>
// Copyright (c) 2020 Alexander Todorov <atodorov@MrSenko.com>

// Licensed under the GPLv3: https://www.gnu.org/licenses/gpl.html

Expand Down Expand Up @@ -29,7 +30,7 @@ public int getCaseId() {
return caseId;
}

@JsonSetter("case_id")
@JsonSetter("id")
public void setCaseId(int caseId) {
this.caseId = caseId;
}
Expand Down Expand Up @@ -126,7 +127,6 @@ public void setProductId(int productId) {
}


//case_run_id
public static Integer nameExists(String name, TestCase[] tests){
if (name == null || name.isEmpty() || tests.length == 0){
return null;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/kiwitcms/java/model/TestExecution.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2018-2019 Aneta Petkova <aneta.v.petkova@gmail.com>
// Copyright (c) 2020 Alexander Todorov <atodorov@MrSenko.com>

// Licensed under the GPLv3: https://www.gnu.org/licenses/gpl.html

Expand All @@ -20,7 +21,8 @@ public int getTcRunId() {
return tcRunId;
}

@JsonSetter("case_run_id")
// todo: this should become this.id
@JsonSetter("id")
public void setTcRunId(int tcRunId) {
this.tcRunId = tcRunId;
}
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/org/kiwitcms/java/model/TestPlan.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2018-2019 Aneta Petkova <aneta.v.petkova@gmail.com>
// Copyright (c) 2020 Alexander Todorov <atodorov@MrSenko.com>

// Licensed under the GPLv3: https://www.gnu.org/licenses/gpl.html

Expand Down Expand Up @@ -26,7 +27,7 @@ public Integer getId() {
return id;
}

@JsonSetter("plan_id")
@JsonSetter("id")
public void setId(Integer id) {
this.id = id;
}
Expand Down Expand Up @@ -114,6 +115,3 @@ public void setTypeId(Integer typeId) {
}

}

//{"parent":null,"product_version":"unspecified","product":"Dunder","is_active":true,"extra_link":null,"author":"apetkova","type_id":1,"product_version_id":1,"type":"Unit","parent_id":null,"product_id":1,"name":"Auto Test Plan 1","text":"WIP","tag":[],"create_date":"2019-01-26 23:21:35","author_id":2259,"plan_id":1507}

12 changes: 3 additions & 9 deletions src/main/java/org/kiwitcms/java/model/TestRun.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2018-2019 Aneta Petkova <aneta.v.petkova@gmail.com>
// Copyright (c) 2020 Alexander Todorov <atodorov@MrSenko.com>

// Licensed under the GPLv3: https://www.gnu.org/licenses/gpl.html

Expand All @@ -20,9 +21,8 @@ public int getId() {
return id;
}

@JsonSetter("run_id")
//TODO: doesn't this need to be setId? Is it used at all?
public void seId(int id) {
@JsonSetter("id")
public void setId(int id) {
this.id = id;
}

Expand Down Expand Up @@ -70,10 +70,4 @@ public String getProductVersion() {
public void setProductVersion(String productVersion) {
this.productVersion = productVersion;
}

// [{"summary":"Test run for TestPlan","cc":[],"product_version":"3.1","notes":"","run_id":694,"manager":"apetkova","stop_date":null,"product_version_id":47,"default_tester_id":2259,"build_id":29,"build":"unspecified","manager_id":2259,"tag":[],"plan":"TestPlan","default_tester":"apetkova","plan_id":1304,"start_date":"2019-01-23 21:38:04"}]
//{"summary":"Automatic test run","cc":[],"product_version":"1","run_id":705,"notes":"","manager":"apetkova","product_version_id":376,"stop_date":null,"default_tester_id":null,"build_id":4,"build":"3.39-localhost","manager_id":2259,"tag":[],"plan":"TestPlan","plan_id":1304,"default_tester":null,"start_date":"2019-01-26 22:23:02"}



}
5 changes: 3 additions & 2 deletions src/test/java/org/kiwitcms/java/api/TestingRpcTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ public void createTestCaseTest() {
TestCase expectedTC = new TestCase();
//inconsistent tcms behaviour
expectedTC.setProduct("33");
//todo: ^^^ product probably needs to be removed
expectedTC.setCategoryId(4);
expectedTC.setPriorityId(0);
expectedTC.setSummary("Test Summary");
assertThat(spy.createTestCase(33, 4, 0, 1, "Test Summary"), Matchers.samePropertyValuesAs(expectedTC));
assertThat(spy.createTestCase(4, 0, 1, "Test Summary"), Matchers.samePropertyValuesAs(expectedTC));
}

@Test
Expand All @@ -66,7 +67,7 @@ public void getRunWhenValidIdTest() {
Mockito.doReturn(array).when((BaseRpcClient) spy).executeViaPositionalParams(anyString(), anyList());

TestRun expectedResult = new TestRun();
expectedResult.seId(1);
expectedResult.setId(1);
assertThat(spy.getRun(1), Matchers.samePropertyValuesAs(expectedResult));
}

Expand Down