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

Add annotation to tag tests by test case ID #336

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Angelthree95
Copy link
Contributor

  • Added the ability to search exclusively by case ID with @TcmsTestCaseId() annotation to the @Test method.

If you have a nicely maintained Kiwi instance, where the test cases are manually added and your code doesn't reflect the names, then the TCMS junit plugin won't be able to find them properly (just by searching by name). By adding the @TcmsTestCaseId() annotation, you can override which test case is returned to the test plan. In case of invalid ID being provided the plugin will do the standard test case search.

@codecov
Copy link

codecov bot commented Jul 16, 2023

Codecov Report

Attention: Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.

Project coverage is 10.65%. Comparing base (c4f5aeb) to head (fd95cb5).
Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
src/main/java/org/kiwitcms/java/api/RpcClient.java 0.00% 11 Missing ⚠️
.../java/org/kiwitcms/java/junit/TestDataEmitter.java 0.00% 5 Missing ⚠️
...ava/org/kiwitcms/java/junit/KiwiTcmsExtension.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             master     #336       +/-   ##
=============================================
- Coverage     58.86%   10.65%   -48.22%     
+ Complexity      126       34       -92     
=============================================
  Files            16       16               
  Lines           564      582       +18     
  Branches         33       37        +4     
=============================================
- Hits            332       62      -270     
- Misses          207      519      +312     
+ Partials         25        1       -24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this change:

Suggested change
<version>12.6</version>
<version>12.5</version>

@@ -36,6 +42,7 @@ but that should be redundant:
@ExtendWith(KiwiTcmsExtension.class)
public class KiwiJsonRpcClientTest {
@Test
@TcmsTestCaseId(11)
Copy link
Member

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:

Suggested change
@TcmsTestCaseId(11)
@TcmsTestCaseId(11) // optional

public @interface TcmsTestCaseId
{
int value();
}
Copy link
Member

Choose a reason for hiding this comment

The 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 model/ isn't the appropriate place for it. Maybe create a new directory like annotations/ ? WDYT ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe add this class into TestMethod.java ? Not sure what makes sense here.

@@ -411,4 +411,22 @@ public TestExecutionStatus getTestExecutionStatus(String name, String weightLook
return null;
}
}

public TestCase getTestCaseById(int testCaseId) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need some test coverage.

@Angelthree95
Copy link
Contributor Author

I extended this PR by some in here #348. Added all of your comments @atodorov. Closing this as outdated.

@atodorov atodorov reopened this Sep 1, 2023
@atodorov
Copy link
Member

atodorov commented Sep 1, 2023

I will review this one first, before reviewing the extended version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants