US 11,893,363 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 Oct. 27, 2020, as Appl. No. 17/080,843.
Claims priority of provisional application 63/071,335, filed on Aug. 27, 2020.
Prior Publication US 2022/0066747 A1, Mar. 3, 2022
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)] 14 Claims
OG exemplary drawing
 
1. A system comprising:
one or more processors; and
a memory that stores one or more programs that are configured to be executed by the one or more processors, the one or more programs including instructions to perform actions that:
pre-train a first neural transformer model with attention with a first unsupervised training dataset to learn semantic relationships of a natural language, the first unsupervised training dataset comprising a plurality of sequences of the natural language;
pre-train the first neural transformer model with attention with a second unsupervised training dataset to learn syntax of a programming language and se mantic relationships of code elements of the programming language, the second unsupervised training dataset comprising a plurality of sequences of source code from source code methods of the programming language;
fine-tune the first neural transformer model with attention with a supervised training dataset to learn to generate a unit test case fora given focal method written in the programming language, wherein the supervised dataset comprises mapped unit test case pairs, wherein a mapped unit test case pair of the mapped unit test case pairs includes a focal method and an associated unit test case written in the programming language, wherein fine-tuning the first neural transformer model with attention with the supervised training dataset is a translation task with a training objective that learns a mapping of a focal method to a unit test case, fmi→tci, as a conditional probability P(tci, fmi); and
deploy the first neural transformer model with attention in a unit test case generation system to predict a unit test case fora target method of a source code program.