Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martin-olivier/vangelis
A functional testing framework
https://github.com/martin-olivier/vangelis
test test-automation test-framework test-runner testing-framework testing-tools
Last synced: 6 days ago
JSON representation
A functional testing framework
- Host: GitHub
- URL: https://github.com/martin-olivier/vangelis
- Owner: martin-olivier
- License: mit
- Created: 2021-02-19T01:58:13.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-09T04:06:57.000Z (3 months ago)
- Last Synced: 2024-12-12T23:51:35.734Z (13 days ago)
- Topics: test, test-automation, test-framework, test-runner, testing-framework, testing-tools
- Language: Rust
- Homepage: https://crates.io/crates/vangelis
- Size: 6.06 MB
- Stars: 35
- Watchers: 2
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vangelis
[![crates](https://img.shields.io/crates/v/vangelis.svg)](https://crates.io/crates/vangelis)
[![ci](https://github.com/martin-olivier/vangelis/actions/workflows/CI.yml/badge.svg)](https://github.com/martin-olivier/vangelis/actions/workflows/CI.yml)![example](.github/assets/example.gif)
This software takes test files as parameter that contains lists of commands to be run, expected stdout, stderr, exit status, and tell the user if the tests succeed, failed or crashed.
`⭐ Don't forget to put a star if you like the project!`
## 💻 Installation
You can find pre-built [releases](https://github.com/martin-olivier/vangelis/releases/latest) for `linux`, `macOS` and `Windows`
Otherwise, you can install `vangelis` from source using [cargo](https://www.rust-lang.org/tools/install), with the following command:
```sh
cargo install vangelis
```## 📒 Usage
```
A functional testing frameworkUsage: vangelis [OPTIONS] ...
Arguments:
... Path to one or multiple test file(s) to be executedOptions:
--diff Display the got/expected difference for each failed test in the shell
--ci Stop the execution and display the got/expected difference if a test didn't succeed
-h, --help Print help
-V, --version Print version
```## 🗂 Test File
Test files must have the following pattern in [toml](https://toml.io/en/)
```rs
// DefinitionsDefault {
exit_status: Option,
timeout: Option,
working_dir: Option,
runs_on: Option>,
unix_shell: Option,
windows_shell: Option,
}Test {
cmd: String,
stdin: Option,
stdout: Option,
stderr: Option,
exit_status: Option,
timeout: Option,
working_dir: Option,
runs_on: Option>,
unix_shell: Option,
windows_shell: Option,
}// Test file content
TestFile {
default: Option,
test: Map,
}
```## 📝 Example
```toml
# testfile.toml[default]
# use powershell as default shell on windows
windows_shell = "powershell"[test.echo]
cmd = "echo hello"
stdout = "hello\n"[test.power]
# this test can only run under unix systems
runs_on = ["linux", "macos"]
cmd = "whoami"
stdout = "root\n"[test.sleep]
# this test will timeout
timeout = 5
cmd = "sleep 10"
stdout = ""
stderr = ""[test."print args"]
cmd = "python3 print_args.py hey brother"
stdout = """
hey
brother
"""
stderr = ""[test."print stdin"]
cmd = "python3 print_stdin.py"
stdin = """
hey
brother
"""
stdout = """
heybrother
"""
stderr = ""
```To run this example, enter the following command:
```sh
vangelis examples/testfile.toml
```## ⚙️ Parameters
```toml
[cmd]# Command to run (mandatory value)
# Example:
# Build a software and ensure the build takes less that 300 seconds:
cmd = "make"
timeout = 300
``````toml
[stdout]# Expected stdout of the command
# Example:
# I want to check if I have root privileges:
cmd = "whoami"
stdout = "root\n"
``````toml
[stderr]# Expected stderr of the command
# Example:
# I Expect this error message for the following command:
cmd = "ls /root"
# expected stderr
stderr = "ls: cannot open directory '/root': Permission denied\n"
``````toml
[stdin]# stdin content to be forwarded to the command
# Example:
cmd = "cat"
# stdin content
stdin = "hello"
# expected stdout
stdout = "hello"
``````toml
[exit_status]# Set the expected exit status of a command
# Default value:
exit_status = 0# Example:
# The test will expect a return value of 1
exit_status = 1
cmd = "git"
``````toml
[timeout]# Set the timeout of a command (in seconds)
# Default value:
timeout = 60# Example:
# The command must not exceed 5 seconds
timeout = 5
cmd = "sleep 10"
``````toml
[runs_on]# An array of strings that defines on witch os the test is allowed to run
# Default value:
runs_on = ["linux", "windows", "macos"]# Example:
# The test will only run under linux
runs_on = ["linux"]
``````toml
[unix_shell]# Set the shell to use to run commands under unix systems
# Default value:
unix_shell = "sh"# Example:
# The command will run under "zsh" instead of "sh" under linux
unix_shell = "zsh"
``````toml
[windows_shell]# Set the shell to use to run commands under windows
# Default value:
windows_shell = "cmd"# Example:
# The command will run under "powershell" instead of "cmd" under windows
windows_shell = "powershell"
``````toml
[working_dir]# Set the working directory of a test
# by default, the path is set where the testfile is located
# working_dir value can be a relative or a full path# Default value
working_dir = "."# Examples:
# Set the working directory of the command to "/tmp"
working_dir = "/tmp"
cmd = "ls"
# Set the working directory of the command to the parent folder of the testfile
working_dir = ".."
cmd = "ls"
```## License
This project is released under [MIT](LICENSE) license.
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.