IP Library › Granted Patent US 12,657,118
Granted Patent B2
US 12,657,118 · App. 18/497,749 · Granted Jun 16, 2026

Automated generation of java unit tests

Inventors: Peter Rozovski (Concord, CA); Daniel Goldvekht (Millbrae, CA)
Assignee: Wells Fargo Bank, N.A.
G06F11/3696G06F11/3684
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 12,657,118
App. No.
18/497,749
Granted
Jun 16, 2026
Kind
B2
Abstract

Systems and techniques for automated generation of Java unit tests, in the context of testing a code base for a financial transaction software application, are described. An example method for automated generation of Java unit tests includes: identifying default values used in Java source code of a financial transaction software application that is programmed and capable to perform batch processing of a plurality of financial transactions; identifying classes in the Java source code that are invoked by the financial transaction software application, as invoked during the batch processing; generating mock classes for the identified classes that are invoked; creating unit tests to perform unit testing of the identified classes that are invoked, the unit tests configured to invoke the mock classes and use the default values for unit testing of the identified classes; and outputting the unit tests (and optionally, executing the unit tests).

Claims (50)

1 . A method for automated generation of Java unit tests, performed with automated operations executed by at least one processor of a computer system, the method comprising:

identifying default values used in a code base of Java source code of a financial transaction software application by analyzing usage of primitives and Java Development Kit (JDK) classes in the Java source code, the financial transaction software application programmed to perform batch processing of a plurality of financial transactions;

identifying classes in the Java source code that are invoked by the financial transaction software application, the identified classes invoked during the batch processing of the plurality of financial transactions,

wherein the default values provide (i) respective values for using the primitives and (ii) respective values for using the JDK classes, and wherein the default values initialize the primitives and the JDK classes defined in the Java source code across multiple methods of the identified classes, when the identified classes are invoked during the batch processing of the plurality of financial transactions;

generating mock classes for the identified classes that are invoked during the batch processing of the plurality of financial transactions;

creating unit tests to perform unit testing of the identified classes that are invoked during the batch processing of the plurality of financial transactions, the unit tests configured to invoke the mock classes and use the default values for unit testing of the identified classes; and

outputting the unit tests in the computer system.

2 . The method of claim 1 , wherein the identified classes invoked in the Java source code include Java framework classes, and wherein generating the mock classes includes generating mock classes for the Java framework classes with use of one or more mocking framework classes.

3 . The method of claim 1 , wherein the identified classes invoked in the Java source code include respective methods and constructors, and wherein the unit tests are configured to invoke the respective methods and constructors.

4 . The method of claim 1 , further comprising:

causing the at least one processor to execute the unit tests and invoke one or more unit testing framework classes; and

providing results in the computer system based on execution of the unit tests.

5 . The method of claim 4 , wherein the identified classes that are invoked are identified based on respective classes included in a Java Archive (JAR) package file;

wherein creating the unit tests includes replicating contents of the package file for the respective classes; and

wherein the execution of the unit tests includes use of the replicated contents of the package file for the respective classes.

6 . The method of claim 5 , wherein providing the results based on the execution of the unit tests includes providing information relating to a usage of the generated mock classes by the execution of the unit tests.

7 . A non-transitory machine-readable storage medium comprising instructions for automated generation of Java unit tests that, when executed by a processor of a computing system, cause the processor to perform operations to:

identify default values used in a code base of Java source code of a financial transaction software application by analyzing usage of primitives and Java Development Kit (JDK) classes in the Java source code, the financial transaction software application programmed to perform batch processing of a plurality of financial transactions;

identify classes in the Java source code that are invoked by the financial transaction software application, the identified classes invoked during the batch processing of the plurality of financial transactions,

wherein the default values provide (i) respective values for using the primitives and (ii) respective values for using the JDK classes, and wherein the default values initialize the primitives and the JDK classes defined in the Java source code across multiple methods of the identified classes when the identified classes are invoked during the batch processing of the plurality of financial transactions;

generate mock classes for the identified classes that are invoked during the batch processing of the plurality of financial transactions;

create unit tests to perform unit testing of the identified classes that are invoked during the batch processing of the plurality of financial transactions, the unit tests configured to invoke the mock classes and use the default values for unit testing of the identified classes; and

output the unit tests.

8 . The non-transitory machine-readable storage medium of claim 7 , wherein the identified classes invoked in the Java source code include Java framework classes, and wherein generating the mock classes includes generating mock classes for the Java framework classes with use of one or more mocking framework classes.

9 . The non-transitory machine-readable storage medium of claim 7 , wherein the identified classes invoked in the Java source code include respective methods and constructors, and wherein the unit tests are configured to invoke the respective methods and constructors.

10 . The non-transitory machine-readable storage medium of claim 7 , wherein the instructions further cause the processor to perform operations that:

cause the processor to execute the unit tests and invoke one or more unit testing framework classes; and

provide results from execution of the unit tests.

11 . The non-transitory machine-readable storage medium of claim 10 , wherein the identified classes that are invoked are identified based on respective classes included in a Java Archive (JAR) package file;

wherein to create the unit tests includes replicating contents of the package file for the respective classes; and

wherein the execution of the unit tests includes use of the replicated contents of the package file for the respective classes.

12 . The non-transitory machine-readable storage medium of claim 11 , wherein to provide the results from the execution of the unit tests includes to provide information relating to a usage of the generated mock classes by the execution of the unit tests.

13 . A computer system configured for automated generation of Java unit tests, the computer system comprising:

at least one processor; and

memory comprising instructions that, when executed by the at least one processor, cause the at least one processor to perform operations to:

identify default values used in a code base of Java source code of a financial transaction software application by analyzing usage of primitives and Java Development Kit (JDK) classes in the Java source code, the financial transaction software application programmed to perform batch processing of a plurality of financial transactions;

identify classes in the Java source code that are invoked by the financial transaction software application, the identified classes invoked during the batch processing of the plurality of financial transactions,

wherein the default values provide (i) respective values for using the primitives and (ii) respective values for using the JDK classes, and wherein the default values initialize the primitives and the JDK classes defined in the Java source code across multiple methods of the identified classes when the identified classes are invoked during the batch processing of the plurality of financial transactions;

generate mock classes for the identified classes that are invoked during the batch processing of the plurality of financial transactions;

create unit tests to perform unit testing of the identified classes that are invoked during the batch processing of the plurality of financial transactions, the unit tests configured to invoke the mock classes and use the default values for unit testing of the identified classes; and

output the unit tests.

14 . The system of claim 13 , wherein the identified classes invoked in the Java source code include Java framework classes, and wherein generating the mock classes includes generating mock classes for the Java framework classes with use of one or more mocking framework classes.

15 . The system of claim 13 , wherein the identified classes invoked in the Java source code include respective methods and constructors, and wherein the unit tests are configured to invoke the respective methods and constructors.

16 . The system of claim 13 , the memory further comprising instructions that, when executed by the at least one processor, cause the at least one processor to perform operations to:

cause the at least one processor to execute the unit tests and invoke one or more unit testing framework classes; and

provide results based on execution of the unit tests.

17 . The system of claim 16 , wherein the identified classes that are invoked are identified based on respective classes included in a Java Archive (JAR) package file;

wherein to create the unit tests includes replicating contents of the package file for the respective classes;

wherein the execution of the unit tests includes use of the replicated contents of the package file for the respective classes; and

wherein to provide the results from the execution of the unit tests includes to provide information relating to a usage of the generated mock classes by the execution of the unit tests.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 7, 2023
From: ROZOVSKI, PETER; GOLDVEKHT, DANIEL
To: WELLS FARGO BANK, N.A.
Reel/Frame 065791/0366 →
Continuity (1)
Related Publication 20250138990A1 · May 1, 2025
References Cited (25)
US 7596778B2 · Kolawa · 2009 [cited by applicant]
US 9983983B2 · Abadi · 2018 [cited by examiner]
US 10176087B1 · Thomas · 2019 [cited by examiner]
US 10303466B1 · Karman · 2019 [cited by examiner]
US 11768759B2 · Tiwari · 2023 [cited by examiner]
US 20080098361A1 · Kumar · 2008 [cited by examiner]
US 20180032425A1 · Abadi · 2018 [cited by examiner]
US 20180300186A1 · Grantham · 2018 [cited by examiner]
US 20190138432A1 · Nagaraj et al. · 2019 [cited by applicant]
US 20220100644A1 · Tiwari · 2022 [cited by examiner]
CN 103106138 · 2016 [cited by applicant]
CN 108710569 · 2018 [cited by applicant]
CN 113157586 · 2021 [cited by applicant]
CN 114860589 · 2022 [cited by applicant]
CN 115190057 · 2022 [cited by applicant]
CN 115981989 · 2023 [cited by applicant]
WO 2018227735 · 2018 [cited by applicant]
WO 2023096152 · 2023 [cited by applicant]
“Diffblue Cover Key Features”, [Online]. Retrieved from the Internet: URL: https: www.diffblue.com cover-key-features, (Accessed on Nov. 10, 2023), 8 pgs. [cited by applicant]
“Java Unit Test Generator for IntelliJ IDEA”, [Online]. Retrieved from the Internet: URL: https: squaretest.com , (Accessed on Nov. 13, 2023), 8 pgs. [cited by applicant]
Codium AI Team, “Best Practices in Automatic Java Unit Test Generation”, [Online]. Retrieved from the Internet: URL: https: www.codium.ai blog automatic-java-unit-test-generation-best-practices , (May 24, 2023), 7 pgs. [cited by applicant]
Conroy, Kevin M, “Automatic Test Generation From GUI-Based Applications For Testing Web Services”, 2007 IEEE International Conference on Software Maintenance, (2007), 10 pgs. [cited by applicant]
Sharma, Asankhaya, “Automated Unit Test Generation for Java”, [Online]. Retrieved from the Internet: URL: https: www.veracode.com blog research automated-unit-test-generation-java, (Jan. 4, 2015), 7 pgs. [cited by applicant]
Waugh, Lisa, “Using TackleTest-Unit to automatically create Java unit tests”, [Online]. Retrieved from the Internet: URL: https: research.ibm.com blog tackletest-unit-auto-java-tests, (Nov. 7, 2022), 8 pgs. [cited by applicant]
Zhang, Benwen, “Assisting Developers in the Creation and Maintenance of Unit Tests”, A dissertation submitted to the Faculty of the University of Delaware in partial fullfilment of the requirements for the degree of Doc… [cited by applicant]