Our Squish tip of the week this week answers a common question I hear from users is: Is it possible to capture data from my application, store it, and use it later in my test?

Checkout the blog entry 'How to capture data for reuse later in test | froglogic blog'

Using Squish’s object access functions, users can retrieve information about an object, it’s properties, values, etc.
Take an Inventory application for example. After entering a new item in inventory, a corresponding SKU is generated. Later in your test you may wish to confirm the generated SKU matches the SKU listed when searching for the inventory item by name.

function main(){
var newInventoryItem = new Array("Part ABC", "Manufacturer XYZ", "Available");
var newSKU = generateNewInventoryEntry(newInventoryItem);
var retrievedSKU = getSKUByInventoryName("Part ABC");
test.compare(newSKU, retrievedSKU, "Validating generated SKU matches SKU search result by item name");

function generateNewInventoryEntry(inventoryItem){
var inventoryFields = ["Part", "Manufacturer", "Status"];
for (var i = 0; i < inventoryItem.length; ++i)
type(waitForObject(":Invnt." + inventoryFields[i] + ":_.JTextField"), inventoryItem[i]);
var generatedSKU = object.properties(waitForObject(":itemSKU_TableIte m"));
return generatedSKU["text"];

function getSKUByInventoryName(itemName){
type(waitForObject(":SearchInventName:_JTextField" ), itemName);
var properties = object.properties(waitForObject(":itemSKU_TableIte m"));
return properties["text"];

Read more about Object Access Functions here