IP Library Granted Patent US 9,870,311
Granted Patent B2
US 9,870,311 · App. 14/841,597 · Granted Jan 16, 2018

Mock object generation

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 9,870,311
App. No.
14/841,597
Granted
Jan 16, 2018
Kind
B2
Abstract

The disclosure is generally directed towards automatically generating a mock object from a description of a real object, such as for use in testing. Mock object generation logic parses the description to determine interface(s) of the real object, which are replicated in the mock object, and to determine method(s) of the real object, which are simulated in the mock object. The mock object generation logic may generate a description of the mock object that is then compiled into the mock object for execution. Data types may be validated so that the arguments and/or return values from the mock object meet the expectations of a calling object.

Claims (29)

1. A method, comprising:

parsing, by a system including a processor, a parsable description language document describing a real object, on which a calling object to be unit tested depends, to generate one or more mock object generation files representative of the real object, wherein the one or more mock object generation files comprise a first description of an interface set of the real object, a second description of a method set of the real object, and a third description of a constructor set, an event set, and a property set of the real object;

compiling, by the system, the one or more mock object generation files to generate a mock object of the real object, wherein the mock object replicates the interface set of the real object and simulates the method set, the constructor set, the event set, and the property set of the real object.

2. The method of claim 1 , wherein the parsable description language document comprises at least one of Interface Description Language or Object Definition Language.

3. The method of claim 1 , further comprising calling the mock object from the calling object during unit testing, and receiving, from the mock object, a return value as a type expected by the calling object.

4. The method of claim 3 , further comprising determining the type for the return value from automatically generated validation data.

5. The method of claim 1 , further comprising calling the mock object from the calling object during unit testing, and simulating the method set comprising accepting an argument as a type provided by the calling object.

6. The method of claim 5 , wherein the simulating comprises determining the type for the argument from automatically generated validation data.

7. The method of claim 1 , further comprising automatically generating an updated mock object in response to the real object being modified.

8. The method of claim 1 , further comprising using the mock object in place of the real object to test one or more real objects.

9. The method of claim 1 , further comprising using the mock object in a mock object set to test one or more calling objects.

10. The method of claim 9 , wherein using the mock object in the mock object set comprises dynamically substituting the mock object for a real object while the one or more calling objects are running.

11. A system, comprising:

a processor; and

a memory communicatively coupled to the processor, the memory having stored therein computer-executable instructions, comprising:

a mock object generation logic component that parses a parsable description language document describing a real object, on which a calling object to be unit tested depends, to generate one or more mock object generation files representative of the real object, wherein the one or more mock object generation files comprise a first description of an interface set of the real object, a second description of a method set of the real object, and a third description of a constructor set, an event set, and a property set of the real object; and

a compiler component that compiles the one or more mock object generation files, into a mock object of the real object; and

the mock object comprises an interface set from the real object, and is configured to simulate the method set, the constructor set, the event set, and the property set from the real object.

12. The system of claim 11 , wherein the mock object generation logic uses automatically generated validation data to determine at least one of an argument type or a return type.

13. The system of claim 12 , wherein returns calls from the calling object that are made to any interface of the interface set and any method of that interface.

14. The system of claim 11 , wherein the parsable description language document comprises at least one of Interface Description Language or Object Definition Language.

15. One or more machine-readable storage media having machine-executable instructions that, perform operations comprising:

parsing an interface description language document describing a real object, on which a calling object to be unit tested depends, to generate one or more mock object generation files representative of the real object, wherein the one or more mock object generation files comprise a first description of an interface set of the real object, a second description of a method set of the real object, and a third description of a constructor set, an event set, and a property set of the real object; and

compiling, by the system, the one or more mock object generation files to generate a mock object of the real object, wherein the mock object replicates the interface set of the real object and simulates the method set, the constructor set, the event set, and the property set of the real object.

16. The one or more machine-readable storage media of claim 15 , wherein the operations further comprise calling the mock object from a calling object, and receiving, from the mock object, a return value as a type expected by the calling object.

17. The one or more machine-readable storage media of claim 16 , wherein the operations further comprise determining the type for the return value from automatically generated validation data.

18. The one or more machine-readable storage media of claim 15 , wherein the operations further comprise calling the mock object from the calling object during unit testing, and simulating the method set comprising accepting an argument as a type provided by the calling object.

19. The one or more machine-readable storage media of claim 18 , wherein the simulating comprises determining the type for the argument from automatically generated validation data.

20. The one or more machine-readable storage media of claim 15 , wherein the operations further comprise automatically generating an updated mock object in response to the real object being modified.

Assignments (2)
SECURITY INTEREST Recorded Oct 1, 2025
From: WARNER BROS. DISCOVERY, INC.; WARNER MEDIA, LLC; TURNER BROADCASTING SYSTEM, INC.; HOME BOX OFFICE, INC.; DISCOVERY COMMUNICATIONS, LLC; WARNERMEDIA DIRECT LLC; DISCOVERY.COM LLC; WARNER BROS. ENTERTAINMENT INC.; CNN INTERACTIVE GROUP, INC.
To: JPMORGAN CHASE BANK, N.A., AS COLLATERAL AGENT
Reel/Frame 072995/0858 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 31, 2015
From: CLARK, BRENDAN JOSEPH
To: HOME BOX OFFICE, INC.
Reel/Frame 036462/0793 →