[Cus-7742] Added column wise iteration in tdp's#238
Conversation
|
|
WalkthroughThis pull request introduces a new Testsigma addon module for iterating through columns in Test Data Platform (TDP). It includes a Maven configuration, a utility class for TDP API interactions, and four WebAction classes for managing column iteration workflows. The module supports retrieving individual columns, entire rows, and column counts from TDP datasets. Changes
Sequence Diagram(s)sequenceDiagram
participant Test as Test Execution
participant SetIter as SetTDpIteratorToZero
participant GetCount as GetTDPColumncount
participant StoreNext as StoreNextColumnTdpValue
participant TDPApiUtil as TDPApiUtil
participant TDP as TDP API
Test->>SetIter: execute()
SetIter->>SetIter: Set iterator to "0"
SetIter-->>Test: SUCCESS
Test->>GetCount: execute(tdp-id, set-name, api-key)
GetCount->>TDPApiUtil: getTDPIterationData()
TDPApiUtil->>TDP: HTTP GET with Bearer auth
TDP-->>TDPApiUtil: JSON response
TDPApiUtil->>TDPApiUtil: parseTDPResponse()
TDPApiUtil-->>GetCount: parameter map
GetCount->>GetCount: Store map.size() as column-count
GetCount-->>Test: SUCCESS
rect rgb(200, 220, 255)
Note over Test,StoreNext: Loop: while iterator < column-count
Test->>StoreNext: execute(tdp-id, set-name, api-key, iterator)
StoreNext->>TDPApiUtil: getTDPIterationData()
TDPApiUtil->>TDP: HTTP GET
TDP-->>TDPApiUtil: JSON response
TDPApiUtil-->>StoreNext: parameter map
StoreNext->>StoreNext: Get nth entry, skip headers
StoreNext->>StoreNext: Store column value & name
StoreNext->>StoreNext: Increment iterator
StoreNext-->>Test: SUCCESS
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes The diff introduces a self-contained new Maven module with consistent patterns across four WebAction classes. While each class has distinct logic, they share structural similarities and follow SDK conventions. The TDPApiUtil utility is straightforward HTTP/JSON handling. Review effort stems from understanding the TDP integration flow, validating error handling across multiple classes, and ensuring proper test data mapping rather than complexity density. Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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: 16
🧹 Nitpick comments (3)
iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetEntireRowFromTDP.java (1)
55-76: Robust row building; avoid substring on empty.Use StringJoiner to build the CSV safely; no trailing-comma surgery needed.
- // - String resultVariableForSToringOutput =""; - - // Loop through the parameters/columns in the parameterValues map - 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); + java.util.StringJoiner joiner = new java.util.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")) { + logger.info("Skipping column: " + key); + continue; + } + joiner.add(entry.getValue()); + } + String resultVariableForSToringOutput = joiner.toString();iterating_through_columns_in_tdps/pom.xml (1)
37-41: Upgrade JUnit Jupiter to latest stable version compatible with Java 11.5.8.0-M1 is pre-release; 5.14.0 is the latest stable version compatible with Java 11. Update
junit.jupiter.versionto5.14.0.iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/SetTDpIteratorToZero.java (1)
39-43: Consider whether broad exception handling is necessary.The catch block handles all exceptions, but it's unclear what exceptions could realistically occur when setting string values on
runTimeData. If no specific exceptions are expected, this defensive coding may be unnecessary. If specific exceptions are possible, consider catching them explicitly or documenting the scenarios.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
iterating_through_columns_in_tdps/pom.xml(1 hunks)iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/util/TDPApiUtil.java(1 hunks)iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetEntireRowFromTDP.java(1 hunks)iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetTDPColumncount.java(1 hunks)iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/SetTDpIteratorToZero.java(1 hunks)iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/StoreNextColumnTdpValue.java(1 hunks)iterating_through_columns_in_tdps/src/main/resources/testsigma-sdk.properties(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/StoreNextColumnTdpValue.java (3)
iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/util/TDPApiUtil.java (1)
TDPApiUtil(17-109)iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetTDPColumncount.java (1)
Action(13-54)iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/SetTDpIteratorToZero.java (1)
Action(11-46)
iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetTDPColumncount.java (2)
iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/util/TDPApiUtil.java (1)
TDPApiUtil(17-109)iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/StoreNextColumnTdpValue.java (1)
Action(17-117)
iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetEntireRowFromTDP.java (3)
iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/util/TDPApiUtil.java (1)
TDPApiUtil(17-109)iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetTDPColumncount.java (1)
Action(13-54)iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/StoreNextColumnTdpValue.java (1)
Action(17-117)
iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/SetTDpIteratorToZero.java (2)
iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/GetTDPColumncount.java (1)
Action(13-54)iterating_through_columns_in_tdps/src/main/java/com/testsigma/addons/web/StoreNextColumnTdpValue.java (1)
Action(17-117)
🪛 OSV Scanner (2.2.3)
iterating_through_columns_in_tdps/pom.xml
[HIGH] 1-1: com.fasterxml.jackson.core:jackson-core 2.13.0: jackson-core can throw a StackoverflowError when processing deeply nested data
[HIGH] 1-1: com.fasterxml.jackson.core:jackson-databind 2.13.0: jackson-databind possible Denial of Service if using JDK serialization to serialize JsonNode
[HIGH] 1-1: com.fasterxml.jackson.core:jackson-databind 2.13.0: Deeply nested json in jackson-databind
[HIGH] 1-1: com.fasterxml.jackson.core:jackson-databind 2.13.0: Uncontrolled Resource Consumption in Jackson-databind
[HIGH] 1-1: com.fasterxml.jackson.core:jackson-databind 2.13.0: Uncontrolled Resource Consumption in FasterXML jackson-databind
[HIGH] 1-1: org.json:json 20160810: json stack overflow vulnerability
[HIGH] 1-1: org.json:json 20160810: Java: DoS Vulnerability in JSON-JAVA
[HIGH] 1-1: org.testng:testng 6.14.3: TestNG is vulnerable to Path Traversal
Please review this addon and publish as PUBLIC
Addon Name: Iterating through columns in TDPs
Addon account: https://jarvis.testsigma.com/ui/tenants/3072/addons
Ticket : https://testsigma.atlassian.net/browse/CUS-7742
Summary by CodeRabbit