getEntityInformation

Syntax

string GetEntityInformation(string itemID)

Description

Return metadata information of a project item specified by an item ID.

Parameters

Return Value

A string value containing JSON data. The returned string includes all possible values of the specified project item, such as name, location, status, recent result, url, assigned user, and priority. (See Notes below.)

Notes

Example

Let’s say you want your user-scripted action to retrieve the Location field of the current test module. The test module’s ID may first be obtained from getCurrentEntityID(). Subsequently, you would pass the ID to the GetEntityInformation() method, which returns a JSON-structured string. Parse this string and use TestArchitect’s Assign() method with a key value of “location” to obtain Location value.

The code for this example for each of the Python, and C# harnesses is presented below. Note that, for the Python script, the location value is assigned to a variable named _location; in the case of the C# scripts, that variable has the name entLocation.

For Python harness: Your snippet of code might resemble the following:

#Get ID of the test module
tmID = LIBRARY.getCurrentEntityID("testmodule")

#Get metadata information
tmInformation = LIBRARY.GetEntityInformation(tmID)

#Parse the JSON object
tmInformation = json.loads(tmInformation)

#Get values of Location field
LIBRARY.Assign(_location, tmInformation["location"])

For C# harness: Your snippet of code might resemble the following:

//Get ID of the test module
string tmID = Interpreter.AbtLibrary.getCurrentEntityID("testmodule");

//Get metadata information
string entityInfo = Interpreter.AbtLibrary.GetEntityInformation(tmID);

//Parse the JSON object
Dictionary<string, object> entObject = fastJSON.JSON.Parse(entityInfo) as Dictionary<string, object>;
            
foreach (var entField in entObject)
{
   string value = entField.Value != null ? (string) entField.Value:"";
                
   if (entField.Key.Equals("location"))
      Interpreter.AbtLibrary.Assign(entLocation, value);
}

Copyright © 2023 LogiGear Corporation. All rights reserved. LogiGear is a registered trademark, and Action Based Testing and TestArchitect are trademarks of LogiGear Corporation. All other trademarks contained herein are the property of their respective owners.

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1(800) 322-0333