[CUS-11625] added nlps to fetch and update the tdp values.#368
Conversation
📝 WalkthroughWalkthroughThis PR adds comprehensive Test Data Profile (TDP) management actions across six application types (Android, iOS, Web, Mobile Web, Salesforce, Windows Advanced), introducing 54 new action classes. It updates Maven dependencies and refactors Changes
Sequence DiagramsequenceDiagram
participant Action as TDP Action<br/>(e.g., GetTDPValue)
participant Util as TDPApiUtil
participant Http as OkHttp Client
participant API as TDP API Server
participant Runtime as Runtime Data<br/>Storage
Action->>Util: getTDPIterationData(tdpId, setName, apiKey, logger)
Util->>Util: validateInputs()
Util->>Http: makeHttpRequest2(url, apiKey, logger)
Http->>Http: createAllTrustingSSLContext()
Http->>API: GET TDP Iteration Data
API-->>Http: JSON Response
Http-->>Util: responseBody
Util->>Util: parseTDPResponse(responseBody)
Util->>Util: buildLinkedHashMap(columnOrder)
Util-->>Action: Map<String, String> parameterMap
Action->>Action: validateParameter(parameterName)
alt Parameter Found
Action->>Runtime: setKey(runtimeVariable)
Action->>Runtime: setValue(parameterValue)
Action-->>Action: Result.SUCCESS
else Parameter Not Found
Action-->>Action: Result.FAILED<br/>(with available params)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Note
Due to the large number of review comments, Critical severity comments were prioritized as inline comments.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (6)
iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetEntireRowFromTDP.java (2)
60-73:⚠️ Potential issue | 🟠 MajorPotential
StringIndexOutOfBoundsExceptionif all columns are skipped.If the TDP only contains the columns
S.No.,ETF, andSet Name, theresultVariableForSToringOutputwill remain empty, and line 73 will throwStringIndexOutOfBoundsExceptionwhen attemptingsubstring(0, -2).Proposed fix
for (Map.Entry<String, String> entry : parameterValues.entrySet()) { - // skip the first three columns - String key = entry.getKey(); if (key.equals("S.No.") || key.equals("ETF") || key.equals("Set Name")) { logger.info("Skipping column: " + key); continue; } else{ resultVariableForSToringOutput += entry.getValue() + ", "; } } - // remove the last comma - resultVariableForSToringOutput = resultVariableForSToringOutput.substring(0, resultVariableForSToringOutput.length() - 2); + // remove the trailing ", " if present + if (resultVariableForSToringOutput.length() >= 2) { + resultVariableForSToringOutput = resultVariableForSToringOutput.substring(0, resultVariableForSToringOutput.length() - 2); + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetEntireRowFromTDP.java` around lines 60 - 73, The loop in GetEntireRowFromTDP.java appends ", " to resultVariableForSToringOutput and then unconditionally calls substring to remove the last comma, which throws StringIndexOutOfBoundsException when all columns are skipped; modify the code around the for-loop that iterates over parameterValues (and the variable resultVariableForSToringOutput) to only call substring when resultVariableForSToringOutput.length() >= 2 (or better, use a StringBuilder and conditionally remove the trailing delimiter), i.e., check the length before trimming and otherwise leave it empty or set a sensible default value.
82-85:⚠️ Potential issue | 🟡 MinorMissing
setErrorMessage()call before returning FAILED.The catch block logs the error but does not set an error message for the user.
Proposed fix
} catch (Exception e) { logger.warn("Error occurred while processing TDP data: " + e.getMessage()); + setErrorMessage("Error occurred while processing TDP data: " + e.getMessage()); return com.testsigma.sdk.Result.FAILED; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetEntireRowFromTDP.java` around lines 82 - 85, In GetEntireRowFromTDP's catch block where you currently log the exception and return com.testsigma.sdk.Result.FAILED, call setErrorMessage(...) on the current TestData or action context object (the class's output/response setter) with a meaningful message (e.g., e.getMessage() or a combined message) before returning FAILED so the user sees the error; update the catch in GetEntireRowFromTDP to setErrorMessage and then return com.testsigma.sdk.Result.FAILED.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetTDPColumncount.java (1)
49-52:⚠️ Potential issue | 🟡 MinorMissing
setErrorMessage()call before returning FAILED.Other action classes in this PR call
setErrorMessage()to provide user-facing error details. This action only logs the error, leaving the test result without a meaningful message.Proposed fix
catch (Exception e) { logger.info("Error occurred while getting total column count of TDP: " + e.getMessage()); + setErrorMessage("Error occurred while getting total column count: " + e.getMessage()); return com.testsigma.sdk.Result.FAILED; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetTDPColumncount.java` around lines 49 - 52, The catch block in GetTDPColumncount currently logs the exception but returns Result.FAILED without calling setErrorMessage, so the user sees no descriptive error; update the catch in the GetTDPColumncount class (the catch handling the exception around the column count logic) to call setErrorMessage(...) with a meaningful message (e.g., include e.getMessage() or a short context string) before returning com.testsigma.sdk.Result.FAILED and keep the existing logger.info call.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/StoreNextColumnTdpValue.java (3)
39-44:⚠️ Potential issue | 🔴 CriticalStatic
@RunTimeDatafields cause thread-safety issues.These static fields will be shared across all instances and concurrent test executions, leading to race conditions and data corruption. Each action instance should have its own runtime data.
`@RunTimeData` - private static com.testsigma.sdk.RunTimeData runTimeData; + private com.testsigma.sdk.RunTimeData runTimeData; `@RunTimeData` - private static com.testsigma.sdk.RunTimeData iteratorRuntimeData; + private com.testsigma.sdk.RunTimeData iteratorRuntimeData; `@RunTimeData` - private static com.testsigma.sdk.RunTimeData columnNameRuntimeData; + private com.testsigma.sdk.RunTimeData columnNameRuntimeData;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/StoreNextColumnTdpValue.java` around lines 39 - 44, The three RunTimeData fields (runTimeData, iteratorRuntimeData, columnNameRuntimeData) in StoreNextColumnTdpValue are declared static causing shared state across threads; change them to instance fields by removing the static modifier so each StoreNextColumnTdpValue instance has its own RunTimeData, keeping the `@RunTimeData` annotation and access modifiers intact to preserve behavior and thread-safety.
111-114:⚠️ Potential issue | 🟠 MajorMissing
setErrorMessagein outer catch block.When an exception is caught here, only a warning is logged but
setErrorMessageis not called. This means the failure reason won't be visible in test results, making debugging harder.} catch (Exception e) { logger.warn("Error occurred while processing TDP data: " + e.getMessage()); + setErrorMessage("Error occurred while processing TDP data: " + e.getMessage()); return com.testsigma.sdk.Result.FAILED; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/StoreNextColumnTdpValue.java` around lines 111 - 114, The outer catch in StoreNextColumnTdpValue (the catch(Exception e) block that currently logs a warn and returns Result.FAILED) fails to call setErrorMessage, so add a call to the Testsigma step result setter to record the failure reason (e.g., call setErrorMessage with e.getMessage() or a combined message) before returning com.testsigma.sdk.Result.FAILED; update the catch block in the execute/process method of StoreNextColumnTdpValue to set the error message using the same step/result object used elsewhere in the class.
48-48:⚠️ Potential issue | 🟡 MinorRemove personal identifier from log message.
The log message contains "manoj" which appears to be a leftover from debugging. Clean this up before merging.
- logger.info("Initiating execution manoj"); + logger.info("Initiating execution");🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/StoreNextColumnTdpValue.java` at line 48, The log message in StoreNextColumnTdpValue contains a personal identifier ("manoj"); update the logger.info call in the StoreNextColumnTdpValue class to remove the name and use a neutral, descriptive message (e.g., "Initiating StoreNextColumnTdpValue execution" or "Initiating execution") so the log is professional and generic; locate the logger.info invocation and replace the message accordingly.
♻️ Duplicate comments (2)
iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/AddNewRowToTDP.java (1)
27-31:⚠️ Potential issue | 🟡 MinorSame required-input validation gap as other AddNewRow actions.
Please add early blank checks for
tdp-id,row-name, andapi-keybefore callingTDPApiUtil.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/AddNewRowToTDP.java` around lines 27 - 31, Add early blank/empty-string validation for the three inputs (tdpId, rowName, apiKey) before calling TDPApiUtil.addTDPRowWithEmptyData: read their values (tdpId.getValue(), rowName.getValue(), apiKey.getValue()), trim them into tdpIdStr, rowNameStr, apiKeyStr, and if any is null/empty after trimming, log an error via logger (or set the action to failed) and return without invoking TDPApiUtil; otherwise proceed to call TDPApiUtil.addTDPRowWithEmptyData(tdpIdStr, rowNameStr, apiKeyStr, logger).iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/UpdateTDPValue.java (1)
36-38:⚠️ Potential issue | 🟡 MinorAdd early validation for empty
parameter-namebefore payload creation.This mirrors the same update-key validation issue raised in the iOS variant.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/UpdateTDPValue.java` around lines 36 - 38, Before building the payload and calling TDPApiUtil.updateTDPIterationData, validate that parameterName.getValue() is non-null and its trimmed string is not empty; if it is empty, throw or return a clear error (same behavior as the iOS variant) instead of creating updatedData. Specifically check parameterName in the code that constructs updatedData and only call TDPApiUtil.updateTDPIterationData when the validated key is present, otherwise log/raise an appropriate error using logger to prevent sending an empty key in the payload.
🟠 Major comments (25)
iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetTDPColumncount.java-38-38 (1)
38-38:⚠️ Potential issue | 🟠 MajorAvoid logging sensitive credentials.
The API key is logged in plain text, which could expose sensitive credentials in log files. Remove or mask the API key from log output.
🔒 Proposed fix
- logger.info("TDP ID: "+ tdpId +", Set Name: "+ setName +", API Key: "+ apiKey); + logger.info("TDP ID: "+ tdpId +", Set Name: "+ setName);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetTDPColumncount.java` at line 38, The logger line in GetTDPColumncount that prints "API Key: "+ apiKey exposes secrets; remove the apiKey from logs or replace it with a masked value (e.g., show only last 4 chars or a fixed placeholder) in the logger.info call so the API key is never logged in full; update the logging statement in the method/class GetTDPColumncount to omit or mask apiKey while keeping tdpId and setName for context.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/UpdateTDPValue.java-40-40 (1)
40-40:⚠️ Potential issue | 🟠 MajorAvoid logging sensitive credentials.
The API key is logged in plain text, which could expose sensitive credentials in log files.
Proposed fix
- logger.info("TDP ID: " + tdpIdStr + ", Set Name: " + setNameStr + ", Parameter: " + paramName + ", Value: " + paramValue); + logger.info("TDP ID: " + tdpIdStr + ", Set Name: " + setNameStr + ", Parameter: " + paramName);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/UpdateTDPValue.java` at line 40, The logger.info call in UpdateTDPValue that logs "TDP ID: " + tdpIdStr + ", Set Name: " + setNameStr + ", Parameter: " + paramName + ", Value: " + paramValue is exposing sensitive credentials (API key); update it to avoid printing raw paramValue: either omit the value field entirely or detect sensitive parameter names (e.g., when paramName contains "api", "key", "secret", etc.) and replace paramValue with a masked string like "****" before logging; modify the logging in the UpdateTDPValue class (the logger.info invocation) to implement this masking/omission so credentials are never written in plain text.iterating_through_columns_in_tdps/pom.xml-79-83 (1)
79-83:⚠️ Potential issue | 🟠 MajorReplace the alpha version of OkHttp with the latest stable release.
Version
5.0.0-alpha.12is a pre-release with no stability guarantees. Alpha versions may contain breaking changes or bugs affecting production reliability. Upgrade to the latest stable version,5.3.2.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/pom.xml` around lines 79 - 83, Replace the pre-release OkHttp version with the stable release by updating the dependency for groupId "com.squareup.okhttp3" and artifactId "okhttp" in the pom.xml: change the <version> from "5.0.0-alpha.12" to the latest stable "5.3.2" so builds use the supported stable OkHttp release.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/GetTDPValue.java-51-51 (1)
51-51:⚠️ Potential issue | 🟠 MajorAvoid exposing fetched TDP values in success messages.
Line 51 includes the raw parameter value in a user-visible message. TDP cells can contain sensitive data, so this should be redacted.
🔒 Proposed fix
- setSuccessMessage("Successfully retrieved parameter <b>" + paramName + "</b> = <b>" + value + "</b> from set <b>" + setNameStr + "</b>"); + setSuccessMessage("Successfully retrieved parameter <b>" + paramName + "</b> from set <b>" + setNameStr + "</b>");🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/GetTDPValue.java` at line 51, The success message in GetTDPValue currently includes the raw fetched TDP value (see the setSuccessMessage call that concatenates paramName and value with setNameStr); change that so the actual value is not exposed—either remove the value entirely or replace it with a redacted placeholder (e.g., "<redacted>" or "REDACTED") when constructing the setSuccessMessage string in the GetTDPValue class/method where value is used, keeping paramName and setNameStr for context only.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetTDPValue.java-52-52 (1)
52-52:⚠️ Potential issue | 🟠 MajorDo not log fetched TDP values.
Line 52 logs raw TDP data, which can leak secrets/PII into execution logs.
🔐 Proposed fix
- logger.info("Retrieved value: " + value); + logger.info("Successfully retrieved parameter value for key: {}", paramName);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetTDPValue.java` at line 52, The logger.info call in GetTDPValue that logs the raw TDP value (logger.info("Retrieved value: " + value)) can leak secrets/PII; remove or replace it with a non-sensitive message and/or masked output. Locate the logger usage in class GetTDPValue (the logger.info referencing variable value) and either delete that logging line or change it to a generic message such as "TDP value retrieved" without including the value (or log a redacted/masked version), ensuring no raw TDP data is written to logs.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/GetEntireRowFromTDP.java-37-42 (1)
37-42:⚠️ Potential issue | 🟠 MajorHandle empty filtered rows before trimming trailing delimiter.
Lines 37–42 can throw
StringIndexOutOfBoundsExceptionwhen no values survive filtering (S.No.,ETF,Set Nameonly).✅ Proposed fix
- String resultVariable = ""; + StringBuilder resultVariable = new StringBuilder(); for (Map.Entry<String, String> entry : parameterValues.entrySet()) { if (entry.getKey().equals("S.No.") || entry.getKey().equals("ETF") || entry.getKey().equals("Set Name")) continue; - resultVariable += entry.getValue() + ", "; + if (resultVariable.length() > 0) { + resultVariable.append(", "); + } + resultVariable.append(entry.getValue()); } - resultVariable = resultVariable.substring(0, resultVariable.length() - 2); - runTimeData.setValue(resultVariable); + runTimeData.setValue(resultVariable.toString());🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/GetEntireRowFromTDP.java` around lines 37 - 42, The loop building resultVariable can produce an empty string when all entries are filtered and then calling substring causes StringIndexOutOfBoundsException; update the code around parameterValues, resultVariable and the final runTimeData.setValue call to guard against an empty result (e.g., only call substring/trimming if resultVariable length >= 2 or use a StringJoiner/StringBuilder to append values and then set runTimeData.setValue with either the joined string or an empty string/default when nothing was appended).iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/StoreNextColumnTdpValue.java-53-53 (1)
53-53:⚠️ Potential issue | 🟠 MajorAvoid logging API keys even at debug level.
Logging the API key, even at debug level, poses a security risk as logs may be persisted, aggregated, or accessed by unauthorized parties.
- logger.debug("TDP ID: " + tdpId + ", Set Name: " + setName + ", API Key: " + apiKey); + logger.debug("TDP ID: " + tdpId + ", Set Name: " + setName);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/StoreNextColumnTdpValue.java` at line 53, The current logger.debug call in StoreNextColumnTdpValue logs the sensitive apiKey (logger.debug with tdpId, setName, apiKey); remove the raw API key from logs and either omit it entirely or log a masked value (e.g., replace all but last few chars with asterisks) so only non-sensitive context remains; update the logger.debug invocation to include only tdpId and setName (or include a masked apiKey string) and ensure no other places in this class or method concatenate and log the full apiKey.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/GetEntireRowFromTDP.java-36-44 (1)
36-44:⚠️ Potential issue | 🟠 MajorPotential
StringIndexOutOfBoundsExceptionwhen all entries are filtered out.If
parameterValuescontains only the skipped keys (S.No.,ETF,Set Name),resultVariableremains empty, andsubstring(0, -2)throwsStringIndexOutOfBoundsException.🐛 Proposed fix with StringBuilder and empty-check
- String resultVariable = ""; - for (Map.Entry<String, String> entry : parameterValues.entrySet()) { - if (entry.getKey().equals("S.No.") || entry.getKey().equals("ETF") || entry.getKey().equals("Set Name")) continue; - resultVariable += entry.getValue() + ", "; - } - resultVariable = resultVariable.substring(0, resultVariable.length() - 2); + StringBuilder sb = new StringBuilder(); + for (Map.Entry<String, String> entry : parameterValues.entrySet()) { + if (entry.getKey().equals("S.No.") || entry.getKey().equals("ETF") || entry.getKey().equals("Set Name")) continue; + if (sb.length() > 0) sb.append(", "); + sb.append(entry.getValue()); + } + String resultVariable = sb.toString();🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/GetEntireRowFromTDP.java` around lines 36 - 44, The code building resultVariable in GetEntireRowFromTDP iterates parameterValues and blindly trims the last ", " which will throw StringIndexOutOfBoundsException when all entries are skipped; replace the concatenation with a StringBuilder (or collect values into a list) while skipping keys "S.No.", "ETF", "Set Name", then before trimming check if the builder is empty—if empty set runTimeData.setValue("") (or a safe default) else remove the trailing comma+space and call runTimeData.setValue(builder.toString()); keep runTimeData.setKey(testData4.getValue().toString()) and return Result.SUCCESS.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/SetTDpIteratorToZero.java-25-27 (1)
25-27:⚠️ Potential issue | 🟠 MajorThis guard checks the iterator's current value, not the variable name.
Elsewhere in this PR the same
TDP_ITERATOR_KEY_NAMEruntime input is parsed as an integer, so after it contains"0"or"1"Line 25 will fail and this reset action can no longer reset it. Set the key directly and drop the literal-name check.Suggested change
- if (!Objects.equals(testData1.getValue().toString(), "TDP_ITERATOR_KEY_NAME")) { - setErrorMessage("Don't change the TDP_ITERATOR_KEY_NAME variable name"); - return com.testsigma.sdk.Result.FAILED; - } try { runTimeData.setValue("0"); runTimeData.setKey("TDP_ITERATOR_KEY_NAME");🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/SetTDpIteratorToZero.java` around lines 25 - 27, The current guard in SetTDpIteratorToZero compares testData1.getValue() to the literal "TDP_ITERATOR_KEY_NAME" (so it checks the iterator's value rather than the variable name), which prevents resetting once the value becomes "0" or "1"; remove that Objects.equals(...) check and instead directly set the runtime input identified by TDP_ITERATOR_KEY_NAME to zero (e.g., use the testData/testData1 setter to set the key/value for TDP_ITERATOR_KEY_NAME to "0" or 0 as appropriate), dropping the literal-name validation and ensuring the reset always writes the correct value.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/AddColumnToTDP.java-36-53 (1)
36-53:⚠️ Potential issue | 🟠 MajorPreserve
default-valueverbatim and keep it out of logs/results.
default-valueis payload, not an identifier. Trimming it on Line 38 changes legitimate data, and echoing it on Lines 41 and 52-53 leaks potentially sensitive TDP content into execution logs and reports.Suggested change
- String defValue = defaultValue.getValue().toString().trim(); + String defValue = defaultValue.getValue().toString(); String apiKeyStr = apiKey.getValue().toString().trim(); - logger.info("TDP ID: " + tdpIdStr + ", Column: " + colName + ", Default Value: " + defValue); + logger.info("Adding column " + colName + " to TDP " + tdpIdStr); @@ - setSuccessMessage("Successfully added new column <b>" + colName - + "</b> with default value <b>" + defValue + "</b> to all rows in TDP"); + setSuccessMessage("Successfully added new column <b>" + colName + "</b> to all rows in TDP");🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/AddColumnToTDP.java` around lines 36 - 53, Remove trimming and logging of the defaultValue payload: stop calling trim() on defaultValue (use defaultValue.getValue().toString() and preserve exact content, handling nulls as needed), do not include defValue in any logger.info or setSuccessMessage output, and instead log only non-sensitive metadata (e.g., presence or length). Ensure TDPApiUtil.addTDPColumn(tdpIdStr, colName, defValue, apiKeyStr, logger) continues to receive the untrimmed defValue, and update setSuccessMessage to omit the default value (mention only the column name or a redacted placeholder).iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/AddColumnToTDP.java-30-42 (1)
30-42:⚠️ Potential issue | 🟠 MajorPreserve
default-valueverbatim and keep it out of logs/results.
default-valueis payload, not an identifier. Trimming it on Line 32 changes legitimate data, and echoing it on Lines 34 and 42 leaks potentially sensitive TDP content into execution logs and reports.Suggested change
- String defValue = defaultValue.getValue().toString().trim(); + String defValue = defaultValue.getValue().toString(); String apiKeyStr = apiKey.getValue().toString().trim(); - logger.info("TDP ID: " + tdpIdStr + ", Column: " + colName + ", Default Value: " + defValue); + logger.info("Adding column " + colName + " to TDP " + tdpIdStr); @@ - setSuccessMessage("Successfully added new column <b>" + colName + "</b> with default value <b>" + defValue + "</b> to all rows in TDP"); + setSuccessMessage("Successfully added new column <b>" + colName + "</b> to all rows in TDP");🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/AddColumnToTDP.java` around lines 30 - 42, The code is trimming and logging the default value (variable defValue), which can alter legitimate payloads and leak sensitive content; stop trimming and remove it from all logs and user-facing messages. Replace String defValue = defaultValue.getValue().toString().trim() with a raw value variable (e.g., defaultValueRaw = defaultValue.getValue().toString()) and pass that raw value to TDPApiUtil.addTDPColumn but do not include defaultValueRaw in any logger.info or setSuccessMessage calls; update the logger.info at line with column/TDP id to omit defValue and change setSuccessMessage("Successfully added new column...") to avoid echoing the default value (use a generic confirmation mentioning only the column name).iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/GetTDPValue.java-44-51 (1)
44-51:⚠️ Potential issue | 🟠 MajorDo not echo the retrieved TDP value into the action result.
Line 51 writes the raw TDP cell into the step result, which can leak secrets/PII into reports. The value is already stored in
runTimeData, so keep the status text generic and avoid echoing raw inputs from Line 45 as well.Suggested change
if (!parameterValues.containsKey(paramName)) { - setErrorMessage("Parameter <b>" + paramName + "</b> not found in set <b>" + setNameStr + "</b>. Available parameters: " + parameterValues.keySet()); + setErrorMessage("Requested parameter was not found in the given set."); return Result.FAILED; } String value = parameterValues.get(paramName); runTimeData.setKey(runtimeVariable.getValue().toString()); runTimeData.setValue(value); - setSuccessMessage("Successfully retrieved parameter <b>" + paramName + "</b> = <b>" + value + "</b> from set <b>" + setNameStr + "</b>"); + setSuccessMessage("Successfully retrieved the requested parameter and stored it in the runtime variable."); return Result.SUCCESS;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/GetTDPValue.java` around lines 44 - 51, The success and error messages currently echo raw TDP data and parameter lists; remove the retrieved cell value and any raw parameter set contents from the log text. In GetTDPValue, keep the assignments to runTimeData.setKey(runtimeVariable.getValue().toString()) and runTimeData.setValue(value) and return Result.FAILED on missing keys, but change setErrorMessage(...) to a generic message that does not include parameterValues.keySet() or sensitive inputs and change setSuccessMessage(...) to a generic success text (e.g., "Parameter retrieved and stored in runtime data") that does not include paramName, value, or setNameStr.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/GetEntireRowFromTDP.java-36-41 (1)
36-41:⚠️ Potential issue | 🟠 MajorGuard the empty-row case before trimming the trailing delimiter.
If the row only contains skipped keys or
parameterValuesis empty, Line 41 becomessubstring(0, -2)and throws. Build the output incrementally and fail cleanly when there are no user columns.Suggested change
- String resultVariable = ""; + StringBuilder resultVariable = new StringBuilder(); for (Map.Entry<String, String> entry : parameterValues.entrySet()) { if (entry.getKey().equals("S.No.") || entry.getKey().equals("ETF") || entry.getKey().equals("Set Name")) continue; - resultVariable += entry.getValue() + ", "; + if (resultVariable.length() > 0) { + resultVariable.append(", "); + } + resultVariable.append(entry.getValue()); } - resultVariable = resultVariable.substring(0, resultVariable.length() - 2); - runTimeData.setValue(resultVariable); + if (resultVariable.length() == 0) { + setErrorMessage("No user columns found for the requested set."); + return com.testsigma.sdk.Result.FAILED; + } + runTimeData.setValue(resultVariable.toString());🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/GetEntireRowFromTDP.java` around lines 36 - 41, The loop that builds resultVariable from parameterValues can produce an empty string when all keys are skipped, leading to substring(0, resultVariable.length() - 2) throwing; update the logic in GetEntireRowFromTDP (the resultVariable construction) to build the output safely (use a StringBuilder or conditionally append a ", " only between added values) and before calling substring check that any user columns were appended — if none, handle cleanly (return empty/result indicator or throw a clear exception) instead of performing substring on a negative length.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/GetTDPValue.java-44-51 (1)
44-51:⚠️ Potential issue | 🟠 MajorDo not echo the retrieved TDP value into the action result.
Line 51 writes the raw TDP cell into the step result, which can leak secrets/PII into reports. The value is already stored in
runTimeData, so keep the status text generic and avoid echoing raw inputs from Line 45 as well.Suggested change
if (!parameterValues.containsKey(paramName)) { - setErrorMessage("Parameter <b>" + paramName + "</b> not found in set <b>" + setNameStr + "</b>. Available parameters: " + parameterValues.keySet()); + setErrorMessage("Requested parameter was not found in the given set."); return Result.FAILED; } String value = parameterValues.get(paramName); runTimeData.setKey(runtimeVariable.getValue().toString()); runTimeData.setValue(value); - setSuccessMessage("Successfully retrieved parameter <b>" + paramName + "</b> = <b>" + value + "</b> from set <b>" + setNameStr + "</b>"); + setSuccessMessage("Successfully retrieved the requested parameter and stored it in the runtime variable."); return Result.SUCCESS;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/GetTDPValue.java` around lines 44 - 51, The step result currently echoes sensitive data: change the messages to avoid including raw parameter names/values. In the block that checks parameterValues.containsKey(paramName) and when setting success use runTimeData, replace the setErrorMessage(...) and setSuccessMessage(...) calls so they do not include paramName, setNameStr, parameterValues.keySet(), or the retrieved value; instead log a generic status like "Parameter lookup failed" or "Parameter retrieved and stored in runtime variable" while keeping the existing runTimeData.setKey(...) and runTimeData.setValue(...) and return Result.FAILED on error. Ensure references to parameterValues, paramName, setNameStr, runTimeData, setErrorMessage, and setSuccessMessage are updated accordingly.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/StoreNextColumnTdpValue.java-50-73 (1)
50-73:⚠️ Potential issue | 🟠 MajorThis iterator assumes a deterministic
Maporder that isn't enforced.
columnNamesListandcolumnValuesListare indexed by whatever orderparameterValues.entrySet()yields. IfgetTDPIterationData(...)returns aHashMap, the same iterator index will point at different columns across runs, which breaks the core iteration behavior.#!/bin/bash # Inspect how getTDPIterationData constructs and returns its map. # Expectation: an ordered map/list is used; a HashMap here makes iteration order unstable. fd 'TDPApiUtil\.java$' | xargs -r rg -n -C4 'getTDPIterationData|LinkedHashMap|HashMap'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/StoreNextColumnTdpValue.java` around lines 50 - 73, The iteration is relying on non-deterministic Map iteration (parameterValues) which can make columnNamesList/columnValuesList mismatched across runs; fix by enforcing a deterministic order before indexing: either change TDPApiUtil.getTDPIterationData to return an ordered Map (e.g., LinkedHashMap) or, inside StoreNextColumnTdpValue, extract and sort the keys (excluding "S.No.", "ETF", "Set Name") into a List and then populate columnNamesList and columnValuesList by iterating that ordered key list so columnNamesList.get(iteratorValue) always corresponds to columnValuesList.get(iteratorValue). Ensure you reference parameterValues, columnNamesList, columnValuesList, getTDPIterationData and update setSuccessMessage/runTimeData logic unchanged.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/GetEntireRowFromTDP.java-39-45 (1)
39-45:⚠️ Potential issue | 🟠 MajorGuard the empty-row case before trimming the trailing delimiter.
If the row only contains skipped keys or
parameterValuesis empty, Line 45 becomessubstring(0, -2)and throws. Build the output incrementally and fail cleanly when there are no user columns.Suggested change
- String resultVariable = ""; + StringBuilder resultVariable = new StringBuilder(); for (Map.Entry<String, String> entry : parameterValues.entrySet()) { String key = entry.getKey(); if (key.equals("S.No.") || key.equals("ETF") || key.equals("Set Name")) continue; - resultVariable += entry.getValue() + ", "; + if (resultVariable.length() > 0) { + resultVariable.append(", "); + } + resultVariable.append(entry.getValue()); } - resultVariable = resultVariable.substring(0, resultVariable.length() - 2); - runTimeData.setValue(resultVariable); + if (resultVariable.length() == 0) { + setErrorMessage("No user columns found for the requested set."); + return com.testsigma.sdk.Result.FAILED; + } + runTimeData.setValue(resultVariable.toString());🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/GetEntireRowFromTDP.java` around lines 39 - 45, The loop that builds resultVariable from parameterValues can produce an empty string when all keys are skipped and then calls substring(0, length-2) causing a crash; update the code in GetEntireRowFromTDP to build the output safely (e.g., use a StringBuilder or append to a list and join) while skipping keys "S.No.", "ETF", "Set Name", and before trimming check whether any user columns were added—if none, fail cleanly by throwing a descriptive exception or returning an explicit empty/placeholder value instead of calling substring with a negative index.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/StoreNextColumnTdpValue.java-36-41 (1)
36-41:⚠️ Potential issue | 🟠 MajorRemove
statickeyword from@RunTimeDatafields—they should be instance fields per SDK design.The Testsigma SDK's
@RunTimeDataannotation is designed for instance-level injection and use; static fields break the per-instance runtime data mechanism. Official Testsigma documentation explicitly recommends declaring these asprivatenon-static instance fields. Static mutable fields also create cross-test contamination risk in parallel execution.Suggested change
`@RunTimeData` - private static com.testsigma.sdk.RunTimeData runTimeData; + private com.testsigma.sdk.RunTimeData runTimeData; `@RunTimeData` - private static com.testsigma.sdk.RunTimeData iteratorRuntimeData; + private com.testsigma.sdk.RunTimeData iteratorRuntimeData; `@RunTimeData` - private static com.testsigma.sdk.RunTimeData columnNameRuntimeData; + private com.testsigma.sdk.RunTimeData columnNameRuntimeData;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/StoreNextColumnTdpValue.java` around lines 36 - 41, The three `@RunTimeData` fields in StoreNextColumnTdpValue (runTimeData, iteratorRuntimeData, columnNameRuntimeData) are declared static but must be instance fields; remove the static modifier so they are private instance members, update any code that referenced them statically to use the instance field (this or direct access) within instance methods, and ensure no static initialization or static helper methods rely on them so the Testsigma SDK can inject per-instance runtime data correctly.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/AddColumnToTDP.java-35-37 (1)
35-37:⚠️ Potential issue | 🟠 MajorDon't trim persisted default values.
default-valueis user data, not an identifier. Trimming it strips intentional leading/trailing spaces and makes the success message disagree with what was actually written when the input contains whitespace.Suggested adjustment
+ String defaultValueStr = defaultValue.getValue().toString(); - TDPApiUtil.addTDPColumn(tdpId.getValue().toString().trim(), colName, defaultValue.getValue().toString().trim(), apiKey.getValue().toString().trim(), logger); + TDPApiUtil.addTDPColumn(tdpId.getValue().toString().trim(), colName, defaultValueStr, apiKey.getValue().toString().trim(), logger);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/AddColumnToTDP.java` around lines 35 - 37, The code trims the user-provided default value before persisting and displaying it; stop trimming persisted user data by passing the raw default value string from defaultValue.getValue().toString() (without .trim()) into TDPApiUtil.addTDPColumn and use that same untrimmed string in setSuccessMessage so the stored value and the success message match; keep trimming identifiers like tdpId/apiKey but remove .trim() usage for defaultValue in the calls around addTDPColumn and setSuccessMessage in AddColumnToTDP (the try block where TDPApiUtil.addTDPColumn and setSuccessMessage are invoked).iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/AddNewRowToTDP.java-27-31 (1)
27-31:⚠️ Potential issue | 🟠 MajorFail fast on blank row names.
After
trim()," "becomes an empty identifier and is still sent toaddTDPRowWithEmptyData(...). That can create an unnamed row or push a basic validation error downstream.Suggested adjustment
String tdpIdStr = tdpId.getValue().toString().trim(); String rowNameStr = rowName.getValue().toString().trim(); String apiKeyStr = apiKey.getValue().toString().trim(); + if (rowNameStr.isEmpty()) { + setErrorMessage("Row name cannot be empty"); + return Result.FAILED; + } try { TDPApiUtil.addTDPRowWithEmptyData(tdpIdStr, rowNameStr, apiKeyStr, logger);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/AddNewRowToTDP.java` around lines 27 - 31, After trimming, rowNameStr can be empty (e.g., " ") and must be rejected before calling TDPApiUtil.addTDPRowWithEmptyData; add a guard in AddNewRowToTDP that checks if rowNameStr.isEmpty() and fail fast (throw IllegalArgumentException or log an error and return/fail the step) including a clear message referencing rowNameStr so the API is not called with an empty identifier.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/UpdateTDPValue.java-44-59 (1)
44-59:⚠️ Potential issue | 🟠 MajorPreserve and redact
parameter-value.
parameter-valueis the payload being written, sotrim()silently changes user data. The same raw value is then echoed into logs and the success message, which can leak secrets or PII from the TDP into execution artifacts.Suggested adjustment
- String paramValue = parameterValue.getValue().toString().trim(); + String paramValue = parameterValue.getValue().toString(); @@ - logger.info("TDP ID: " + tdpIdStr + ", Set Name: " + setNameStr - + ", Parameter: " + paramName + ", Value: " + paramValue); + logger.info("TDP ID: " + tdpIdStr + ", Set Name: " + setNameStr + + ", Parameter: " + paramName); @@ - setSuccessMessage("Successfully updated parameter <b>" + paramName - + "</b> to <b>" + paramValue + "</b> in set <b>" + setNameStr + "</b>"); + setSuccessMessage("Successfully updated parameter <b>" + paramName + + "</b> in set <b>" + setNameStr + "</b>");🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/UpdateTDPValue.java` around lines 44 - 59, The code currently trims and logs the user-supplied payload (parameterValue -> paramValue) which mutates the original data and may leak secrets/PII; instead preserve the raw value from parameterValue.getValue().toString() in a new variable (e.g., rawParamValue) and use that raw value when building updatedData/TDPApiUtil.updateTDPIterationData (do not call trim()), but redact or omit the actual value when calling logger.info and setSuccessMessage (e.g., log only paramName, setNameStr and a redacted placeholder like "<REDACTED>" or value length), updating references to paramValue, updatedData, logger and setSuccessMessage accordingly.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/SetTDpIteratorToZero.java-18-29 (1)
18-29:⚠️ Potential issue | 🟠 MajorFix the runtime-variable check logic.
TestData.getValue()returns the resolved runtime variable value, not the variable name. The current check at line 23 compares this resolved value against the literal string"TDP_ITERATOR_KEY_NAME", which will only pass if the runtime variable happens to contain that exact string as its value—not what the error message ("Don't change the TDP_ITERATOR_KEY_NAME variable name") suggests you intend to verify.If the goal is to validate that a specific runtime variable was assigned, rethink the validation approach. If it's to initialize an iterator counter to zero, the variable reference and the comparison logic need alignment.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/SetTDpIteratorToZero.java` around lines 18 - 29, The current check in execute() incorrectly compares testData1.getValue() (the resolved runtime value) to the literal "TDP_ITERATOR_KEY_NAME"; instead treat getValue() as the runtime value—remove that equality check and either validate/initialize the iterator value: read String val = testData1.getValue().toString(), if val is null/empty or not numeric then set runTimeData.setValue("0") (or otherwise parse Integer.parseInt(val) for further logic), and set appropriate result; use the existing testData1 and runTimeData symbols in execute() and update the error path to no longer assert on the variable name string.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/util/TDPApiUtil.java-61-70 (1)
61-70:⚠️ Potential issue | 🟠 MajorDisabling SSL certificate verification is a security risk.
Trusting all certificates and disabling hostname verification makes the application vulnerable to man-in-the-middle attacks. The API key transmitted via Bearer token could be intercepted.
If this is required for specific environments (e.g., self-hosted instances with self-signed certs), consider making it configurable rather than always disabled.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/util/TDPApiUtil.java` around lines 61 - 70, The current code unconditionally creates an insecure SSLContext via SSLContextBuilder and an SSLConnectionSocketFactory with NoopHostnameVerifier (symbols: SSLContext sslContext, SSLContextBuilder, SSLConnectionSocketFactory, NoopHostnameVerifier) which disables certificate and hostname validation; change this to make the insecure behavior configurable (e.g., boolean flag trustAllSsl or disableHostnameVerification read from config/env), default to secure validation, and only when the flag is true build the permissive SSLContext and use NoopHostnameVerifier; update the code paths that construct the HTTP client to branch on that flag and document the config so self-signed/test environments can opt-in without affecting production.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/util/TDPApiUtil.java-93-94 (1)
93-94:⚠️ Potential issue | 🟠 MajorAuthorization header logged — potential credential exposure.
Logging all headers at Line 94 will include the
Authorization: Bearer <apiKey>token. This exposes credentials in log files, violating security best practices and potentially compliance requirements.🔒 Suggested fix: Remove or redact sensitive headers from logs
logger.info("HTTP GET request headers set"); logger.info("httpGet Details: " + httpGet); - logger.info("Headers" + Arrays.toString(httpGet.getAllHeaders())); + // Avoid logging Authorization header to prevent credential exposure + logger.info("Headers: Accept=" + httpGet.getFirstHeader("Accept") + + ", Content-Type=" + httpGet.getFirstHeader("Content-Type"));🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/util/TDPApiUtil.java` around lines 93 - 94, Logging http headers in TDPApiUtil.java via the httpGet.getAllHeaders() call exposes the Authorization bearer token; instead, change the logging to iterate the headers from httpGet (the httpGet variable / getAllHeaders()) and either omit the "Authorization" header or redact its value (e.g., replace value with "[REDACTED]") before composing the log message so other non-sensitive headers can still be logged safely.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/util/TDPApiUtil.java-330-338 (1)
330-338:⚠️ Potential issue | 🟠 MajorResource leak: Response not closed after use.
Same issue as
makeHttpRequest2— theokhttp3.Responsemust be closed to release connections.🐛 Suggested fix: Use try-with-resources
- okhttp3.Response response = client.newCall(requestBuilder.build()).execute(); - String responseBody = response.body() != null ? response.body().string() : ""; - logger.info("Response code: " + response.code()); - logger.info("Response body: " + responseBody); - - if (!response.isSuccessful()) { - throw new RuntimeException("HTTP " + response.code() + ": " + responseBody); - } - return responseBody; + try (okhttp3.Response response = client.newCall(requestBuilder.build()).execute()) { + String responseBody = response.body() != null ? response.body().string() : ""; + logger.info("Response code: " + response.code()); + logger.info("Response body: " + responseBody); + + if (!response.isSuccessful()) { + throw new RuntimeException("HTTP " + response.code() + ": " + responseBody); + } + return responseBody; + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/util/TDPApiUtil.java` around lines 330 - 338, The Response returned by OkHttp in TDPApiUtil is not closed, causing a connection/resource leak; update the method containing this snippet (e.g., makeHttpRequest) to use try-with-resources for okhttp3.Response: wrap the client.newCall(...).execute() call in a try (Response response = client.newCall(requestBuilder.build()).execute()) { ... } block, move response.body().string() and the logger calls inside that block, and return the local responseBody so the Response is automatically closed.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/util/TDPApiUtil.java-154-165 (1)
154-165:⚠️ Potential issue | 🟠 MajorResource leak: OkHttp
Responseis not closed.
okhttp3.ResponseimplementsCloseableand must be closed to release the underlying connection back to the pool. Failing to close it can exhaust connection pools and cause resource starvation.Additionally,
response.body()can return null, causing an NPE at line 159.🐛 Suggested fix: Use try-with-resources and null check
- okhttp3.Response response = newClient.newCall(request).execute(); - - // get response code - logger.info("Response code: " + response.code()); - - responseBody = response.body().string(); - logger.info("Response body: " + responseBody); + try (okhttp3.Response response = newClient.newCall(request).execute()) { + // get response code + logger.info("Response code: " + response.code()); + + responseBody = response.body() != null ? response.body().string() : ""; + logger.info("Response body: " + responseBody); + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/util/TDPApiUtil.java` around lines 154 - 165, The OkHttp Response created in TDPApiUtil (the line "okhttp3.Response response = newClient.newCall(request).execute()") is never closed and response.body() may be null; wrap the call in a try-with-resources (try (okhttp3.Response response = newClient.newCall(request).execute()) { ... }) so the Response is always closed, then null-check response.body() before calling .string() (handle null by setting responseBody to "" or throwing a clear exception) and keep the existing logging inside the try block; propagate or wrap exceptions as currently done.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9d1db775-8200-4de9-8de9-210cde4c63d3
📒 Files selected for processing (49)
iterating_through_columns_in_tdps/pom.xmliterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/AddColumnToTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/AddNewRowToTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/GetEntireRowFromTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/GetTDPColumncount.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/GetTDPValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/SetTDpIteratorToZero.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/StoreNextColumnTdpValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/UpdateTDPValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/AddColumnToTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/AddNewRowToTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/GetEntireRowFromTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/GetTDPColumncount.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/GetTDPValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/SetTDpIteratorToZero.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/StoreNextColumnTdpValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/ios/UpdateTDPValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/AddColumnToTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/AddNewRowToTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/GetEntireRowFromTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/GetTDPColumncount.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/GetTDPValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/SetTDpIteratorToZero.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/StoreNextColumnTdpValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/mobileweb/UpdateTDPValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/AddColumnToTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/AddNewRowToTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/GetEntireRowFromTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/GetTDPColumncount.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/GetTDPValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/SetTDpIteratorToZero.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/StoreNextColumnTdpValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/salesforce/UpdateTDPValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/util/TDPApiUtil.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/AddColumnToTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/AddNewRowToTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetEntireRowFromTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetTDPColumncount.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetTDPValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/StoreNextColumnTdpValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/UpdateTDPValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/AddColumnToTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/AddNewRowToTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/GetEntireRowFromTDP.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/GetTDPColumncount.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/GetTDPValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/SetTDpIteratorToZero.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/StoreNextColumnTdpValue.javaiterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/windowsadvanced/UpdateTDPValue.java
| String resultVariable = ""; | ||
| for (Map.Entry<String, String> entry : parameterValues.entrySet()) { | ||
| String key = entry.getKey(); | ||
| if (key.equals("S.No.") || key.equals("ETF") || key.equals("Set Name")) continue; | ||
| resultVariable += entry.getValue() + ", "; | ||
| } | ||
| resultVariable = resultVariable.substring(0, resultVariable.length() - 2); | ||
| runTimeData.setValue(resultVariable); |
There was a problem hiding this comment.
substring can crash when no eligible columns are present.
If all keys are filtered out, resultVariable is empty and substring(0, -2) throws at runtime.
Suggested fix
+import java.util.StringJoiner;
...
- String resultVariable = "";
+ StringJoiner resultJoiner = new StringJoiner(", ");
for (Map.Entry<String, String> entry : parameterValues.entrySet()) {
String key = entry.getKey();
if (key.equals("S.No.") || key.equals("ETF") || key.equals("Set Name")) continue;
- resultVariable += entry.getValue() + ", ";
+ resultJoiner.add(String.valueOf(entry.getValue()));
}
- resultVariable = resultVariable.substring(0, resultVariable.length() - 2);
- runTimeData.setValue(resultVariable);
+ runTimeData.setValue(resultJoiner.toString());
runTimeData.setKey(testData4.getValue().toString());📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| String resultVariable = ""; | |
| for (Map.Entry<String, String> entry : parameterValues.entrySet()) { | |
| String key = entry.getKey(); | |
| if (key.equals("S.No.") || key.equals("ETF") || key.equals("Set Name")) continue; | |
| resultVariable += entry.getValue() + ", "; | |
| } | |
| resultVariable = resultVariable.substring(0, resultVariable.length() - 2); | |
| runTimeData.setValue(resultVariable); | |
| StringJoiner resultJoiner = new StringJoiner(", "); | |
| for (Map.Entry<String, String> entry : parameterValues.entrySet()) { | |
| String key = entry.getKey(); | |
| if (key.equals("S.No.") || key.equals("ETF") || key.equals("Set Name")) continue; | |
| resultJoiner.add(String.valueOf(entry.getValue())); | |
| } | |
| runTimeData.setValue(resultJoiner.toString()); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/android/GetEntireRowFromTDP.java`
around lines 39 - 46, The current loop in GetEntireRowFromTDP builds
resultVariable by appending values then unconditionally calling substring to
strip the trailing ", ", which will throw if no eligible keys in parameterValues
exist; change the logic to avoid substring on an empty string—e.g., use a
StringBuilder or check resultVariable.length() >= 2 before calling substring,
and only call runTimeData.setValue(...) with the trimmed string (or an empty
string) when appropriate; update references around resultVariable,
parameterValues iteration, and runTimeData.setValue to implement this safe
trimming.
please review this addon and publish as PUBLIC
Addon name : iterating_through_columns_in_tdps
Addon accont: https://jarvis.testsigma.com/ui/tenants/3072/addons
Jira: https://testsigma.atlassian.net/browse/CUS-11625
fix
Added NLP's to get and update the tdp data
Added Nlp to add new row for the given tdp in windows advanced application type
Summary by CodeRabbit
New Features
Chores