Skip to content

Development

GuentherJulian edited this page Nov 5, 2020 · 12 revisions

Development

In this section we will describe how you can implement your own tutorials.

How to create a playbook

How to create your own command

How to create an assertion

Assertions are implemented in the 'assertions' folder of the tutorial-compiler directory. To implement a new assertion create a new typescript file with the name of your assertion in this directory.

Inside the new typescript file create a new class. The class has to to implement a static 'run' method as shown below. In this method you can check whatever you want.

export class YourAssertionCode {
    public static run(): void {
        ...your code goes here...
        if(somethingIsWrong){
            throw new Error("Your error message");
        }
    }
}

After this you have to add the newly created assertion to the Assertion class of the index.ts file. This file is located in the same directory.

public yourAssertionCode(): Assertions {
        YourAssertion.run();
        return this;
    }

If you want to pass arguments to this method, you have to do this in the header of the 'run' method and in the call of the method.

Clone this wiki locally