1.9.28 • Published 6 months ago

@balena/testbot v1.9.28

Weekly downloads
1,015
License
Apache-2.0
Repository
-
Last release
6 months ago

testbotSDK

The SDK is for internal use only.

The testbot is a device used to aid in the automation of hardware testing. It provides a mechanism to remotely provision, power, and run test suites against a device under test (DUT).

Introduction

This document aims to describe all operations, & examples supported by the Testbot SDK. Get started by installing the NPM package and following the Getting Started guide below. You can use the testbot SDK to flash, control, turn your DUT on and off and even record serial output when testing remotely.

If you feel something is missing, not clear or could be improved, please open an issue on GitHub.

Installation

Install the testbotSDK NPM package.

npm install @balena/testbot --save

Getting Started

After assembling your testbot, the testbot SDK can be used to perform operations on the DUT.

Prerequisites: Import and Instantiating

Import the required classes, and instantiate objects to refer to them later. To perform operations on the DUT, testbot needs to learn how to interact with your specifc test device.

For that you need to create a DeviceInteractor class. Follow the example in the documentation to create your own interactor class for your DUT.

import { TestBotHat } from '@balena/testbot';
import { SomeNewDevice } from './devices';

const testbotHat = new TestBotHat()
const deviceInteractor = SomeNewDevice(testbotHat);

Support for RaspberryPi, balenaFin and Intel-NUC classes are provided as reference. For the getting started guide an example device called SomeNewDevice, which has a class named SomeNewDevice, is used.

Flashing the DUT

To flash the DUT, use the method flashFromeFile() method included in the base DeviceInteractor class.

import { TestBotHat } from '@balena/testbot';
import { SomeNewDevice } from './devices';

const testbotHat = new TestBotHat()
const deviceInteractor = SomeNewDevice(testbotHat);

deviceInteractor.flashFromFile("./images/balenaOS.img.gz");

Powering ON/OFF the DUT

To power cycle the DUT, use the powerOn() and powerOff() methods in the SomeNewDevice interactor class.

import { TestBotHat } from '@balena/testbot';
import { SomeNewDevice } from './devices';

const testbotHat = new TestBotHat()
const deviceInteractor = SomeNewDevice(testbotHat);

await deviceInteractor.powerOn();
await deviceInteractor.powerOff();

Collecting Serial Output from DUT

import { TestBotHat } from '@balena/testbot';
const testbotHat = new TestBotHat()

const serialOutput = await testbotHat.openDutSerial();
const collectedLogs: any[] = [];
serialOutput?.on('data', (d) => collectedLogs.push(d));

await deviceInteractor.powerOn();
// Wait several seconds and check the logs. The Bluebird library is used to wait.
import * as Bluebird from 'bluebird';
await Bluebird.delay(10000);
console.log(collectedLogs)

For a comprehensive reference, there is a provided example of how the testbot SDK is used to verify the testbot hardware as part of our e2e tests, shown in the testbot-e2e-test application.

Generating documentation for testbotSDK

TestbotSDK documentation is written on the tsdoc doc comment standard and generated using Typedoc. The documentation for the SDK can be generated using the command below. The generated documentation can be viewed on docs/index.html

npm run docs
1.9.28

6 months ago

1.9.27

1 year ago

1.9.26

2 years ago

1.9.25

2 years ago

1.9.24

2 years ago

1.9.23

2 years ago

1.9.22

2 years ago

1.9.21

2 years ago

1.9.20

2 years ago

1.9.19

2 years ago

1.9.18

2 years ago

1.9.17

2 years ago

1.9.16

3 years ago

1.9.15

3 years ago

1.9.14

3 years ago

1.9.13

3 years ago

1.9.12

3 years ago

1.9.11

3 years ago

1.9.10

3 years ago

1.9.9

3 years ago

1.9.8

3 years ago

1.9.7

3 years ago

1.9.6

3 years ago

1.9.5

3 years ago

1.9.4

3 years ago

1.9.3

3 years ago

1.9.2

3 years ago

1.9.1

3 years ago

1.9.0

4 years ago

1.8.0

4 years ago

1.7.12

4 years ago

1.7.11

4 years ago

1.7.10

4 years ago

1.7.9

4 years ago

1.7.7

4 years ago

1.7.6

4 years ago

1.7.5

4 years ago

1.7.4

4 years ago

1.2.0

5 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.2.1

4 years ago

1.1.0

5 years ago

1.5.4

4 years ago

1.5.3

4 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.0.9

5 years ago

1.4.0

4 years ago

1.7.3

4 years ago

1.7.2

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.3.0

4 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago