US 12,175,214 B2
Unit test case generation with transformers
Dawn Drain, Bellevue, WA (US); Neelakantan Sundaresan, Bellevue, WA (US); Alexey Svyatkovskiy, Bellevue, WA (US); and Michele Tufano, Bellevue, WA (US)
Assigned to Microsoft Technology Licensing, LLC., Redmond, WA (US)
Filed by MICROSOFT TECHNOLOGY LICENSING, LLC., Redmond, WA (US)
Filed on Dec. 26, 2023, as Appl. No. 18/396,642.
Application 18/396,642 is a continuation of application No. 17/080,843, filed on Oct. 27, 2020, granted, now 11,893,363.
Claims priority of provisional application 63/071,335, filed on Aug. 27, 2020.
Prior Publication US 2024/0143292 A1, May 2, 2024
Int. Cl. G06F 9/44 (2018.01); G06F 8/35 (2018.01); G06F 17/18 (2006.01); G06N 3/084 (2023.01); G06N 3/088 (2023.01); G06N 5/046 (2023.01)
CPC G06F 8/35 (2013.01) [G06F 17/18 (2013.01); G06N 3/084 (2013.01); G06N 3/088 (2013.01); G06N 5/046 (2013.01)] 20 Claims
OG exemplary drawing
 
1. A system, comprising:
a processor; and
a memory that stores a program configured to be executed by the processor;
wherein the program comprises instructions to perform actions that:
receive a target method of a source code program;
convert the target method into an input sequence of tokens;
translate the input sequence into an output sequence using a neural transformer model with attention, wherein the output sequence comprises a sequence of tokens representing a unit test case for the target method,
wherein the translation performs a beam search that generates each token in one or more candidate unit test case sequences, one at a time at each timestep of a plurality of timesteps,
wherein the beam search selects top k tokens at a timestep, to expand the one or more candidate unit test case sequences, based on an output distribution generated at the timestep by the neural transformer model with attention, and
wherein the top k tokens instantiate k data paths that are iteratively processed by the beam search to expand the one or more candidate unit test case sequences until an end-of-method token is predicted to complete a select candidate unit test case sequence as the output sequence.