jeudi 17 septembre 2020

Test creation of specific directory and its contents via bats

I am invoking an interactive cli tool I have created (using go but that's not in the question's scope).

I am performing integration tests on it using a combination of BATS and expect.

Here is the specific test suite:

@test "Running interactive test - providing clone directory parameter" {
    cd test_expect
    eval "./basic_interactive.exp"
}

The success of this step is the creation of a specific directory with pre-defined contents.

Since I am new to BATS I cannot find a way to somehow assert that the command

ls -1 /path/to/directory/that/is/supposed/to/be/created

will equal

file1
file2
file3

etc.

Any suggestions?

I have tried this

@test "Running interactive test - providing clone directory parameter" {
    cd test_expect
    eval "./basic_interactive.exp"
    eval "ls -1 path/to/directory/that/is/supposed/to/be/created"
    echo $output
}

but it does not print anything.

Aucun commentaire:

Enregistrer un commentaire