Nordnet bug testing with Robot Framework
On financial platforms, it is crucial to test systems and libraries quickly and efficiently. Recently, Nordnet’s GitHub repository showcased a bug in the Lettuce Java Redis client that led to unwanted data exposure between customers. The bug caused cross-account access, allowing one user to perform CRUD operations (create, Read, Update and Delete) on another user’s account.
the original repository can be found here https://github.com/nordnet/lettuce-out-of-order
How can you test something when you don’t fully understand how it works?
This is a common challenge in legacy systems and external APIs. Instead of debugging the source code, we will explore a black-box testing approach using Robot Framework, which allows QA teams to verify issues without internal system knowledge.
According to Nordnet’s repository:
“This project demonstrates a bug in the Lettuce Java Redis client, where under certain circumstances the client enters a state where it mixes up the responses from concurrent Redis operations with one another.”
“The test will start concurrent Redis set and get operations in multi-threaded mode. A JVM fatal error is thrown randomly during the set operation. The return value of the get operation will be polluted with wrong values from other get operations. The test will fail since the number of value mismatching errors should be 0.”
This blog post explores a black-box approach to detecting Redis lettuce out of order bug using Robot Framework, allowing test engineers to verify the issue without needing access to the underlying code. Tests only needs access to the redis lettuce server.
Setting up the environment
To replicate the bug, we need a local Redis-Lettuce setup:
- Install Ubuntu LTS and set up Redis with Lettuce packages (alternatively, use Docker).
- Create a basic Java application with Maven, Redis, and Lettuce to verify the environment is correctly configured.
- Generate a more advanced test setup using AI to replicate the bug efficiently. By making things Simple from data point of view I Set up data as incrementing unique value as key and same for value so key and value pair should be identicals.
- Implement a Robot Framework test script to catch mismatched Redis values.
Black-Box testing with Robot Framework
Instead of relying on Nordnet’s white-box approach, where developers examine the bug by analyzing code, our method treats the system as a black box—meaning we test without knowing how the internals function.
Install Required Libraries
pip install -U robotframework-redislibrary
Required dependencies:
- robotframework-redislibrary 1.2.5
- robotframework 7.2.2
Robot Framework Script
This script fetches all Redis keys, compares them to expected values, and logs discrepancies:
*** Settings ***
Library RedisLibrary
Library Collections
Library OperatingSystem
*** Variables ***
${REDIS_HOST} localhost
${REDIS_PORT} 6379
${MISMATCH_LOG} mismatches.csv
*** Test Cases ***
Check Keys With Value Mismatch
[Documentation] Fetch all Redis keys, compare value == key, log mismatches to CSV
${conn}= Connect To Redis ${REDIS_HOST} ${REDIS_PORT}
Create File ${MISMATCH_LOG} Key,Value
@{all_keys}= Get All Match Keys ${conn} *
FOR ${key} IN @{all_keys}
${val}= Get From Redis ${conn} ${key}
IF ’${key}’ != ’${val}’
Append To CSV File ${MISMATCH_LOG} ${key} ${val}
END
END
*** Keywords ***
Append To CSV File
[Arguments] ${file} ${key} ${value}
${line}= Catenate SEPARATOR=, ${key} ${value}
Append To File ${file} ${line}
This script runs against a fresh Redis-Lettuce setup and identifies mismatched values in under 30 seconds for 25,000 cached items—making it highly efficient for large-scale testing.
Why use this approach?
Key Benefits
- Speed & Efficiency: This method is significantly faster than traditional debugging because it doesn’t require modifying application code.
- Black-Box Independence: Unlike white-box testing, which requires internal system knowledge, this approach enables QA teams to validate issues without touching the implementation.
- Scalability: Running this test on different versions of Redis-Lettuce or other key-value stores is straightforward.
- Bug Verification: The test confirms Nordnet’s reported bug by demonstrating the same data corruption problem in a real-world testing scenario.
- Applicable Beyond This Bug: This approach is widely useful for testing legacy systems and external APIs where the implementation details are unclear or inaccessible.
Robot Framework for black-box testing
This blog has shown how Robot Framework can be used for black-box testing of Redis-Lettuce bugs, providing a fast, scalable, and implementation-independent approach. The methodology allows QA teams to detect and validate security risks like those reported by Nordnet, ensuring that real-world vulnerabilities are addressed efficiently.
By leveraging this technique, testers can rapidly verify issues without relying on developer access or internal system knowledge, making it ideal for enterprise environments dealing with complex or legacy codebases.
Would you implement this method in your testing workflow? Let us know your thoughts or contact us!
