Skip to content

MOSIP- 44419: Removed reflection-based TestNG method name modification.#1344

Merged
Prafulrakhade merged 1 commit intomosip:developfrom
SradhaMohanty5899:MOSIP-44419
Feb 16, 2026
Merged

MOSIP- 44419: Removed reflection-based TestNG method name modification.#1344
Prafulrakhade merged 1 commit intomosip:developfrom
SradhaMohanty5899:MOSIP-44419

Conversation

@SradhaMohanty5899
Copy link
Contributor

@SradhaMohanty5899 SradhaMohanty5899 commented Feb 13, 2026

MOSIP- 44419: Removed reflection-based TestNG method name modification.

Summary by CodeRabbit

  • Chores
    • Updated test framework dependency to latest snapshot version.
    • Simplified test result handling across multiple test scripts by replacing complex internal logic with streamlined attribute assignment, improving code maintainability and reducing potential runtime errors.

Signed-off-by: SradhaMohanty5899 <mohantysradha10@gmail.com>
@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

Walkthrough

Updated a dependency version in pom.xml and refactored 13 test script files to replace reflection-based manipulation of TestNG internal result fields with direct attribute assignment via result.setAttribute("TestCaseName", testCaseName), removing associated error-handling code.

Changes

Cohort / File(s) Summary
Dependency Update
api-test/pom.xml
Updated apitest-commons dependency version from 1.4.0-SNAPSHOT to 1.5.0-SNAPSHOT.
Test Script Refactoring
api-test/src/main/java/io/mosip/testrig/apirig/masterdata/testscripts/DeleteWithParam.java, GetWithParam.java, GetWithQueryParam.java, PatchWithPathParam.java, PatchWithQueryParam.java, PostWithFormDataAndFile.java, PostWithPathParamsAndBody.java, PutWithPathParam.java, PutWithPathParamsAndBody.java, SimpleDelete.java, SimplePost.java, SimplePostForAutoGenId.java, SimplePut.java
Replaced reflective manipulation of TestNG internal TestResult fields with direct attribute assignment. Removed try-catch blocks and reflection-based field access; test case names now stored via result.setAttribute("TestCaseName", testCaseName).
Test Script Refactoring (Potential Issue)
api-test/src/main/java/io/mosip/testrig/apirig/masterdata/testscripts/SimplePutForAutoGenId.java
Same refactoring as above, plus method name changed from setResultTestName to sestResultTestName (potential typo: "sest" instead of "set").

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 From reflection's tangled web we hop away,
With attributes so clean, brighter is the day!
Thirteen scripts now dance in simpler delight,
Though one method's name gives this rabbit a fright!
Sest or set? A typo's tiny plight.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removal of reflection-based TestNG method name modification across multiple test script files.
Docstring Coverage ✅ Passed Docstring coverage is 92.86% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into develop

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
api-test/src/main/java/io/mosip/testrig/apirig/masterdata/testscripts/PutWithPathParamsAndBody.java (1)

122-128: ⚠️ Potential issue | 🔴 Critical

Pre-existing NPE: ouputValid is null when the _StatusCode branch executes.

Line 122 initializes ouputValid to null, and the _StatusCode branch at line 128 calls ouputValid.put(...) without ever assigning it a Map instance. This will throw a NullPointerException at runtime.

🐛 Proposed fix
-			Map<String, List<OutputValidationDto>> ouputValid = null;
+			Map<String, List<OutputValidationDto>> ouputValid = new java.util.HashMap<>();
🤖 Fix all issues with AI agents
In
`@api-test/src/main/java/io/mosip/testrig/apirig/masterdata/testscripts/SimplePutForAutoGenId.java`:
- Around line 140-141: The method name sestResultTestName in class
SimplePutForAutoGenId is a typo and should be renamed to setResultTestName to
match other test scripts; rename the method (keeping its signature public void
setResultTestName(ITestResult result)) and update any references or annotations
that call it (e.g., `@AfterMethod` usage) so all files use the consistent
setResultTestName identifier.

@Prafulrakhade Prafulrakhade merged commit 3f78005 into mosip:develop Feb 16, 2026
20 checks passed
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.

4 participants