Skip to main content

tvlabs test

Running a test with a real device

Use tvlabs test to run a script on a TV Labs device.

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)