Skip to content

Instantly share code, notes, and snippets.

@artpar
Created October 1, 2022 07:07
Show Gist options
  • Select an option

  • Save artpar/e6c0f9301568a337575b61423809a61f to your computer and use it in GitHub Desktop.

Select an option

Save artpar/e6c0f9301568a337575b61423809a61f to your computer and use it in GitHub Desktop.
Videobug

Test case generation

Process

Two step process

  1. Process log files to produce DB records (each file to be processed only once)
  2. Use DB to generate test cases

Step 1 can start as soon as data starts flowing in. Step 2 need user input starting with which class to generate test case for.

Data available in the database

  • SQL database (sqlite ATM)
  • Querying for available test candidates based on class type is single query lookup.
  • DB also has information of all the calls ever made thru the execution (and not just the ones we would actually need)
  • Time taken for each call is available

TestCandidate

Individual unique objects of a particular type, is made up of the following

  • Parameter testSubject: Specific object instance (ID's are long numbers so showing them would not make much sense)
  • MethodCallExpression mainMethod: The Call which we are going to test
  • List fields: of the test candidate:
    • eg private Gson gson, need(should) not be mocked
    • eg AyuCityHelper ayuCityHelper, probably should be mocked
  • List callsToMock: (we have a list of all calls within the span of the mainMethod):
    • static calls [Classname.methodCall()]
    • normal calls [objectName.methodCall()]

MethodCallExpression

A method call on a particular object, is made of the following

  • Parameter subject: objectId on which call was invoked (null if static call)
  • List arguments: method arguments (are not going to be primitive types in most cases)
  • Parameter returnValue: return value, can be an exception type
  • Int callStack: the depth at which this call was made (sometime we might need to mock a deep call
  • Long => call time nano seconds (time taken to execute to call based on the recording)

Parameter

This represents a specific instance of any class type

  • value: or id/long number uniquely identifies a value in jvm (can have multiple names in different context)
  • type: class name (while these can be multiple for an object, we will record the most relevant, which means the one at the bottom of the class hierarchy)
  • exceptional: if this object was used in throw .
  • serializedValue: value as json if recorded (only for certain events we record serialized values)
  • probeInfo: the associated probe from which we collected this information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment