npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@balena/testbot

v1.9.28

Published

Testbot SDK

Downloads

532

Readme

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