Language-agnostic unit testing
AssigneeRed Hat, Inc.
InventorsEric Philip Wittmann, Enda Martin Phelan
Life of this patent
Estimating the term…
Abstract
Systems and methods for language-agnostic unit testing are generally described. In various examples, first data including first source code written in a first programming language may be received. Configuration data configured to execute language-agnostic unit testing may be loaded. Input data may be determined from the first data based on a first input defined by the configuration data for a first unit test. A first driver written in the first programming language may be determined from the configuration data. The first driver may include computer-executable instructions configured to execute the first unit test. First output data may be generated by executing the first computer-executable instructions to perform the first unit test on the first input data.
Claims20
A method comprising:
- receiving, by a processor, first source code written in a first programming language;
- loading, by the processor, configuration data into memory, wherein the configuration data defines a first unit test, wherein the configuration data comprises a language-agnostic portion that is without programming-language-specific annotations and semantics, wherein the language-agnostic portion of the configuration data comprises a first input for the first unit test and first assertion data for the first unit test, wherein the language-agnostic portion of the configuration data further comprises logic of the first unit test, wherein the configuration data further comprises driver data for the first unit test, the driver data specifying a first driver for implementing the first unit test and a programming language in which the first driver is written, wherein the first driver is transpilable into a different programming language, and wherein the first driver is transpiled into the first programming language;
- based on the loaded configuration data indicating that the first driver is written in the first programming language, instantiating, by the processor, the first driver for use in performing the first unit test, the first driver comprising a first set of computer-executable instructions configured to execute the first unit test according to the logic of the first unit test defined in the loaded configuration data;
- based on the loaded configuration data indicating that the first input is to be provided to the first unit test, passing, by the processor, first input data corresponding to the first input to the first driver;
- and
- executing, by the processor, the first set of computer-executable instructions of the first driver to implement the logic of the first unit test for performing the first unit test based on the first input data to generate first output data.
A system comprising:
- at least one processor;
- and
- a non-transitory computer-readable memory storing instructions that, when executed by the at least one processor, are effective to:
- receive first source code written in a first programming language;
- load configuration data into memory, wherein the configuration data defines a first unit test, wherein the configuration data comprises a language-agnostic portion that is without programming-language-specific annotations and semantics, wherein the language-agnostic portion of the configuration data comprises a first input for the first unit test and first assertion data for the first unit test, wherein the language-agnostic portion of the configuration data further comprises logic of the first unit test, wherein the configuration data further comprises driver data for the first unit test, the driver data specifying a first driver for implementing the first unit test and a programming language in which the first driver is written, wherein the first driver is transpilable into a different programming language, and wherein the first driver is transpiled into the first programming language;
- based on the loaded configuration data indicating that the first driver is written in the first programming language, instantiate the first driver for use in performing the first unit test, the first driver comprising a first set of computer-executable instructions configured to execute the first unit test according to the logic of the first unit test defined in the loaded configuration data;
- based on the loaded configuration data indicating that the first input is to be provided to the first unit test, passing, by the processor, first input data corresponding to the first input to the first driver;
- and
- execute the first set of computer-executable instructions of the first driver to implement the logic of the first unit test for performing the first unit test based on the first input data to generate first output data.
A non-transitory computer-readable memory storing instructions that, when executed by at least one processor, are effective to perform operations comprising:
- receiving first source code written in a first programming language;
- loading language-agnostic configuration data into the non-transitory computer-readable memory, wherein the configuration data defines a first unit test, configuration data comprises a language-agnostic portion that is without programming-language-specific annotations and semantics, wherein the language-agnostic portion of the configuration data comprises a first input for the first unit test and first assertion data for the first unit test, wherein the language-agnostic portion of the configuration data further comprises logic of the first unit test, wherein the configuration data further comprises driver data for the first unit test, the driver data specifying a first driver for implementing the first unit test and a programming language in which the first driver is written, wherein the first driver is transpilable into a different programming language, and wherein the first driver is transpiled into the first programming language;
- based on the loaded configuration data indicating that the first driver is written in the first programming language, instantiate the first driver for use in performing the first unit test, the first driver comprising a first set of computer-executable instructions configured to execute the first unit test according to the logic of the first unit test defined in the loaded configuration data;
- based on the loaded configuration data indicating that the first input is to be provided to the first unit test, passing first input data corresponding to the first input to the first driver;
- and
- executing the first set of computer-executable instructions of the first driver to implement the logic of the first unit test for performing the first unit test based on the first input data to generate first output data.
Dependencies are inferred from the claim text.