Skip to content

Latest commit

 

History

History
69 lines (48 loc) · 2.11 KB

File metadata and controls

69 lines (48 loc) · 2.11 KB

Sync Task Version Task E2E Test

Task E2E Test Suite

Repo Layout

task-e2e
└── .github/workflows
    └── sync-versions.yml   <-- Runs periodically to check for new Task releases.
    └── test-e2e.yml        <-- E2E Test workflow.
└── tests
    └── <dir>               <-- Collection of tests.
        └── <file>.txtar    <-- Testcase file (Testscript/txtar).
└── e2e_test.go             <-- E2E Test configuration and extensions.
└── Makefile                <-- Automation interface.

Usage

Running Tests

# Install Task (install to a directory in your PATH).
$ sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin

# Clone E2E Tests.
$ git clone https://github.com/trulede/task-e2e.git

# Run E2E Tests.
$ cd task-e2e
$ make test

Writing Tests

Test are written in Testscript and saved in txtar files. Place new tests in a subdirectory of the tests directory, using the sub-directory structure to organize tests. The E2E Test will automatically discover and run the new tests.

# Test: task version
task --version
cp stdout task.version
cmpenv task.version expect

-- expect --
${VERSION}

Testscript Extensions

  • task args... - Run Task!
  • sleep duration - Sleep for the specified duration (e.g. 1s).
  • touch file - Touch the specified file, updating file access time. Create if the file does not exist.
  • [!] filecontains file1 file2|text - Test that file1 contains file2 or the provided text.

References