Skip to main content
QUICK REVIEW

[Paper Review] DeepRNG: Towards Deep Reinforcement Learning-Assisted Generative Testing of Software

Chuan-Yung Tsai, Graham W. Taylor|arXiv (Cornell University)|Jan 29, 2022
Advanced Malware Detection TechniquesComputer Science5 citations
TL;DR

This paper proposes DeepRNG, a deep reinforcement learning (DRL)-assisted generative testing framework that enhances software testing by augmenting the random number generator (RNG) with a DRL agent using an efficient, automatically extractable call stack-based state representation. The framework achieves statistically significant improvements in test coverage and uncovers previously unknown bugs in the Cosmos SDK, a large-scale blockchain framework with over 350,000 lines of code.

ABSTRACT

Although machine learning (ML) has been successful in automating various software engineering needs, software testing still remains a highly challenging topic. In this paper, we aim to improve the generative testing of software by directly augmenting the random number generator (RNG) with a deep reinforcement learning (RL) agent using an efficient, automatically extractable state representation of the software under test. Using the Cosmos SDK as the testbed, we show that the proposed DeepRNG framework provides a statistically significant improvement to the testing of the highly complex software library with over 350,000 lines of code. The source code of the DeepRNG framework is publicly available online.

Motivation & Objective

  • To address the challenge of generating effective and diverse test inputs for complex software systems, particularly in the context of generative testing.
  • To improve software testing efficiency and coverage in large-scale systems like the Cosmos SDK, which has over 350,000 lines of code and is critical for blockchain infrastructure.
  • To develop a framework that integrates deep reinforcement learning directly into the RNG process without requiring manual instrumentation or code modifications.
  • To evaluate whether incorporating history of states, actions, and rewards in the DRL agent's state representation enhances test coverage and bug detection.
  • To demonstrate the practical effectiveness of the framework in identifying previously unknown vulnerabilities in real-world software.

Proposed method

  • The framework uses the full call stack of the software under test as a lightweight, automatically extractable state representation, replacing complex or inefficient representations like coverage bitmaps.
  • A deep reinforcement learning agent (trained with IMPALA) is employed to generate random numbers that maximize test coverage and trigger software failures.
  • The agent’s state representation includes a history of past states, actions, and rewards (SAR), enabling flexible and robust learning without truncating historical context.
  • The state representation is encoded as a one-hot vector over unique call stack patterns observed during execution, enabling efficient processing even in large systems.
  • The agent receives dense, per-step rewards based on increases in branch coverage and a final reward of 1.0 if a test failure (bug) is detected.
  • The system is integrated into the Cosmos SDK test environment, where the DRL agent directly controls the RNG used by the test generator, replacing default random number generation.

Experimental results

Research questions

  • RQ1Can a deep reinforcement learning agent effectively improve test coverage in large-scale software systems by augmenting the random number generator?
  • RQ2Does using a call stack-based state representation outperform traditional coverage bitmap representations in terms of test coverage and efficiency?
  • RQ3How does incorporating a history of states, actions, and rewards (SAR) affect the performance and robustness of the DRL agent in generative testing?
  • RQ4Can the proposed framework identify previously unknown bugs in complex, real-world software systems like the Cosmos SDK?
  • RQ5Is the improvement in test coverage statistically significant when using the DeepRNG framework compared to default random testing?

Key findings

  • The DeepRNG framework achieved a statistically significant improvement in test coverage for the Cosmos SDK, with the CS-SAR configuration yielding a coverage of 11.876% compared to the baseline of 11.861%, p = 0.012.
  • The call stack (CS) representation alone outperformed the coverage bitmap (CB) representation, despite CB carrying more information, suggesting that information density does not always correlate with performance in RL-based testing.
  • Incorporating reward history (SAR) improved performance, with configurations including SAR showing the most significant improvements and robustness across repeated runs.
  • The framework successfully uncovered at least two new types of bugs in the Cosmos SDK: invalid initialization and unexpected timeouts.
  • The use of a lightweight, automatically extractable call stack representation enabled efficient and scalable integration into the Cosmos SDK without requiring source code modifications.
  • The results demonstrate that a DRL agent can effectively guide test generation by learning from state, action, and reward history, leading to more effective exploration of complex software state spaces.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.