QData
A QData contains values on basis of key and value pairs, Each pair of key and value is called as an entry.
Last updated
A QData contains values on basis of key and value pairs, Each pair of key and value is called as an entry.
Last updated
Rules :
Key name should be UNIQUE, If the same key name was inserted multiple times. It would be overridden.
Example : QData employeeInfo = extractGroup("firstEmployee");
Sample :
{
"firstName" : "John",
"middleName" : "deSouza",
"lastName" : "D",
"SSN" : "789",
"dob" : "08/08/2000",
"Eligibility" : true
}
Ways to get data from QData :
How to get the value as String ?
String empFirstName = employeeInfo.getValueAsString("firstName");
How to get the value as Integer?
Integer empSSN = employeeInfo.getValueAsInteger("SSN");
How to get the value as Boolean?
Boolean empEligibility = employeeInfo.getValueAsBoolean("Eligibility");
List of QData Commands :
Method Name | Arguments | Return Type | Description |
---|---|---|---|
getValue
Key Name
Object
When the user wants the value to be returned in OBJECT (Data Type) and convert to the required Data type like Qarray,QStringArray etc. This can be used
isEmpty
NO ARGS
Boolean
This checks whether the initialized Qdata is empty / not
size
NO ARGS
Integer
This returns the count of the keys in initialized Qdata
getKey
NO ARGS
toMap
NO ARGS
Map<String,Object>
This converts the Qdata object to JAVA Map class
containsValue
Value
Boolean
This checks the whole Qdata for the given value, return true if the value matches to any of the key
setValue
key and value
VOID
This inserts the given key and value to the Qdata
getValueAsString
Key Name
String
This provides the values in the String
getValueAsQData
Key Name
Qdata
This returns the sub object data in Qdata format, by the key name provided
getValueAsQStringArray
Key Name
QStringArray
Returns Key Value as QStringArray
if the key value is a String, or multiple values separated with comma it will be converted to QStringArray.
getValueAsQIntegerArray
Key Name
QIntegerArray
Returns Key Value as QIntegerArray
if the key value is a String, or multiple values separated with comma it will be converted to QIntegerArray.
toJsonArray
key and value
String
This converts the Qdata into complete JSON object and the results would be as below sample. givenKeyName : givenValueName : [all the Qdata converted to JSON]
getKeyNames
NO ARGS
QStringArray
This lists out all the key names.
doAssert
bindToContext
tfStepContext
Context Values will be set
This save each and every pair to context and the user can utilize them
bindToTestRun
tfStepContext
Run Values will be set
This save each and every pair to RUN VALUES and the user can utilize them
toJson
NO ARGS
String
This converts the compelete Qdata into JSON, this will be utilized in API
dump
NO ARGS
String
This converts the complete Qdata into string Note : This can be utilized to print the whole Qdata for validating in development activities
hasDataFor
getValueAsDouble
Key Name
Double
This provides the values in the Double
_getValue
getValueAsBoolean
Key Name
Boolean
This provides the values in the Boolean
getValueAsInteger
Key Name
Integer
This provides the values in the Integer
invokeDataModifiers