'; Creating Device Compliance Test Suites | Incognito Help
Array
(
    [0] => Array
        (
            [version] => 4.3
            [language] => en
        )

)
Rel: acs/tutorials/acs/dita/creating_device_compliance_test_suites
URI: acs/tutorials/creating_device_compliance_test_suites
=== Tags ===
Array
(
    [1005] => creating device compliance test suites
)

=== Related ===
Array
(
)

Creating Device Compliance Test Suites

This section describes the basic process for creating test suites through the GUI and then running the test suites. Also included are sample scripts.

Create Device Compliance Test Suites

  1. From the ACS Hub, go to Device Compliance Test Suites.

  2. Click the add symbol ().

    A new test suite appears in the list of test suites. The new test suite is named “Compliance Testsuite (#)”, where “#” is the next available whole number starting from 0.

  3. Under Test Suite Details, type a name for the new test suite. Click any whitespace on the page to save the name.

  4. Click Edit to view the Test Suite Setup script.

  5. In the Script Editor, select the default script and press Backspace. Paste in the provided Setup Test Example script, correcting any spacing errors as needed.
  6. In the action bar, click Save and Publish to save and enable the changes to the script.
  7. Click the back symbol () to return to the test suite.
  8. Click Edit to view the Test Suite Teardown script.

  9. In the Script Editor, select the default script and press Backspace. Paste in the provided Teardown Test Example script, correcting any spacing errors as needed.
  10. In the action bar, click Save and Publish to save and enable the changes to the script.
  11. Click the back symbol () to return to the test suite.
  12. Under Test Name, type a new test name. Click any whitespace on the page to save the name.
  13. Click Edit to view the test.

  14. In the Script Editor, select the default script and press Backspace. Paste in the provided WiFi 2.4 GHz Test Example script, correcting any spacing errors as needed.

Run a Device Compliance Test Suite

  1. From the ACS Hub, go to Devices.

  2. Select a device, and in the action bar, click View.
    The Device Hub appears.
  3. Click Run Compliance Test Suite.

    The Device Compliance Test Suites screen appears.

  4. Under Test Suites, select a test.
    The test details appear in the right panel.
  5. Click Run Test.

The test suite executes against the selected device. The test results appear under the test details.

Setup Test Example

Use a setup test to verify that connection requests are being accepted by the device. The following example script is included out-of-the-box.

/*
This is a template response for setup 
Script parameters:
 Testsuite ID: scriptParameters.testSuiteId
 Device ID: scriptParameters.deviceId

Log Functions:
 cts.logInfo("Log info message");
 cts.logWarn("Log warning message");
 cts.logError("Log error message");

Successful Result:
 var cts = require("compliancetestsuite");
 var acs = require("acs");
 cts.setTestSuccess();

Error Result:
 cts.setTestError();
     OR;
 Script can throw an exception. Example:
   throw "Error executing setup script";
*/

var cts = require("compliancetestsuite");
var acs = require("acs");
var cr = acs.verifyConnectionRequest();
if(cr.errorCode.hasError) {
  var value = acs.getParameterValue("Device.ManagementServer.PeriodicInformInterval");
  if(value !== null && typeof(value) !== 'undefined') {
    cts.logInfo("Periodic inform interval is " + value);
  }
  if(value !== null && typeof(value) !== 'undefined' && value <= 60){
    cts.logWarn("Connection request failed. Trying to set username/pass");
    acs.setParameter({ 
       parameters: [
       {
        cpeParameterName: "Device.ManagementServer.ConnectionRequestUsername",
        value: "admin"
       },
       {
        cpeParameterName: "Device.ManagementServer.ConnectionRequestPassword",
        value: "admin"
       }] 
      },
      false
    ).onComplete( 
     function ( errorCode, completeMsg ) {
      if(!errorCode.hasError) {
        cts.logInfo("Connection request username/password was set to admin/admin");
        cts.setTestSuccess();
      }
      else {
        cts.logError("Failed to set connection request username/pass");
        cts.setTestError();
      } 
      return cts.returnTestResult();
    },75);
  }
  else {
    cts.logError("Connection request failed with error: " + cr.errorCode.problemMessage + ". Ensure the connection request is working so the compliance testsuite can be executed");
	cts.setTestError();
  }
}
else {
  cts.logInfo("Connection request was successfully verified");
  cts.setTestSuccess();
}
cts.returnTestResult();

WiFi 2.4 GHz Test Example

var cts = require("compliancetestsuite");
var acs = require("acs");

var parameterNames = [
  "Device.WiFi.Radio."
];
acs.getParameterValues(parameterNames).onComplete( 
  function ( errorCode, completeMsg ) {
    if(!errorCode.hasError) {
      processSuccess(completeMsg);
     }
    else {
      processError(errorCode);
    } 
    return cts.returnTestResult();
},110);

function processSuccess(completeMsg) {
  var operation = acs.getOperation(completeMsg.operationId);

  if (operation.deviceParameterValues === null || typeof(operation.deviceParameterValues) === 'undefined') {
    cts.logError("Get object parameter values (Device.WiFi.Radio.) didn't retrieve any parameter value");
    cts.setTestFail();
    return;
  }
  var count = operation.deviceParameterValues.length;
  if (count === 0) {
    cts.logError("Get object parameter values (Device.WiFi.Radio.) didn't retrieve any parameter value");
    cts.setTestFail();
  }

  var passed = false;
  var param_count = 0;
  operation.deviceParameterValues.forEach(function(value){

    if (value.name.search("Channel") + 7 == value.name.length) {
      if (value.value < 15){
        param_count++;
        //cts.logInfo(value.name + " = " + value.value );
        passed = true;
      }
    }  

  });
  if (passed) {
    cts.logInfo("Found " + param_count + " SSIDs for 2.4Ghz");
    cts.setTestPass();
  }
  else {
    cts.logError("2.4 Ghz radio not found");
    cts.setTestFail();
  }
}

function processError(errorCode) {
  cts.logError("Get object parameter values failed: " + errorCode.problemMessage);
  cts.setTestFail();
}

cts.returnTestResult();

Teardown Test Example

Use a teardown test to log the rest results and clear any failed operations from the operations table. The following example script is included out-of-the-box.

/*
This is a template response for teardown 

Script parameters:
 Testsuite ID: scriptParameters.testSuiteId
 Device ID: scriptParameters.deviceId

Log Functions:
 cts.logInfo("Log info message");
 cts.logWarn("Log warning message");
 cts.logError("Log error message");

Successful Result:
 var cts = require("compliancetestsuite");
 var acs = require("acs");
 cts.setTestSuccess();

Error Result:
 cts.setTestError();
     OR;
 Script can throw an exception. Example:
   throw "Error executing setup script";
*/

var cts = require("compliancetestsuite");
var ops = acs.getActiveOperations();
ops.forEach(function(op){
  if (op.deviceOperationState == "COMPLETED_WITH_ERROR") {
    acs.cancelDeviceOperation(op.id);
  }
});

cts.logInfo("Teardown executed successfully");
cts.setTestSuccess();
cts.returnTestResult();
Version
Top