paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Automatically testing console I/O behavior of student submissions in Haskell

自动测试 Haskell 学生提交的控制台 I/O 行为
JFP vol.352025匹配度 2/10 · 论文聚焦 Haskell 控制台 I/O 的教学自动测试与规约语言,属于程序测试/DSL 方向,但不涉及 LLM/Agent、静态分析、浮点程序分析或贝叶斯程序分析等用户核心方向。引用 0 inbox
OLIVER WESTPHAL, JANIS VOIGTLÄNDER
crossref: 2026-09-10

AI 速览

一句话:提出描述 Haskell 控制台 I/O 交互行为的规约语言与自动测试框架,并用约束求解器生成有意义的输入序列。

在 Haskell 教学中,测试纯函数程序已有 QuickCheck 等成熟工具,但控制台 I/O 程序的交互行为难以用声明式性质描述,自动评分与学生自测都缺乏支持。本文用程序文本输入/输出动作的 trace 刻画控制台交互,并设计一种形式规约语言来描述哪些 trace 符合预期行为。该语言有意限制表达力,以确保所描述的是真正交互行为,而非伪装的纯字符串生成函数,同时保持规约简洁清晰。基于该语言,作者实现自动测试框架,其核心是用约束求解器为被测程序寻找有意义的输入序列,从而支持对 Haskell 控制台 I/O 程序进行自动化测试。

问题
如何为 Haskell 学生提交的控制台 I/O 程序提供声明式、可自动检验的测试支持,尤其是在 QuickCheck 等标准工具无法直接描述交互行为的情况下。
方法
用文本输入/输出动作的 trace 表示控制台交互,设计一种形式规约语言来匹配预期 trace,并实现基于该规约的测试框架;框架使用约束求解器生成有意义的输入序列。
评估
据摘要,作者以常见教材练习和教学示例中的交互行为为覆盖目标来设计规约语言,并通过实现自动化测试框架展示其可用性;摘要未给出量化评估结果。
原文摘要(Abstract)

Abstract Good test-suites are an important tool to check the correctness of programs. They are also essential in unsupervised educational settings, like automatic grading or for students to check their solution to some programming task by themselves. For most Haskell programming tasks, one can easily provide high-quality test-suites using standard tools like QuickCheck. Unfortunately, this is no longer the case once we leave the purely functional world and enter the lands of console I/O. Nonetheless, understanding console I/O is an important part of learning Haskell, and we would like to provide students the same support as with other subject matters. The difficulty in testing console I/O programs arises from the standard tools’ lack of support for specifying intended console interactions as simple declarative properties. These interactions are however essential in order to determine whether a program behaves as desired. We describe the console interactions of a program by tracing its text input and output actions. In order to describe which traces match the intended behavior of the program under test, we present a formal specification language. The language is designed to capture interactive behavior found in commonly used textbook exercises and examples, or as much of it as possible, as well as in our own teaching, while at the same time retaining simplicity and clarity of specifications. We intentionally restrict the language, ensuring that expressed behavior is truly interactive and not simply a pure string-builder function in disguise. Based on this specification language, we build a testing framework that allows testing against specifications in an automated way. A central feature of the testing procedure is the use of a constraint solver in order to find meaningful input sequences for the program under test.

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@article{WestphalV25,
  title = {Automatically testing console I/O behavior of student submissions in Haskell},
  author = {OLIVER WESTPHAL and JANIS VOIGTLÄNDER},
  journal = {Journal of Functional Programming},
  volume = {35},
  year = {2025},
  doi = {10.1017/s0956796825100075}
}