Skip to content

Automated Test Pipeline

Fresh

Build a CI/CD-style automated test pipeline using Total Control's test execution framework.

Pipeline Architecture

Step 1: Write Test Scripts

Use FindNode for object-based assertions:

javascript
// login_test.js
var { getDevice } = require('sigma/device');
var device = getDevice();

// Open app
device.sendAai({ action: "openApp(com.example.app)" });

// Enter credentials
device.sendAai({ query: "HT:Username", action: "setText(testuser)" });
device.sendAai({ query: "HT:Password", action: "setText(pass123)" });

// Click login
device.sendAai({ query: "T:Sign In", action: "click" });

// Assert: dashboard loaded
var result = device.sendAai({ query: "T:Dashboard", action: "getText" });
if (result == null || result.retval !== "Dashboard") {
  throw "Login test FAILED: Dashboard not found";
}
print("Login test PASSED");

Step 2: Create Test Suites

xml
<TestSuite>
    <Name>Login Tests</Name>
    <AppName>com.example.app</AppName>
    <Description>Authentication flow tests</Description>
    <TestScripts>
        <TestScript prefix="LT">
            <Path>tests/login_test.js</Path>
        </TestScript>
        <TestScript prefix="RT">
            <Path>tests/registration_test.js</Path>
        </TestScript>
    </TestScripts>
</TestSuite>

Step 3: Build Test Harness

xml
<TestHarness>
    <Name>Full Regression</Name>
    <TestSuiteFiles>
        <TestSuiteFile path="suites/login.suite" />
        <TestSuiteFile path="suites/navigation.suite" />
        <TestSuiteFile path="suites/data_entry.suite" />
    </TestSuiteFiles>
</TestHarness>

Step 4: Configure Execution

xml
<TestExecutionConfiguration>
    <Target>
        <Type>Harness</Type>
        <FilePath>harness/full_regression.harness</FilePath>
    </Target>
    <Devices>
        <Device groupName="regression-devices"/>
    </Devices>
    <Iterations>3</Iterations>
    <LogConfiguration>
        <ReportLogPath>logs/report.log</ReportLogPath>
        <ExecutionLogPath>logs/execution.log</ExecutionLogPath>
    </LogConfiguration>
</TestExecutionConfiguration>

Step 5: Run and Monitor

Command Line Execution

javascript
addToClasspath('%appdata%/Sigma-RT/Total Control/modules/test');
runTest("config/full_regression.tec");

REST API Trigger

Use the REST API's scriptRun endpoint to trigger tests from CI/CD tools:

bash
# From Jenkins/GitHub Actions
curl -X POST http://localhost:PORT/api/scriptRun \
  -d '{"script": "runTest(\"config/regression.tec\")"}'

Step 6: Process Results

After execution, parse the JSON results file and log file with your report generator.

Custom Reports

The built-in report generator is basic. Build custom generators in any language to produce HTML reports, Slack notifications, or dashboard updates.

Unofficial documentation. Source: sigma-rt.com