Papers › TOGA: A Neural Method for Test Oracle Generation

TOGA: A Neural Method for Test Oracle Generation

20 Sep 2021arXiv:2109.09262links table onlyarchive 2025-07-28

Elizabeth Dinella, Gabriel Ryan, Todd Mytkowicz, Shuvendu K. Lahiri

The archive published only this paper's code-link row. Authors, date and abstract are from arXiv's metadata (CC0), read from the Kaggle arXiv metadata snapshot of 2026-09-12 where its title matched the archive's; the title is the archive's.

Testing is widely recognized as an important stage of the software development lifecycle. Effective software testing can provide benefits such as bug finding, preventing regressions, and documentation. In terms of documentation, unit tests express a unit's intended functionality, as conceived by the developer. A test oracle, typically expressed as an condition, documents the intended behavior of a unit under a given test prefix. Synthesizing a functional test oracle is a challenging problem, as it must capture the intended functionality rather than the implemented functionality. In this paper, we propose TOGA (a neural method for Test Oracle GenerAtion), a unified transformer-based neural approach to infer both exceptional and assertion test oracles based on the context of the focal method. Our approach can handle units with ambiguous or missing documentation, and even units with a missing implementation. We evaluate our approach on both oracle inference accuracy and functional bug-finding. Our technique improves accuracy by 33\% over existing oracle inference approaches, achieving 96\% overall accuracy on a held out test dataset. Furthermore, we show that when integrated with a automated test generation tool (EvoSuite), our approach finds 57 real world bugs in large-scale Java programs, including 30 bugs that are not found by any other automated testing method in our evaluation.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2109.09262")

Code

Syntology Ran 1 of 22 code samples harvested from 1 repository linked to this paper; 21 have no recorded run. Of those that ran: 1 ran · honoured contract.

By repository: official repository: 22 samples from 1 repository, 1 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

microsoft/toga officialmentioned in paperpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

22 samples harvested; 1 ran; 1 honoured the contract we drafted; 21 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
21unverified

Licence: 0 of the 22 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from microsoft/toga. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

accuracy microsoft/toga/model/assertions/run_classifier.py official repository ran · honoured contract fingerprinted MIT (permissive) · eb725d5794b15f6b · report
acc_and_f1 microsoft/toga/model/assertions/utils.py official repository unverified MIT (permissive) · 15b03d85dc1e5392 · report
bool_assert_to_equals microsoft/toga/eval/gen_tests_from_metadata.py official repository unverified MIT (permissive) · 8efa0e429d75adda · report
checkout_project microsoft/toga/eval/extract_tests.py official repository unverified MIT (permissive) · 302fca0ae159d4a6 · report
clean microsoft/toga/model/exception_data.py official repository unverified MIT (permissive) · 264bcac39d00a4e1 · report
convert_examples_to_features microsoft/toga/model/assertions/utils.py official repository unverified MIT (permissive) · 95c91a2b77c7fb96 · report
diff microsoft/toga/model/ranking.py official repository unverified MIT (permissive) · 9a5769855cf4c041 · report
get_active_bugs microsoft/toga/eval/collect_test_results.py official repository unverified MIT (permissive) · f052c69e11bdefba · report
get_block microsoft/toga/model/exception_data.py official repository unverified MIT (permissive) · bd5b0111e170a7f5 · report
get_bug_catching_tests microsoft/toga/eval/extract_bug_metadata.py official repository unverified MIT (permissive) · a260552ed8c878b5 · report
get_imports microsoft/toga/eval/aggregate_test_cases.py official repository unverified MIT (permissive) · cb2f381214a3dc43 · report
get_prefix microsoft/toga/eval/gen_tests_from_metadata.py official repository unverified MIT (permissive) · 322a7d0ecccd0222 · report
get_project_layout microsoft/toga/eval/collect_test_results.py official repository unverified MIT (permissive) · b0740759b39327f1 · report
get_test_harness microsoft/toga/eval/aggregate_test_cases.py official repository unverified MIT (permissive) · a6787586150c671d · report
get_worst_idx microsoft/toga/model/ranking.py official repository unverified MIT (permissive) · 40f0e80317b58c01 · report
insert_assertion microsoft/toga/eval/gen_tests_from_metadata.py official repository unverified MIT (permissive) · 1af26ededf7d7d6e · report
is_float microsoft/toga/model/assertion_data.py official repository unverified MIT (permissive) · 3867c570f55a2b22 · report
is_int microsoft/toga/model/assertion_data.py official repository unverified MIT (permissive) · 1ed3568420522363 · report
is_string microsoft/toga/model/assertion_data.py official repository unverified MIT (permissive) · 3f624daa44a57816 · report
magnitude microsoft/toga/model/ranking.py official repository unverified MIT (permissive) · b1e068a15b29a878 · report
normalize_assertThrows microsoft/toga/model/exception_data.py official repository unverified MIT (permissive) · c1793bf24d6a0bf4 · report
simple_accuracy microsoft/toga/model/assertions/utils.py official repository unverified MIT (permissive) · 3c241ecfe3749a6d · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections