Skip to content

Conversation

@hegdenitin
Copy link
Contributor

@hegdenitin hegdenitin commented Jan 21, 2026

  1. Added the 'additionalDependencies' for the yml
  2. updated uniqueIdentifier in json with support for single test case execution

Summary by CodeRabbit

  • New Features

    • Expanded dependency metadata across many test scenarios, adding numerous prerequisite chains and new test-case entries for authorization, Google/SunBirdC flows, verifiable presentations, trusted verifiers, wallet unlock, credential download/view/presentation, and logout.
  • Chores

    • Introduced a runtime flag to control dependency generation and made shutdown behavior conditional on that flag.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Walkthrough

Adds a runtime flag to control generation/loading of test-case inter-dependencies. MosipTestRunner reads generateDependencyJson into generateDependency, conditionally loads or skips testCaseInterDependency.json, and conditionally triggers inter-dependency generation on shutdown. Many YAMLs/JSON were annotated with additionalDependencies.

Changes

Cohort / File(s) Summary
Test runner
api-test/src/main/java/io/mosip/testrig/apirig/mimoto/testrunner/MosipTestRunner.java
Add private static String generateDependency;, read generateDependencyJson from properties, conditionally load testCaseInterDependency.json or skip, and conditionally call AdminTestUtil.generateTestCaseInterDependencies(...) on shutdown.
Validation util
api-test/src/main/java/io/mosip/testrig/apirig/mimoto/utils/MimotoUtil.java
When global generate flag is enabled and testCaseDTO.getAdditionalDependencies() exists, invoke addAdditionalDependencies(testCaseDTO) during isTestCaseValidForTheExecution.
Central dependency graph
api-test/src/main/resources/config/testCaseInterDependency.json
Large expansion/restructuring of inter-test dependency mappings (+225/-34) adding many new test-case keys and dependency chains across auth, wallet, presentation, credential, and view/fetch flows.
Properties / config
api-test/src/main/resources/config/mimoto.properties
Add commented generateDependencyJson = yes hint and a separating blank line after testCasesToExecute=.
Authorization YAMLs
api-test/src/main/resources/mimoto/.../AuthorizationCode/.../AuthorizationCode.yml, .../AuthorizationCodeForGoogleLogin/.../AuthorizationCode.yml, .../AuthorizationCodeSunBirdC/.../AuthorizationCodeSunBirdC.yml, .../AuthenticateUserSunBirdC/.../AuthenticateUserSunBirdC.yml
Add additionalDependencies to several authorization/authentication test cases (Google-login and SunBirdC variants) and update some uniqueIdentifier values.
Credential / Wallet YAMLs
api-test/src/main/resources/mimoto/.../DownloadIssuerCredential/DownloadIssuerCredential.yml, .../FetchAllCredentials/FetchAllCredentials.yml, .../ViewCredential/ViewCredential.yml, .../DownloadStayProtectedIssuerCredentialWithGoogleLogin/.../DownloadIssuerCredential.yml
Add additionalDependencies (commonly TC_Mimoto_UnlockWallet_01 and related auth prerequisites) to many download/fetch/view credential test cases.
Presentations / Trusted verifiers / User flows YAMLs
api-test/src/main/resources/mimoto/.../Presentations/VerifiablePresentationAuthorization/VerifiablePresentationAuthorization.yml, .../AddTrustedVerifier/AddTrustedVerifier.yml, .../Wallet/UnlockWalletAfterDelete/UnlockWalletAfterDelete.yml, .../Users/GetUserProfileAfterLogout/GetUserProfileAfterLogout.yml
Attach additionalDependencies (e.g., TC_Mimoto_UnlockWallet_01, TC_Mimoto_Logout_01, TC_Mimoto_DeleteWallet_01) to presentation, trusted-verifier, wallet-unlock, and post-logout profile tests.

Sequence Diagram(s)

sequenceDiagram
  participant Runner as "MosipTestRunner"
  participant Admin as "AdminTestUtil"
  participant Util as "MimotoUtil"
  participant Config as "InterDependency JSON / YAMLs"

  Runner->>Runner: read mimoto.properties (generateDependencyJson)
  Runner->>Admin: init()
  alt generateDependency != "yes"
    Runner->>Config: load testCaseInterDependency.json
    Config-->>Util: populate testCasesInRunScope
  else generateDependency == "yes"
    Runner->>Runner: skip inter-dependency load
  end
  loop per test case
    Runner->>Util: isTestCaseValidForTheExecution(testCaseDTO)
    Util->>Admin: check AdminTestUtil.generateDependency flag
    alt flag == true and testCaseDTO.additionalDependencies != null
      Util->>Util: addAdditionalDependencies(testCaseDTO)
    end
    Util-->>Runner: validation result
  end
  alt generateDependency == "yes"
    Runner->>Admin: on shutdown -> generateTestCaseInterDependencies(path)
    Admin->>Config: write/update testCaseInterDependency.json
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • MOSIP-42816 Automation for the 4 new APIs #954 — Adds presentation-related YAMLs and test cases (VerifiablePresentationAuthorization, AddTrustedVerifier, GetCredentialsForPresentation, RejectPresentation) that align with the new additionalDependencies fields and dependency handling.

Suggested reviewers

  • jackjain
  • mohanachandran-s

Poem

🐰 I hop through YAML fields with care,
I stitch dependencies here and there.
A flag to skip or write by dawn,
I nudge the tests so order’s drawn,
🥕 Now runs are tidy — hop, we're done!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: adding additional dependencies for test case execution across multiple YAML files and configuration updates.

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


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: 0

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/resources/mimoto/LoginFlow/DownloadMosipIssuerCredential/ViewCredential/ViewCredential.yml (1)

301-320: Duplicate uniqueIdentifier will break single test case execution.

TC_Mimoto_ViewCredential_14 is used by both Mimoto_ViewCredential_SpaceIn_AcceptLanguage_Neg (Line 283) and Mimoto_ViewCredential_Invalid_AcceptHeader_Neg (Line 304). Since the PR objective is to enable single test case execution, this duplicate identifier will cause ambiguity when targeting a specific test.

Suggested fix: Renumber the uniqueIdentifiers
   Mimoto_ViewCredential_Invalid_AcceptHeader_Neg:
      endPoint: /v1/mimoto/wallets/{walletId}/credentials/{credentialId}?action=inline
      description: View the credential saved for the wallet with invalid accept header and expects it to fail
-     uniqueIdentifier: TC_Mimoto_ViewCredential_14
+     uniqueIdentifier: TC_Mimoto_ViewCredential_14b
      role: userDefinedCookie

Alternatively, renumber all subsequent identifiers (15 → 16, 16 → 17, 17 → 18) and use TC_Mimoto_ViewCredential_15 here.

🧹 Nitpick comments (3)
api-test/src/main/java/io/mosip/testrig/apirig/mimoto/utils/MimotoUtil.java (1)

99-104: Minor cleanup suggestions for this conditional block.

  1. Typo in comment: "additionalDependancies" should be "additionalDependencies"
  2. Redundant null check: testCaseDTO != null is unnecessary since testCaseDTO.getTestCaseName() is already called at line 92 without a null check—if it were null, the method would have already thrown an NPE.
  3. Non-idiomatic boolean comparison: Use AdminTestUtil.generateDependency instead of AdminTestUtil.generateDependency == true.
♻️ Suggested cleanup
-		
-		// enable the condition only for capturing the additionalDependancies into json file
-		if (testCaseDTO != null && testCaseDTO.getAdditionalDependencies() != null
-				&& AdminTestUtil.generateDependency == true) {
+		// Enable the condition only for capturing the additionalDependencies into JSON file
+		if (testCaseDTO.getAdditionalDependencies() != null && AdminTestUtil.generateDependency) {
 			addAdditionalDependencies(testCaseDTO);
 		}
api-test/src/main/java/io/mosip/testrig/apirig/mimoto/testrunner/MosipTestRunner.java (2)

83-86: Consider making dependency generation configurable rather than always enabled.

Unconditionally setting generateDependency = true means dependency collection will run for every test execution, which may have performance implications or generate files that aren't needed in CI/production runs. The FIX: comment also suggests this might be a temporary workaround.

Consider controlling this via a configuration property (e.g., MimotoConfigManager.getproperty("generateDependency")) to allow enabling it only when needed (e.g., during development or when updating dependency metadata).

♻️ Suggested approach
 			AdminTestUtil.init();
 			MimotoConfigManager.init();
-			
-			// FIX: Enable dependency generation so MimotoUtil collects dependencies from YAML
-			AdminTestUtil.generateDependency = true;
+			
+			// Enable dependency generation if configured (useful for updating dependency metadata)
+			String generateDep = MimotoConfigManager.getproperty("generateDependency");
+			AdminTestUtil.generateDependency = "true".equalsIgnoreCase(generateDep);

132-133: Remove or properly control commented-out code.

Commented-out code should typically be removed rather than left in the codebase. If this functionality needs to be toggled, use a configuration flag instead. The comment above it indicates its purpose, so it can be re-enabled conditionally:

♻️ Suggested approach
-		// Used for generating the test case interdependency JSON file
-//		AdminTestUtil.generateTestCaseInterDependencies(getGlobalResourcePath() + "/config/testCaseInterDependency.json");
+		// Generate test case interdependency JSON file if dependency generation is enabled
+		if (AdminTestUtil.generateDependency) {
+			AdminTestUtil.generateTestCaseInterDependencies(getGlobalResourcePath() + "/config/testCaseInterDependency.json");
+		}

Alternatively, if this code is no longer needed, remove it entirely along with the comment.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

hegdenitin and others added 2 commits January 28, 2026 17:20
Removed an additional dependency from the authorization code configuration.

Signed-off-by: Nitin Hegde <[email protected]>
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

🤖 Fix all issues with AI agents
In
`@api-test/src/main/java/io/mosip/testrig/apirig/mimoto/testrunner/MosipTestRunner.java`:
- Around line 109-116: After retrieving the config into the local String
generateDependency in MosipTestRunner, assign the boolean feature flag on
AdminTestUtil so MimotoUtil.isTestCaseValidForTheExecution() sees the correct
value; set AdminTestUtil.generateDependency to true when generateDependency
equals "yes" (case-insensitive) and false otherwise (i.e., map the
"generateDependency" String to the boolean AdminTestUtil.generateDependency
immediately after the config read).
🧹 Nitpick comments (1)
api-test/src/main/java/io/mosip/testrig/apirig/mimoto/utils/MimotoUtil.java (1)

105-109: Redundant null check and boolean comparison style.

The testCaseDTO != null check is unnecessary since testCaseDTO is already dereferenced on lines 92-98 without null checks. Also, prefer AdminTestUtil.generateDependency over AdminTestUtil.generateDependency == true for boolean comparisons.

♻️ Suggested simplification
-		// Handle extra workflow dependencies
-		if (testCaseDTO != null && testCaseDTO.getAdditionalDependencies() != null
-				&& AdminTestUtil.generateDependency == true) {
+		// Handle extra workflow dependencies
+		if (testCaseDTO.getAdditionalDependencies() != null
+				&& AdminTestUtil.generateDependency) {
 			addAdditionalDependencies(testCaseDTO);
 		}

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: 2

🤖 Fix all issues with AI agents
In `@api-test/src/main/resources/config/testCaseInterDependency.json`:
- Around line 256-260: The test dependency for TC_Mimoto_AddTrustedVerifier_05
mixes TC_Mimoto_GoogleLoginToken_06 and TC_Mimoto_CreateWallet_23 with
VerifiablePresentationAuthorization_01 (which pulls token_01/wallet_01 flows)
causing mismatched setups; update the dependency list for
TC_Mimoto_AddTrustedVerifier_05 to use the flow-specific VP authorization that
matches token_06/wallet_23 (e.g., replace VerifiablePresentationAuthorization_01
with VerifiablePresentationAuthorization_04) or swap to the correct
token_06-compatible VP variant, and apply the same alignment to the other
occurrences noted (the blocks around the other indices).
- Around line 501-523: Several test case dependency arrays redundantly include
"TC_Mimoto_CreateWallet_01" alongside "TC_Mimoto_UnlockWallet_01" (which already
depends on CreateWallet), so remove the direct "TC_Mimoto_CreateWallet_01"
entries wherever "TC_Mimoto_UnlockWallet_01" appears to avoid duplicate
dependency declarations; update each affected JSON array (e.g., entries like
"TC_Mimoto_AddTrustedVerifier_01",
"TC_Mimoto_DownloadStayProtectedIssuerCredentialWithGoogleLogin_03",
"TC_Mimoto_DownloadStayProtectedIssuerCredentialWithGoogleLogin_01",
"TC_Mimoto_FetchAllCredentials_*",
"TC_Mimoto_VerifiablePresentationAuthorization_*", "TC_Mimoto_ViewCredential_*")
by deleting "TC_Mimoto_CreateWallet_01" while keeping
"TC_Mimoto_UnlockWallet_01" and other dependencies intact.
🧹 Nitpick comments (1)
api-test/src/main/java/io/mosip/testrig/apirig/mimoto/testrunner/MosipTestRunner.java (1)

133-136: Consider adding error handling for dependency generation.

The dependency generation call is outside the try-catch block. If generateTestCaseInterDependencies() throws an exception, it would be unhandled. Since this is at shutdown after tests complete, the impact is minimal, but wrapping in a try-catch would ensure cleaner error reporting.

🛡️ Optional: Add defensive error handling
 		if ("yes".equalsIgnoreCase(generateDependency)) {
+			try {
 			LOGGER.info("Generating test case inter-dependencies");
 			AdminTestUtil.generateTestCaseInterDependencies(BaseTestCase.testCaseInterDependencyPath);
+			} catch (Exception e) {
+				LOGGER.error("Failed to generate test case inter-dependencies: " + e.getMessage());
+			}
 		}

@sonarqubecloud
Copy link

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