ProbTest: Unit Testing for Probabilistic Programs

Publikation: Konference artikel i Proceeding eller bog/rapport kapitelKonferencebidrag i proceedingsForskningpeer review

Abstract

Testing probabilistic programs is non-trivial due to their stochastic nature. Given an input, the program may produce different outcomes depending on the underlying stochastic choices in the program. This means testing the expected outcomes of probabilistic programs requires repeated test executions unlike deterministic programs where a single execution may suffice for each test input. This raises the following question: how many times should we run a probabilistic program to effectively test it? This work proposes a novel black-box unit testing method, ProbTest, for testing the outcomes of probabilistic programs. Our method is founded on the theory surrounding a well-known combinatorial problem, the coupon collector’s problem. Using this method, developers can write unit tests as usual without extra effort while the number of required test executions is determined automatically with statistical guarantees for the results. We implement ProbTest as a plug-in for PyTest, a well-known unit testing tool for python programs. Using this plug-in, developers can write unit tests similar to any other Python program and the necessary test executions are handled automatically. We evaluate the method on case studies from the Gymnasium reinforcement learning library and a randomized data structure.
OriginalsprogEngelsk
TitelProceedings of 23rd International Conference on Software Engineering and Formal Methods (SEFM 2025)
Vol/bind16192
ForlagSpringer Nature Switzerland
Publikationsdato12 nov. 2025
Sider91-109
ISBN (Trykt)978-3-032-10443-4
ISBN (Elektronisk)978-3-032-10444-1
DOI
StatusUdgivet - 12 nov. 2025
BegivenhedSoftware Engineering and Formal Methods - Spain, Toledo, Spanien
Varighed: 12 nov. 202514 nov. 2025
Konferencens nummer: 23
https://sefm-conference.github.io/2025/

Konference

KonferenceSoftware Engineering and Formal Methods
Nummer23
LokationSpain
Land/OmrådeSpanien
ByToledo
Periode12/11/202514/11/2025
Internetadresse
NavnLNCS
Vol/bind16192

Fingeraftryk

Dyk ned i forskningsemnerne om 'ProbTest: Unit Testing for Probabilistic Programs'. Sammen danner de et unikt fingeraftryk.

Citationsformater