Skip to content

feat/CUS-10696-Added class to concatenate two strings with special chars and store it in runtime variable#336

Merged
akhil-testsigma merged 1 commit into
devfrom
feat/CUS-10696-Added-class-to-concatenate-two-strings-with-special-chars-and-store-it-in-runtime-variable
Feb 17, 2026
Merged

feat/CUS-10696-Added class to concatenate two strings with special chars and store it in runtime variable#336
akhil-testsigma merged 1 commit into
devfrom
feat/CUS-10696-Added-class-to-concatenate-two-strings-with-special-chars-and-store-it-in-runtime-variable

Conversation

@akhil-testsigma
Copy link
Copy Markdown
Contributor

@akhil-testsigma akhil-testsigma commented Feb 17, 2026

Publish this addon as public

Addon Name: Concatenate and Store String
Jarvis Link: https://jarvis.testsigma.com/ui/tenants/2817/addons
Addon ticket: https://testsigma.atlassian.net/browse/CUS-10696
Added class to concatenate two strings with special chars and store it in runtime variable

Summary by CodeRabbit

  • New Features
    • Added StringConcatenate action for concatenating strings with configurable separators (spaces or custom delimiters).
    • Supports multiple testing platforms: Android, iOS, Mobile Web, REST API, Salesforce, Web, and Windows.
    • Stores concatenation results in variables for use in subsequent test steps.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 17, 2026

📝 Walkthrough

Walkthrough

A new Maven-based Java addon project is introduced with platform-specific string concatenation implementations. The project includes configuration files (pom.xml, properties) and seven nearly identical StringConcatenate action classes targeting Android, iOS, Web, MobileWeb, REST API, Salesforce, and Windows platforms. Each action concatenates two input strings with configurable separators and stores results in runtime variables.

Changes

Cohort / File(s) Summary
Project Configuration
concatenate_and_store_string/pom.xml, concatenate_and_store_string/src/main/resources/testsigma-sdk.properties
Maven project setup with dependencies (testsigma-java-sdk, lombok, junit, testng, selenium, jackson, commons-lang3) and build plugins for shading and source attachment. SDK API key configuration added.
Platform-Specific StringConcatenate Actions
concatenate_and_store_string/src/main/java/com/testsigma/addons/android/StringConcatenate.java, concatenate_and_store_string/src/main/java/com/testsigma/addons/ios/StringConcatenate.java, concatenate_and_store_string/src/main/java/com/testsigma/addons/mobileweb/StringConcatenate.java, concatenate_and_store_string/src/main/java/com/testsigma/addons/restapi/StringConcatenate.java, concatenate_and_store_string/src/main/java/com/testsigma/addons/salesforce/StringConcatenate.java, concatenate_and_store_string/src/main/java/com/testsigma/addons/web/StringConcatenate.java, concatenate_and_store_string/src/main/java/com/testsigma/addons/windows/StringConcatenate.java
Seven homogeneous implementations of string concatenation actions across different platforms. Each reads two input strings and a concatenation specifier (none, spaceN, or custom), concatenates accordingly, stores result in runtime variable, and includes error handling with logging.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • Ganesh-Testsigma
  • vigneshtestsigma

Poem

🐰 Whiskers twitch with delight so bright,
Seven actions dancing through the night,
Concatenating strings with space and flair,
Android to Windows, everywhere!
A perfect string, stored safe and sound,

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 clearly describes the main change: adding a class to concatenate strings with special characters and store results in a runtime variable, which aligns with the PR objectives and file changes.

✏️ 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
  • Commit unit tests in branch feat/CUS-10696-Added-class-to-concatenate-two-strings-with-special-chars-and-store-it-in-runtime-variable

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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
Copy Markdown

@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: 11

🧹 Nitpick comments (5)
concatenate_and_store_string/src/main/java/com/testsigma/addons/ios/StringConcatenate.java (1)

6-6: Unused import WebAction.

This class extends IOSAction, not WebAction. This import appears to be a copy-paste artifact from the Web variant.

Proposed fix
-import com.testsigma.sdk.WebAction;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/ios/StringConcatenate.java`
at line 6, Remove the unused import of WebAction which is a leftover from the
web variant; since this class extends IOSAction (class name StringConcatenate),
delete the WebAction import line to avoid unused-import warnings and keep
imports relevant to StringConcatenate/IOSAction.
concatenate_and_store_string/src/main/java/com/testsigma/addons/restapi/StringConcatenate.java (1)

6-6: Unused import WebAction.

This class extends RestApiAction, so the WebAction import is a copy-paste leftover.

Proposed fix
-import com.testsigma.sdk.WebAction;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/restapi/StringConcatenate.java`
at line 6, Remove the unused import com.testsigma.sdk.WebAction from the top of
the file — it's a leftover from copy/paste and not used by the StringConcatenate
class (which extends RestApiAction); open the class StringConcatenate and delete
the WebAction import so only the necessary imports remain.
concatenate_and_store_string/src/main/java/com/testsigma/addons/android/StringConcatenate.java (2)

6-6: Unused import WebAction.

This class extends AndroidAction, so the WebAction import is a copy-paste leftover.

Proposed fix
-import com.testsigma.sdk.WebAction;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/android/StringConcatenate.java`
at line 6, Remove the unused import statement for WebAction: in the
StringConcatenate class (which extends AndroidAction) delete the line importing
com.testsigma.sdk.WebAction to eliminate the unused copy-paste leftover and keep
imports minimal.

34-65: Extract shared concatenation logic into a single utility method.

The execute() body is copy-pasted verbatim across all 7 platform classes (Android, iOS, MobileWeb, Web, REST API, Salesforce, Windows). Any bug fix — like the split("space") issue — must be replicated in every file. Consider extracting the concatenation + runtime-storage logic into a shared static helper (e.g., StringConcatenateHelper.concatenate(...)) that each platform class delegates to. This keeps each platform class as a thin adapter.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/android/StringConcatenate.java`
around lines 34 - 65, Extract the concatenation and runtime-storage logic from
execute() into a shared static helper (e.g.,
StringConcatenateHelper.concatenate) that takes the three input strings (values
from testDataString1, testDataString2, testDataString3) plus the variableName
and runTimeData setter callbacks, performs the space parsing and concatenation
(fixing the split("space") fragility by parsing the numeric suffix robustly),
returns success/failure and the resulting string, and moves
logging/error-message setting (logger.info, setSuccessMessage, setErrorMessage)
into the helper or returns enough info for the caller to do so; then replace the
platform-specific bodies (methods named execute in
Android/iOS/MobileWeb/Web/RestApi/Salesforce/Windows classes) to simply call
StringConcatenateHelper.concatenate(...) and handle the Result return.
concatenate_and_store_string/src/main/java/com/testsigma/addons/salesforce/StringConcatenate.java (1)

6-6: Unused import WebAction.

This class extends SalesforceAction, so the WebAction import on line 6 is a copy-paste leftover and can be removed.

Proposed fix
-import com.testsigma.sdk.WebAction;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/salesforce/StringConcatenate.java`
at line 6, Remove the unused import of WebAction from StringConcatenate.java:
locate the import statement "import com.testsigma.sdk.WebAction;" and delete it
since StringConcatenate extends SalesforceAction and does not reference
WebAction; ensure no other code references WebAction and run a quick compile to
verify no missing symbols.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@concatenate_and_store_string/pom.xml`:
- Around line 42-46: The TestNG dependency block (artifactId "testng", version
"6.14.3") is missing a test scope and will be included in the production jar;
update the dependency declaration to add <scope>test</scope> so TestNG is only
used for tests and not shaded into the production artifact (modify the
dependency entry for artifactId "testng" accordingly).

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/ios/StringConcatenate.java`:
- Around line 47-49: The code in class StringConcatenate currently uses
input.split("space")[1], which crashes on inputs like "space" because split
returns an empty array; change the logic in StringConcatenate to validate the
input format before accessing the second element (or use a regex to extract the
numeric portion), and return or throw a clear validation error (e.g., "invalid
input: expected 'space <number>'") instead of letting the generic catch produce
"Error while concatenating both strings"; specifically update the block that
references split(...) and the exception handling to check array length (or
pattern match with Pattern/Matcher) and provide a precise fallback/error
message.
- Around line 56-57: In class StringConcatenate, fix the user-facing typo by
replacing every occurrence of "RuntTime" with "RunTime" in log and result
messages (search for "RuntTime" in StringConcatenate.java and update the strings
used in logger/error messages and the success/failure message returned to the
caller); ensure both the log call and the success message strings now read
"RunTime" so user-facing output is correct.
- Around line 45-51: The conditional checks using contains("none") and
contains("space") in StringConcatenate are too broad and cause false matches;
update those checks to use equals("none") and equals("space") for exact matching
(or if the intent for the "space" branch is to match prefixes use
startsWith("space") instead). Locate the occurrences of contains("none") and
contains("space") in the StringConcatenate class (the method handling the input
selection) and replace them accordingly so only exact (or explicit prefix)
matches trigger each branch.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/mobileweb/StringConcatenate.java`:
- Around line 55-56: Fix the "RuntTime" typo to "RunTime" in the log and success
messages inside the StringConcatenate class: update the logger.info(...) and
setSuccessMessage(...) calls (which build the message using
variableName.getValue().toString() and testdata3) to use "RunTime" instead of
"RuntTime"; apply the same change across the other six platform files that
contain the identical messages so all logs and success messages are consistent.
- Around line 46-48: The code in StringConcatenate.java (and its 7 platform
copies) unsafely uses strSpecChar.split("space")[1] and Integer.parseInt which
throws when input is exactly "space" or contains non-numeric suffixes; update
the logic in the method that builds testdata3 (reference symbol: testdata3,
string1, string2, strSpecChar) to validate and extract the repeat count safely:
check strSpecChar startsWith("space"), extract the substring after "space", if
empty default to 1, otherwise validate it contains only digits (or use a regex
like "^space(\\d+)$") then parseInt inside a try/catch and fallback to a safe
default on parse failure; apply the same change to all 7 copies so inputs like
"space", "space2", and invalid values no longer throw
ArrayIndexOutOfBoundsException/NumberFormatException.
- Around line 40-41: The code lowercases the entire separator string in
strSpecChar, which corrupts user-provided separators (e.g., "ABC" -> "abc");
change the logic in StringConcatenate (around the variables
strSpecChar/testdata3 and the branch that handles separators) to preserve the
original separator value for concatenation by introducing a raw variable (e.g.,
specCharRaw = testDataString3.getValue().toString().trim()) and only use a
lowercased version (e.g., specChar = specCharRaw.toLowerCase()) for comparisons
against "none"/"space"; then use specCharRaw in the else branch when building
the concatenated string so the original separator case is retained.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/windows/StringConcatenate.java`:
- Around line 3-6: Remove the unused import WebAction from the top of
StringConcatenate.java; the class StringConcatenate extends WindowsAction so
WebAction is unnecessary—delete the line that imports
com.testsigma.sdk.WebAction to clean up imports and avoid IDE/compiler warnings.
- Around line 56-57: Typo "RuntTime" should be corrected to "RunTime" in the log
and success text; update the string literals used in the logger.info(...) and
setSuccessMessage(...) calls (refer to the StringConcatenate class where
logger.info("Successfully stored into RuntTime variable. " +
variableName.getValue().toString() + " = " + testdata3) and
setSuccessMessage(...) are called) so both messages read "Successfully stored
into RunTime variable. ...".
- Around line 44-51: The branching logic in StringConcatenate is unsafe: replace
strSpecChar.contains(...) checks with exact keyword matching
(strSpecChar.equals("none")) and use startsWith("space") for the space-prefix
case so unrelated strings (e.g., "namespace") don't match; do not call
toLowerCase() on the user-supplied delimiter value—only apply case normalization
to a temporary keyword when comparing so the actual delimiter used in
concatenation (strSpecChar) remains unchanged; validate the space count before
calling Integer.parseInt (ensure the suffix after "space" is non-empty and a
non-negative integer) and handle invalid formats with a clear error message
(e.g., "Invalid space count in delimiter") rather than the generic "Error while
concatenating both strings"; update uses of string1, string2, strSpace, and
testdata3 accordingly.

In `@concatenate_and_store_string/src/main/resources/testsigma-sdk.properties`:
- Line 1: The committed secret is the property testsigma-sdk.api.key in
testsigma-sdk.properties; remove the actual JWT from that file and replace it
with a placeholder or delete the file, rotate/invalidate the leaked key
immediately, and update the code to load the API key from a secure source such
as an environment variable (e.g. TESTSIGMA_API_KEY) or a secrets manager instead
of from the properties file; add testsigma-sdk.properties to .gitignore so it
isn’t re-committed, and purge the secret from git history using a
history-rewrite tool (git filter-repo or BFG) and force-push the cleaned branch
after rotation.

---

Duplicate comments:
In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/android/StringConcatenate.java`:
- Around line 1-66: The execute() method mishandles the special-char input:
calling toLowerCase() on testDataString3 will corrupt non-alphabetic separators,
and using strSpecChar.split("space")[1] will throw if no numeric suffix is
present; also the log/success messages contain a "RuntTime" typo. Fix by: read
raw value = testDataString3.getValue().toString().trim() (do not toLowerCase the
whole string), check the "none" case using a case-insensitive compare (e.g.,
equalsIgnoreCase on the original or a lower-cased copy only for the comparison),
detect the "space" pattern with a safe regex (e.g., match
"^\\s*space(\\d*)\\s*$") and parse the captured digits defaulting to 1 (or 0) if
absent, then build testdata3 accordingly; update logger.info and
setSuccessMessage text to "Runtime" (correct spelling) when calling
runTimeData.setKey(...) and setValue(...). Ensure all references: execute(),
testDataString3, testDataString1/2, runTimeData.setValue, runTimeData.setKey,
logger.info, setSuccessMessage are updated.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/restapi/StringConcatenate.java`:
- Around line 1-66: The code in execute() mis-handles the testdata specifier:
calling strSpecChar.toLowerCase() and then split("space")[1] can crash or
corrupt separators (e.g. "@" or "$") and the log/messages contain a "RuntTime"
typo; fix by only normalizing the keyword check (e.g. use a lowercased local
copy like specLower = testDataString3.getValue().toString().trim(); then compare
specLower.equalsIgnoreCase("none") or specLower.startsWith("space") without
altering the original separator), validate that specLower startsWith("space")
and that the numeric part exists and is a valid integer before parsing to avoid
ArrayIndexOutOfBounds/NumberFormatException, and correct the message text from
"RuntTime" to "RunTime" in logger.info and setSuccessMessage; update references
to strSpecChar, testdata3, runTimeData, and variableName in these changes.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/salesforce/StringConcatenate.java`:
- Around line 1-66: The execute() method in StringConcatenate has the same bugs
as the mobileweb variant: using strSpecChar.toLowerCase() mutates the exact
separator (fix by using a separate normalized variable for matching), calling
strSpecChar.split("space")[1] can throw if format is wrong (validate with
startsWith("space") and safe parsing of the integer or use a regex to extract
digits), and the log/setSuccessMessage text contains a "RuntTime" typo. Update
execute() to (1) create a normalized variable like specLower =
testDataString3.getValue().toString().trim().toLowerCase() for conditional
checks while preserving the original separator string for concatenation, (2)
when handling the "spaceN" case ensure specLower startsWith("space") then parse
the number safely (handle NumberFormatException and default or fail gracefully)
instead of blind split("space")[1], and (3) fix the typo in logger.info and
setSuccessMessage to "Runtime". Target symbols: class StringConcatenate, method
execute(), variables testDataString3/strSpecChar/specLower, testdata3,
runTimeData, logger, setSuccessMessage.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/web/StringConcatenate.java`:
- Around line 44-51: The branch logic using strSpecChar incorrectly relies on
contains() and unnormalized casing and parses integers without validation; in
the StringConcatenate logic (variables: strSpecChar, string1, string2,
testdata3, strSpace.repeat) normalize strSpecChar to lower-case once, avoid
using contains() for prefix/suffix checks (use equals() or startsWith("space")),
safely parse the space count after validating the substring (e.g., ensure the
part after "space" is numeric and > =0) and fall back to the delimiter as-is for
other cases; update the "none", "spaceN" and default branches accordingly so
string concatenation uses validated repeat counts and correct delimiter
handling.
- Around line 55-56: Fix the repeated typo "RuntTime" in the success messages
inside StringConcatenate (the logger.info and setSuccessMessage calls) by
replacing "RuntTime" with the correct "Runtime" so both messages read
"Successfully stored into Runtime variable. " +
variableName.getValue().toString() + " = " + testdata3; locate these calls in
the StringConcatenate class and update the string literal used in logger.info
and setSuccessMessage.

---

Nitpick comments:
In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/android/StringConcatenate.java`:
- Line 6: Remove the unused import statement for WebAction: in the
StringConcatenate class (which extends AndroidAction) delete the line importing
com.testsigma.sdk.WebAction to eliminate the unused copy-paste leftover and keep
imports minimal.
- Around line 34-65: Extract the concatenation and runtime-storage logic from
execute() into a shared static helper (e.g.,
StringConcatenateHelper.concatenate) that takes the three input strings (values
from testDataString1, testDataString2, testDataString3) plus the variableName
and runTimeData setter callbacks, performs the space parsing and concatenation
(fixing the split("space") fragility by parsing the numeric suffix robustly),
returns success/failure and the resulting string, and moves
logging/error-message setting (logger.info, setSuccessMessage, setErrorMessage)
into the helper or returns enough info for the caller to do so; then replace the
platform-specific bodies (methods named execute in
Android/iOS/MobileWeb/Web/RestApi/Salesforce/Windows classes) to simply call
StringConcatenateHelper.concatenate(...) and handle the Result return.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/ios/StringConcatenate.java`:
- Line 6: Remove the unused import of WebAction which is a leftover from the web
variant; since this class extends IOSAction (class name StringConcatenate),
delete the WebAction import line to avoid unused-import warnings and keep
imports relevant to StringConcatenate/IOSAction.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/restapi/StringConcatenate.java`:
- Line 6: Remove the unused import com.testsigma.sdk.WebAction from the top of
the file — it's a leftover from copy/paste and not used by the StringConcatenate
class (which extends RestApiAction); open the class StringConcatenate and delete
the WebAction import so only the necessary imports remain.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/salesforce/StringConcatenate.java`:
- Line 6: Remove the unused import of WebAction from StringConcatenate.java:
locate the import statement "import com.testsigma.sdk.WebAction;" and delete it
since StringConcatenate extends SalesforceAction and does not reference
WebAction; ensure no other code references WebAction and run a quick compile to
verify no missing symbols.

Comment on lines +42 to +46
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
</dependency>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

testng dependency is missing <scope>test</scope>.

Without test scope, TestNG will be bundled into the shaded production jar, bloating the artifact and potentially causing classpath conflicts at runtime.

Proposed fix
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
             <version>6.14.3</version>
+            <scope>test</scope>
         </dependency>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@concatenate_and_store_string/pom.xml` around lines 42 - 46, The TestNG
dependency block (artifactId "testng", version "6.14.3") is missing a test scope
and will be included in the production jar; update the dependency declaration to
add <scope>test</scope> so TestNG is only used for tests and not shaded into the
production artifact (modify the dependency entry for artifactId "testng"
accordingly).

Comment on lines +45 to +51
if (strSpecChar.contains("none")) {
testdata3 = string1 + string2;
} else if (strSpecChar.contains("space")) {
Integer spaceCount = Integer.parseInt(strSpecChar.split("space")[1]);
testdata3 = string1 + strSpace.repeat(spaceCount) + string2;
} else {
testdata3 = string1 + strSpecChar + string2;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

contains() should be equals() to prevent false matches.

contains("none") matches inputs like "nonexistent", and contains("space") matches "namespace" or "myspace". Use equals for exact matching (or startsWith for the "space" branch if you want to keep the prefix pattern).

Proposed fix
-            if (strSpecChar.contains("none")) {
+            if (strSpecChar.equals("none")) {
                 testdata3 = string1 + string2;
-            } else if (strSpecChar.contains("space")) {
+            } else if (strSpecChar.startsWith("space")) {
                 Integer spaceCount = Integer.parseInt(strSpecChar.split("space")[1]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/ios/StringConcatenate.java`
around lines 45 - 51, The conditional checks using contains("none") and
contains("space") in StringConcatenate are too broad and cause false matches;
update those checks to use equals("none") and equals("space") for exact matching
(or if the intent for the "space" branch is to match prefixes use
startsWith("space") instead). Locate the occurrences of contains("none") and
contains("space") in the StringConcatenate class (the method handling the input
selection) and replace them accordingly so only exact (or explicit prefix)
matches trigger each branch.

Comment on lines +47 to +49
} else if (strSpecChar.contains("space")) {
Integer spaceCount = Integer.parseInt(strSpecChar.split("space")[1]);
testdata3 = string1 + strSpace.repeat(spaceCount) + string2;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

"space" (without a number) causes an unhandled crash path.

In Java, "space".split("space") returns an empty array, so accessing [1] throws ArrayIndexOutOfBoundsException. While this is caught by the generic catch, the resulting error message ("Error while concatenating both strings") is confusing for a simple input validation issue. Consider validating the format or using a regex to extract the digit portion with a clearer fallback.

Proposed fix using substring
-                Integer spaceCount = Integer.parseInt(strSpecChar.split("space")[1]);
+                String countPart = strSpecChar.substring("space".length());
+                if (countPart.isEmpty()) {
+                    throw new IllegalArgumentException("Space count not specified. Use 'space1', 'space2', etc.");
+                }
+                int spaceCount = Integer.parseInt(countPart);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/ios/StringConcatenate.java`
around lines 47 - 49, The code in class StringConcatenate currently uses
input.split("space")[1], which crashes on inputs like "space" because split
returns an empty array; change the logic in StringConcatenate to validate the
input format before accessing the second element (or use a regex to extract the
numeric portion), and return or throw a clear validation error (e.g., "invalid
input: expected 'space <number>'") instead of letting the generic catch produce
"Error while concatenating both strings"; specifically update the block that
references split(...) and the exception handling to check array length (or
pattern match with Pattern/Matcher) and provide a precise fallback/error
message.

Comment on lines +56 to +57
logger.info("Successfully stored into RuntTime variable. " + variableName.getValue().toString() + " = " + testdata3);
setSuccessMessage("Successfully stored into RuntTime variable. " + variableName.getValue().toString() + " = " + testdata3);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Typo: "RuntTime" → "RunTime" in user-facing messages.

This typo appears in both the log message and the success message.

Proposed fix
-            logger.info("Successfully stored into RuntTime variable. " + variableName.getValue().toString() + " = " + testdata3);
-            setSuccessMessage("Successfully stored into RuntTime variable. " + variableName.getValue().toString() + " = " + testdata3);
+            logger.info("Successfully stored into RunTime variable. " + variableName.getValue().toString() + " = " + testdata3);
+            setSuccessMessage("Successfully stored into RunTime variable. " + variableName.getValue().toString() + " = " + testdata3);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/ios/StringConcatenate.java`
around lines 56 - 57, In class StringConcatenate, fix the user-facing typo by
replacing every occurrence of "RuntTime" with "RunTime" in log and result
messages (search for "RuntTime" in StringConcatenate.java and update the strings
used in logger/error messages and the success/failure message returned to the
caller); ensure both the log call and the success message strings now read
"RunTime" so user-facing output is correct.

Comment on lines +40 to +41
String strSpecChar = testDataString3.getValue().toString().toLowerCase().trim();
String testdata3= "";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

toLowerCase() silently alters the separator character.

Line 40 lowercases the entire testdata input to match "none" / "space", but this also lowercases the actual separator when it falls through to the else branch (line 50). If a user passes "ABC" as a separator, it becomes "abc". Consider only lowercasing for the comparison, not the value used for concatenation.

Proposed fix
-            String strSpecChar = testDataString3.getValue().toString().toLowerCase().trim();
+            String rawSpecChar = testDataString3.getValue().toString().trim();
+            String strSpecCharLower = rawSpecChar.toLowerCase();
             ...
-            if (strSpecChar.contains("none")) {
+            if (strSpecCharLower.contains("none")) {
                 testdata3 = string1 + string2;
-            } else if (strSpecChar.contains("space")) {
-                Integer spaceCount = Integer.parseInt(strSpecChar.split("space")[1]);
+            } else if (strSpecCharLower.contains("space")) {
+                String[] parts = strSpecCharLower.split("space");
+                int spaceCount = (parts.length > 1 && !parts[1].isEmpty())
+                        ? Integer.parseInt(parts[1].trim()) : 1;
                 testdata3  = string1 + strSpace.repeat(spaceCount) + string2;
             } else {
-                testdata3 = string1 + strSpecChar + string2;
+                testdata3 = string1 + rawSpecChar + string2;
             }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/mobileweb/StringConcatenate.java`
around lines 40 - 41, The code lowercases the entire separator string in
strSpecChar, which corrupts user-provided separators (e.g., "ABC" -> "abc");
change the logic in StringConcatenate (around the variables
strSpecChar/testdata3 and the branch that handles separators) to preserve the
original separator value for concatenation by introducing a raw variable (e.g.,
specCharRaw = testDataString3.getValue().toString().trim()) and only use a
lowercased version (e.g., specChar = specCharRaw.toLowerCase()) for comparisons
against "none"/"space"; then use specCharRaw in the else branch when building
the concatenated string so the original separator case is retained.

Comment on lines +55 to +56
logger.info("Successfully stored into RuntTime variable. " + variableName.getValue().toString() + " = " + testdata3);
setSuccessMessage("Successfully stored into RuntTime variable. " + variableName.getValue().toString() + " = " + testdata3);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Typo: "RuntTime" → "RunTime".

Present in both the log message and the success message. Same typo exists in all 7 platform files.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/mobileweb/StringConcatenate.java`
around lines 55 - 56, Fix the "RuntTime" typo to "RunTime" in the log and
success messages inside the StringConcatenate class: update the logger.info(...)
and setSuccessMessage(...) calls (which build the message using
variableName.getValue().toString() and testdata3) to use "RunTime" instead of
"RuntTime"; apply the same change across the other six platform files that
contain the identical messages so all logs and success messages are consistent.

Comment on lines +3 to +6
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.Result;
import com.testsigma.sdk.WebAction;
import com.testsigma.sdk.WindowsAction;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Unused import WebAction.

WebAction is imported but the class extends WindowsAction. Remove the unused import.

Proposed fix
 import com.testsigma.sdk.ApplicationType;
 import com.testsigma.sdk.Result;
-import com.testsigma.sdk.WebAction;
 import com.testsigma.sdk.WindowsAction;
📝 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.

Suggested change
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.Result;
import com.testsigma.sdk.WebAction;
import com.testsigma.sdk.WindowsAction;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.Result;
import com.testsigma.sdk.WindowsAction;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/windows/StringConcatenate.java`
around lines 3 - 6, Remove the unused import WebAction from the top of
StringConcatenate.java; the class StringConcatenate extends WindowsAction so
WebAction is unnecessary—delete the line that imports
com.testsigma.sdk.WebAction to clean up imports and avoid IDE/compiler warnings.

Comment on lines +44 to +51

if (strSpecChar.contains("none")) {
testdata3 = string1 + string2;
} else if (strSpecChar.contains("space")) {
Integer spaceCount = Integer.parseInt(strSpecChar.split("space")[1]);
testdata3 = string1 + strSpace.repeat(spaceCount) + string2;
} else {
testdata3 = string1 + strSpecChar + string2;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

contains() causes incorrect branch matching; toLowerCase() silently corrupts custom delimiters.

Three issues in this block:

  1. contains("none") / contains("space"): Using contains instead of equals means inputs like "noneofyourbusiness" or "namespace" will match unintended branches. Use equals (or startsWith for the "space" prefix pattern).

  2. toLowerCase() on Line 41 alters user-supplied delimiters: If a user provides an uppercase delimiter (e.g., "AND"), it becomes "and". The lowercasing should only apply to the keyword matching, not to the delimiter value used in concatenation.

  3. Line 48 — Integer.parseInt on unvalidated input: "space" without a trailing number yields "", and "space-1" yields -1 which throws IllegalArgumentException from String.repeat(). While the catch block handles it, the error message ("Error while concatenating both strings") is misleading — it's actually a bad input format.

Proposed fix
-            String strSpecChar = testDataString3.getValue().toString().toLowerCase().trim();
+            String strSpecChar = testDataString3.getValue().toString().trim();
+            String strSpecCharLower = strSpecChar.toLowerCase();
             String testdata3= "";
             String strSpace=" ";

-            if (strSpecChar.contains("none")) {
+            if (strSpecCharLower.equals("none")) {
                 testdata3 = string1 + string2;
-            } else if (strSpecChar.contains("space")) {
-                Integer spaceCount = Integer.parseInt(strSpecChar.split("space")[1]);
+            } else if (strSpecCharLower.startsWith("space")) {
+                String numPart = strSpecCharLower.substring("space".length());
+                int spaceCount = Integer.parseInt(numPart);
+                if (spaceCount < 1) {
+                    throw new IllegalArgumentException("Space count must be >= 1, got: " + spaceCount);
+                }
                 testdata3  = string1 + strSpace.repeat(spaceCount) + string2;
             } else {
                 testdata3 = string1 + strSpecChar + string2;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/windows/StringConcatenate.java`
around lines 44 - 51, The branching logic in StringConcatenate is unsafe:
replace strSpecChar.contains(...) checks with exact keyword matching
(strSpecChar.equals("none")) and use startsWith("space") for the space-prefix
case so unrelated strings (e.g., "namespace") don't match; do not call
toLowerCase() on the user-supplied delimiter value—only apply case normalization
to a temporary keyword when comparing so the actual delimiter used in
concatenation (strSpecChar) remains unchanged; validate the space count before
calling Integer.parseInt (ensure the suffix after "space" is non-empty and a
non-negative integer) and handle invalid formats with a clear error message
(e.g., "Invalid space count in delimiter") rather than the generic "Error while
concatenating both strings"; update uses of string1, string2, strSpace, and
testdata3 accordingly.

Comment on lines +56 to +57
logger.info("Successfully stored into RuntTime variable. " + variableName.getValue().toString() + " = " + testdata3);
setSuccessMessage("Successfully stored into RuntTime variable. " + variableName.getValue().toString() + " = " + testdata3);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Typo: "RuntTime" should be "RunTime".

Appears in both the log message and success message.

Proposed fix
-            logger.info("Successfully stored into RuntTime variable. " + variableName.getValue().toString() + " = " + testdata3);
-            setSuccessMessage("Successfully stored into RuntTime variable. " + variableName.getValue().toString() + " = " + testdata3);
+            logger.info("Successfully stored into RunTime variable. " + variableName.getValue().toString() + " = " + testdata3);
+            setSuccessMessage("Successfully stored into RunTime variable. " + variableName.getValue().toString() + " = " + testdata3);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@concatenate_and_store_string/src/main/java/com/testsigma/addons/windows/StringConcatenate.java`
around lines 56 - 57, Typo "RuntTime" should be corrected to "RunTime" in the
log and success text; update the string literals used in the logger.info(...)
and setSuccessMessage(...) calls (refer to the StringConcatenate class where
logger.info("Successfully stored into RuntTime variable. " +
variableName.getValue().toString() + " = " + testdata3) and
setSuccessMessage(...) are called) so both messages read "Successfully stored
into RunTime variable. ...".

@@ -0,0 +1 @@
testsigma-sdk.api.key=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyMjMyMmM2Ni04NWYzLWIyN2UtN2FiOS0zM2U2M2Q4OWM1MGIiLCJ1bmlxdWVJZCI6IjU5NjEiLCJpZGVudGl0eUFjY291bnRVVUlkIjoiMzUifQ.XA9K2Lp9ZwqVlrXB5cyJTIZWkiC_uujedvauPE4UlHGg4I1GS3ScG5OtigTWqm_uU8Ux0E16k5c_TfgLHvVnYg No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Secret/API key committed to source control.

A JWT API key is checked into the repository. The PR description explicitly states this addon will be published publicly, which means this key will be exposed to anyone. Even after removal, it will persist in git history.

Rotate this key immediately and remove it from source. Use environment variables or a secrets manager instead, and add this file to .gitignore.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@concatenate_and_store_string/src/main/resources/testsigma-sdk.properties` at
line 1, The committed secret is the property testsigma-sdk.api.key in
testsigma-sdk.properties; remove the actual JWT from that file and replace it
with a placeholder or delete the file, rotate/invalidate the leaked key
immediately, and update the code to load the API key from a secure source such
as an environment variable (e.g. TESTSIGMA_API_KEY) or a secrets manager instead
of from the properties file; add testsigma-sdk.properties to .gitignore so it
isn’t re-committed, and purge the secret from git history using a
history-rewrite tool (git filter-repo or BFG) and force-push the cleaned branch
after rotation.

@akhil-testsigma akhil-testsigma merged commit 6f492ed into dev Feb 17, 2026
2 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.

2 participants