Skip to main content

Getting Started with Tarantula Core

Intro

This part of the documentation talks about the abilities of the core part of tarantula (for the moment, specifically the version on the experimental branch).

Installation

Tarantula Core can be installed through npm. At the current state, it is only possible to install it from the tarball that appears in dist after compiling tarantula in the monorepo.

Importing from Tarantula

Importing from Tarantula's core is as simple as

import { initTara, Test, run } from "@demirtag/tarantula"

This example imports the initTara function which initializes tarantula, the @Test class decorator and the run function for running tests.

Writing a basic test utilizing the API abstractions

@Test('Example Test') //Use the smart @Test decorator
export class Example {
//Declare APIs to be injected through the constructor
constructor(private desktop: DesktopTarantulaAPI, private mobile: MobileTarantulaAPI) {
//Perform API calls
console.log(this.mobile.shake(500));
console.log(this.desktop.minimize());
}
}

The API type definitions can be imported from @demirtag/tarantula.

Running a test

After defining a class with the @Test decorator, one can use the run function to run the test by passing the class as an argument.

async function main() {
await initTara(); //Initialize Tarantula Core

run(Example); //Run the test defined by the Example class
}

main();

Next Steps

  • Learn how to call functions from your framework of choice
  • Run subtests