Version: 1.0
Status: ⚫⚪⚪
TestUtility plugin for Thunder framework.
This document describes purpose and functionality of the TestUtility plugin. It includes detailed specification of its configuration, methods and properties provided.
All identifiers on the interface described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.
The table below provides and overview of acronyms used in this document and their definitions.
Acronym | Description |
---|---|
API | Application Programming Interface |
HTTP | Hypertext Transfer Protocol |
JSON | JavaScript Object Notation; a data interchange format |
JSON-RPC | A remote procedure call protocol encoded in JSON |
The table below provides and overview of terms and abbreviations used in this document and their definitions.
Term | Description |
---|---|
callsign | The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique. |
Ref ID | Description |
---|---|
HTTP | HTTP specification |
JSON-RPC | JSON-RPC 2.0 specification |
JSON | JSON specification |
Thunder | Thunder API Reference |
The TestUtility plugin enables to execute embedded test commands on the platform.
The plugin is designed to be loaded and executed within the Thunder framework. For more information about the framework refer to [Thunder].
The table below lists configuration options of the plugin.
Name | Type | Description |
---|---|---|
callsign | string | Plugin instance name (default: TestUtility) |
classname | string | Class name: TestUtility |
locator | string | Library name: libWPEFrameworkTestUtility.so |
autostart | boolean | Determines if the plugin is to be started automatically along with the framework |
The following methods are provided by the TestUtility plugin:
TestUtility interface methods:
Method | Description |
---|---|
runmemory | Runs a memory test command |
runcrash | Runs a crash test command |
Runs a memory test command.
Name | Type | Description |
---|---|---|
params | object | |
params.command | string | Test command name |
params?.size | number | (optional) The amount of memory in KB for allocation (applicable for Malloc commands) |
Name | Type | Description |
---|---|---|
result | object | |
result.allocated | number | Already allocated memory in KB |
result.size | number | Current allocation in KB |
result.resident | number | Resident memory in KB |
Code | Message | Description |
---|---|---|
2 | ERROR_UNAVAILABLE |
Unknown category |
30 | ERROR_BAD_REQUEST |
Bad JSON param data format |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "TestUtility.1.runmemory",
"params": {
"command": "Malloc",
"size": 0
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": {
"allocated": 0,
"size": 0,
"resident": 0
}
}
Runs a crash test command.
Name | Type | Description |
---|---|---|
params | object | |
params.command | string | Test command name |
params?.delay | number | (optional) Delay (in seconds) before the crash attempt (applicable for Crash command) |
params?.count | number | (optional) How many times a Crash command will be executed consecutively (applicable for CrashNTimes command) |
Name | Type | Description |
---|---|---|
result | null | Always null |
Code | Message | Description |
---|---|---|
2 | ERROR_UNAVAILABLE |
Unknown category |
30 | ERROR_BAD_REQUEST |
Bad JSON param data format |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "TestUtility.1.runcrash",
"params": {
"command": "Crash",
"delay": 1,
"count": 1
}
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": null
}
The following properties are provided by the TestUtility plugin:
TestUtility interface properties:
Property | Description |
---|---|
commands RO | List of test commands |
description RO | Description of a test command |
parameters RO | Parameters of a test command |
shutdowntimeout WO | Timeout to be waited before deactivating the plugin |
Provides access to the list of test commands.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | array | List of test commands |
(property)[#] | string | Available test commands |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "TestUtility.1.commands"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": [
"Malloc"
]
}
Provides access to the description of a test command.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | object | Description of a test command |
(property).description | string | Test command description |
The command shall be passed as the index to the property, e.g. TestUtility.1.description@Malloc.
Code | Message | Description |
---|---|---|
2 | ERROR_UNAVAILABLE |
Unknown category |
30 | ERROR_BAD_REQUEST |
Bad JSON param data format |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "TestUtility.1.description@Malloc"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": {
"description": "Allocates desired amount of memory (in KB) and holds it"
}
}
Provides access to the parameters of a test command.
This property is read-only.
Name | Type | Description |
---|---|---|
(property) | object | Parameters of a test command |
(property)?.input | array | (optional) |
(property)?.input[#] | object | (optional) |
(property)?.input[#].name | string | Test command input parameter |
(property)?.input[#].type | string | Test command input parameter type (must be one of the following: Number, String, Boolean, Object, Symbol) |
(property)?.input[#].comment | string | Test command input parameter description |
(property).output | object | |
(property).output.name | string | Test command output parameter |
(property).output.type | string | Test command output parameter type (must be one of the following: Number, String, Boolean, Object, Symbol) |
(property).output.comment | string | Test command output parameter description |
The command shall be passed as the index to the property, e.g. TestUtility.1.parameters@Malloc.
Code | Message | Description |
---|---|---|
2 | ERROR_UNAVAILABLE |
Unknown category |
30 | ERROR_BAD_REQUEST |
Bad JSON param data format |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "TestUtility.1.parameters@Malloc"
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": {
"input": [
{
"name": "memory",
"type": "Number",
"comment": "Memory statistics in KB"
}
],
"output": {
"name": "memory",
"type": "Number",
"comment": "Memory statistics in KB"
}
}
}
Provides access to the timeout to be waited before deactivating the plugin.
This property is write-only.
Name | Type | Description |
---|---|---|
(property) | number | Timeout in milli seconds |
{
"jsonrpc": "2.0",
"id": 1234567890,
"method": "TestUtility.1.shutdowntimeout",
"params": 5000
}
{
"jsonrpc": "2.0",
"id": 1234567890,
"result": "null"
}