Skip to content
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

fix #2 by using test_id property #4

Merged
merged 2 commits into from
Oct 18, 2023
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Add the following dependency to your pom.xml:
<dependency>
<groupId>com.testrail</groupId>
<artifactId>testrail-junit-extensions</artifactId>
<version>0.1.0</version>
<version>0.1.1</version>
<scope>test</scope>
</dependency>
```
Expand Down Expand Up @@ -115,7 +115,7 @@ Report testcase element:
```xml
<testcase name="CanAddNumbers" classname="tests.SumTests">
<properties>
<property name="case_id" value="123"/>
<property name="test_id" value="123"/>
</properties>
</testcase>
```
Expand Down
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.testrail</groupId>
<artifactId>testrail-junit-extensions</artifactId>
<packaging>jar</packaging>
<version>0.1.0</version>
<version>0.1.1</version>
<name>testrail-junit-extensions</name>
<description>Improvements for JUnit that allow you to take better advantage of JUnit 5 (jupiter engine)</description>
<url>https://github.com/gurock/testrail-junit-extensions</url>
Expand All @@ -23,6 +23,12 @@
</organization>

<developers>
<developer>
<name>Sergio Freire</name>
<email>[email protected]</email>
<organization>TestRail</organization>
<organizationUrl>https://www.testrail.com</organizationUrl>
</developer>
<developer>
<name>Diogo Rede</name>
<email>[email protected]</email>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ private void writeTestcase(TestIdentifier testIdentifier, AggregatedTestResult t
}

Optional<TestRail> testRailTest = AnnotationSupport.findAnnotation(testMethod, TestRail.class);
String case_id = null;
String test_case_id = null;
String test_summary = null;
String test_description = null;
if (testRailTest.isPresent()) {
case_id = testRailTest.get().id();
if ((case_id != null) && (!case_id.isEmpty())) {
addProperty(writer, "case_id", case_id);
test_case_id = testRailTest.get().id();
if ((test_case_id != null) && (!test_case_id.isEmpty())) {
addProperty(writer, "test_id", test_case_id);
}

test_summary = testRailTest.get().summary();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void shouldSupportCustomReportNames() throws Exception {
Match testsuite = readValidXmlFile(tempDirectory.resolve(reportName));
Match testcase = testsuite.child("testcase");
assertThat(testcase.attr("name", String.class)).isEqualTo(testMethodName);
assertThat(testcase.child("properties").children("property").matchAttr("name", "case_id")).isEmpty();
assertThat(testcase.child("properties").children("property").matchAttr("name", "test_id")).isEmpty();
assertThat(testcase.child("properties").children("property").matchAttr("name", "test_key")).isEmpty();
assertThat(testcase.child("properties").children("property").matchAttr("name", "test_summary")).isEmpty();
assertThat(testcase.child("properties").children("property").matchAttr("name", "test_description")).isEmpty();
Expand Down Expand Up @@ -192,7 +192,7 @@ public void shouldMapTestIdToTestcaseProperty() throws Exception {
Match testsuite = readValidXmlFile(tempDirectory.resolve(REPORT_NAME));
Match testcase = testsuite.child("testcase");
assertThat(testcase.attr("name", String.class)).isEqualTo(testMethodName);
assertThat(testcase.child("properties").children("property").matchAttr("name", "case_id").attr("value")).isEqualTo("myCustomId");
assertThat(testcase.child("properties").children("property").matchAttr("name", "test_id").attr("value")).isEqualTo("myCustomId");
}

@Test
Expand Down
Loading