IP Library Granted Patent US 8,028,276
Granted Patent B1
US 8,028,276 · App. 11/771,362 · Granted Sep 27, 2011

Method and system for generating a test file

Assignee: Oracle America, Inc.
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 8,028,276
App. No.
11/771,362
Granted
Sep 27, 2011
Kind
B1
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.

Claims (86)

1. 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.

2. The method of claim 1 , further comprising:

testing a program using the generated test file to determine whether the program is compatible with a program specification.

3. The method of claim 1 , wherein creating the test case further comprises:

determining whether the method has macro information based on a third testing annotation in the method;

retrieving a macro using the macro information; and

using the macro to create the test case.

4. The method of claim 3 , wherein creating the test case further comprises:

identifying a macro definition for the macro based on the third testing annotation; and

importing the macro definition into the test case.

5. The method of claim 1 , wherein generating the test code further comprises:

identifying a support class in the data structure representation; and

adding the support class to the test group.

6. The method of claim 1 , wherein the test case comprises test metadata.

7. The method of claim 6 , wherein the test metadata comprises an assertion.

8. The method of claim 1 , wherein the object oriented programming language is Java™.

9. The method of claim 1 , wherein the markup language is extensible markup language.

10. The method of claim 1 , wherein the data structure representation is a tree.

11. 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.

12. The system of claim 11 , further comprising:

a testing tool configured to:

test a program using the generated test file to determine whether the program is compatible with a program specification.

13. The system of claim 12 , wherein the testing tool is a Java™ Compatibility Kit.

14. The system of claim 11 , wherein the markup language is extensible markup language.

15. 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.

Assignments (2)
MERGER AND CHANGE OF NAME Recorded Dec 16, 2015
From: ORACLE USA, INC.; SUN MICROSYSTEMS, INC.; ORACLE AMERICA, INC.
To: ORACLE AMERICA, INC.
Reel/Frame 037311/0121 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 29, 2007
From: BESSONOV, DMITRY NICHOLAEVICH
To: SUN MICROSYSTEMS, INC.
Reel/Frame 019499/0559 →