Back to results
US 8,028,276 B1Granted
Method and system for generating a test file
AssigneeOracle America, Inc.
InventorDmitry Nickolaevich Bessonov
Life of this patent
Estimating the term…
Abstract
A method for generating a test file, that includes parsing annotated test code written in a source language to create a data structure representation of the annotated test code, generating test code in a markup language according to a plurality of testing definitions using the data structure representation, and storing the test code in the markup language in the test file.
Claims15
A method for generating a test file, comprising:
- receiving annotated test code comprising a first testing annotation, a second testing annotation, a class, and a method comprising test case code,
- wherein the first testing annotation defines an attribute value for an attribute of a test group,
- wherein the second testing annotation defines an attribute value for an attribute of a test case, and
- wherein the annotated test code is written using an object oriented programming language;
- parsing, by one or more computer processors, the annotated test code to create a data structure representation of the annotated test code;
- generating, by the one or more computer processors and using the data structure representation, test code in a markup language according to a plurality of testing definitions to obtain generated test code, wherein generating the test code comprises:
- identifying the class in the data structure representation;
- determining, by an existence of the first testing annotation in the class, that the class is a test group class;
- obtaining a template for the test group class in response to determining that the class is the test group class;
- extracting, from the data structure representation, the attribute value for the attribute of the test group in the first testing annotation;
- identifying, from the first testing annotation, a markup language tag defining a first field in the template;
- populating a value of the first field in the template with the attribute value for the attribute of the test group;
- identifying the method in the data structure representation;
- determining, by an existence of the second testing annotation in the class, that the method corresponds to the test case;
- and
- creating, using the template, the test case in response to determining that the method corresponds to the test case by:
- extracting, from the data structure representation, the attribute value for the attribute of the test case in the second testing annotation;
- identifying, from the second testing annotation, a markup language tag defining a second field in the template;
- populating a value of the second field in the template with the attribute value for the attribute of the test case;
- and
- storing the test case code in a body of the test case;
- and
- storing the generated test code in the test file.
20 more elements
A system for generating a test file, comprising:
- a computer processor;
- a program development tool, executing on the computer processor, for creating annotated test code using an object oriented programming language and comprising a first testing annotation, a second testing annotation, a class, and a method comprising test case code, wherein the first testing annotation defines an attribute value for an attribute of a test group, and wherein the second testing annotation defines an attribute value for an attribute of a test case, and
- a transformation tool executing on the computer processor and configured to:
- receive the annotated test code from the program development tool;
- parse the annotated test code to create a data structure representation of the annotated test code;
- generate, using the data structure representation, test code in a markup language according to a plurality of testing definitions to obtain generated test code, wherein generating the test code comprises:
- identifying the class in the data structure representation;
- determining, by an existence of the first testing annotation in the class, that the class is a test group class;
- obtaining a template for the test group class in response to determining that the class is the test group class;
- extracting, from the data structure representation, the attribute value for the attribute of the test group in the first testing annotation;
- identifying, from the first testing annotation, a markup language tag defining a first field in the template;
- populating a value of the first field in the template with the attribute value for the attribute of the test group;
- identifying the method in the data structure representation;
- determining, by an existence of the second testing annotation in the class, that the method corresponds to the test case;
- and
- creating, using the template, the test case in response to determining that the method corresponds to the test case by:
- extracting, from the data structure representation, the attribute value for the attribute of the test case in the second testing annotation;
- identifying, from the second testing annotation, a markup language tag defining a second field in the template;
- populating a value of the second field in the template with the attribute value for the attribute of the test case;
- and
- storing the test case code in a body of the test case;
- and
- store the generated test code in the test file.
20 more elements
A non-transitory computer readable medium comprising computer code embodied therein for causing a computer system to:
- receive annotated test code comprising a first testing annotation, a second testing annotation, a class, and a method comprising test case code,
- wherein the first testing annotation defines an attribute value for an attribute of a test group,
- wherein the second testing annotation defines an attribute value for an attribute of a test case, and
- wherein the annotated test code is written using an object oriented programming language;
- parse annotated test code to create a data structure representation of the annotated test code;
- generate, using the data structure representation, test code in a markup language according to a plurality of testing definitions to obtain generated test code,
- wherein generating the test code comprises:
- identifying the class in the data structure representation;
- determining, by an existence of the first testing annotation in the class, that the class is a test group class;
- obtaining a template for the test group class in response to determining that the class is the test group class;
- extracting, from the data structure representation, the attribute value for the attribute of the test group in the first testing annotation;
- identifying, from the first testing annotation, a markup language tag defining a first field in the template;
- populating a value of the first field in the template with the attribute value for the attribute of the test group;
- identifying the method in the data structure representation;
- determining, by an existence of the second testing annotation in the class, that the method corresponds to the test case;
- and
- creating, using the template, the test case in response to determining that the method corresponds to the test case by:
- extracting, from the data structure representation, the attribute value for the attribute of the test case in the second testing annotation;
- identifying, from the second testing annotation, a markup language tag defining a second field in the template;
- populating a value of the second field in the template with the attribute value for the attribute of the test case;
- and
- storing the test case code in a body of the test case;
- and
- store the generated test code in a test file.
21 more elements
Dependencies are inferred from the claim text.