-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add annotation to tag tests by test case ID #336
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,7 +4,7 @@ | |||||
<groupId>org.kiwitcms.java</groupId> | ||||||
<artifactId>kiwitcms-junit-plugin</artifactId> | ||||||
<packaging>jar</packaging> | ||||||
<version>12.5</version> | ||||||
<version>12.6</version> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert this change:
Suggested change
|
||||||
|
||||||
<name>kiwitcms-junit-plugin</name> | ||||||
<description>JUnit 5 plugin for Kiwi TCMS.</description> | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -411,4 +411,22 @@ | |
return null; | ||
} | ||
} | ||
|
||
public TestCase getTestCaseById(int testCaseId) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will need some test coverage. |
||
Map<String, Object> filter = new HashMap<>(); | ||
filter.put("id", testCaseId); | ||
JSONArray jsonArray = (JSONArray) executeViaPositionalParams(TEST_CASE_FILTER, Arrays.asList(filter)); | ||
if (jsonArray == null || jsonArray.isEmpty()) { | ||
System.out.printf("Case ID \"%s\" not found%n", testCaseId); | ||
return null; | ||
} | ||
|
||
try { | ||
TestCase[] testCases = new ObjectMapper().readValue(jsonArray.toJSONString(), TestCase[].class); | ||
return testCases[0]; | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
return null; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.kiwitcms.java.model; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target(ElementType.METHOD) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface TcmsTestCaseId | ||
{ | ||
int value(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of this class? Is this where the new annotation is defined? If yes, I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe add this class into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment to clarify example: