Skip to main content

tvlabs test

Running a test with a real device

Use tvlabs test to run standalone Lua scripts on TV Labs devices. For project-based automations with visual workflows, see tvlabs run.

Choosing the right command
  • Use tvlabs test for rapid script development, debugging, and standalone automation scripts
  • Use tvlabs run for production automation workflows, team collaboration, and project-based testing

tvlabs test provides direct access to the TV Labs device pool using Lua scripts:

tvlabs test --platform web_os scripts/test.lua

cli-test

Figure 1: Example of running a test. Tests will display pass or failure state as they finish executing. Each test runs sequentially against a single target device.

Scripting API

tvlabs test provides a powerful, vision-based API using the Lua programming language, with plans for a JavaScript API in near future.

For a detailed reference of the TV Labs scripting interface, please refer to our Scripting Getting Started Guide.

Example Script

To try out a script quickly, save the following Lua code to a file, and then provide the file path as an argument to tvlabs test

describe("home page", function()
it("has text", function()
control.home()

found, _ = detect.text(screen.capture(), "home")

assert(found)
end)

it("can navigate", function()
wait(1000)
control.right()
assert(true)
end)

it("can fail", function()
wait(2000)
assert(false)
end)
end)