A Framework for Testing Concurrent Programs

本文讨论了测试驱动开发方法在软件行业的应用,特别关注于如何改进并发程序的测试过程。通过介绍ConcJUnit、ThreadChecker和Schedule-Based Execution等工具,作者展示了如何解决并发程序测试中遇到的问题,如辅助线程忽略错误、多线程调度的不确定性及线程假设执行等问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://www.cs.rice.edu/~mgricken/research/concutest/intro.shtml


Incremental, test-driven development is sweeping the software industry, supplanting more monolithic approaches to software development. Test-driven approaches to software development like Extreme Programming elevate testing from an ancillary activity to an integral part of the programming process. Tests for a program unit are written before the code, driving the design of the program and catching bugs early in its development. These tests form an integral part of the program code base, facilitating program reliability, continual integration, and refactoring.

In our recent experience developing production programs in Java, unit testing has proven effective in assuring the reliability of code with a single thread of control. Open source testing frameworks like JUnit work well in this context. Unfortunately, we have found unit testing is much less effective at assuring the reliabilty of code with multiple threads of control, often simply because the the testing framework silently ignores failures in auxiliary threads. Since thread scheduling is non-deterministic, a unit test can succeed on one run and fail on the next. Moreover, the scheduling characteristics of the test platform can skew test results, hiding synchronization bugs until the program is run on a different platform.

Java libraries and user programs furthermore frequently make assumptions about the threading context in which they execute, but these assumptions are rarely enforced by the actual code and typically only appear in program documentation or white papers, if at all.

To make development of concurrent programs easier, we are developing:

  1. ConcJUnit: An extension of the JUnit framework, actively supporting the developer by treating tests that could silently ignore failures in auxiliary threads as test errors;
  2. Thread Checker: A lightweight annotation language, which can be used to specify and check the threading invariants of both existing and new code;
  3. Schedule-Based Execution: A testing framework that can execute unit tests according to a specified set of recorded or generated schedules, elevating the unit testing of concurrent programs to a rigorous, deterministic process.

There is more information available about the components on their respective pages:


Supplemental material



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值