Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 1.31 KB

File metadata and controls

57 lines (42 loc) · 1.31 KB

BATS tests

The tests in this folder are not regular Pytest tests. They are implemented with BATS to test awslocal from bash.

Prerequisites

Install BATS: If you don't have BATS installed, you need to install it first. On a Unix-like system, you can usually install it using a package manager.

For any system with npm:

npm install -g bats

For macOS using Homebrew:

brew install bats-core

Alternatively, you can install BATS manually by cloning the repository and adding the bin folder to your PATH environment variable.

git clone https://github.com/bats-core/bats-core.git
cd bats-core
sudo ./install.sh /usr/local

Writing tests

Create a file with a .bats extension, for example, test_example.bats. Here’s a simple test file:

#!/usr/bin/env bats
@test "test description" {
  run echo "hello"
  [ "$status" -eq 0 ]
  [ "$output" = "hello" ]
}

Running Tests

To run the tests, execute the bats command followed by the test file or directory containing test files:

bats test_example.bats

You can also run all .bats files in a directory:

bats tests/bin

To run with some debug information, you can use this:

bats --trace --verbose-run --print-output-on-failure -r tests/bin/