lucifer-testing

Crates.iolucifer-testing
lib.rslucifer-testing
version1.0.0
sourcesrc
created_at2022-10-01 04:08:56.492417
updated_at2023-01-29 02:52:17.015456
descriptionIlluminating CLI testing.
homepagehttps://github.com/winstonpuckett/lucifer
repositoryhttps://github.com/winstonpuckett/lucifer
max_upload_size
id677634
size80,361
Winston Puckett (winstonpuckett)

documentation

README

Build / Test / Publish

LUCIFER 🐲

Free, Open source, Cross-platform, Illuminating CLI testing written in Rust.

What is lucifer?

Lucifer is a CLI testing tool designed for running suites of tests. It is designed around the idea that your integration tests need to scale alongside your code base.

Cucumber is a great example of a framework that separates the code that interprets and executes a test from the test itself. This idea is the foundation of lucifer. By isolating the code which exercises your CLI from the requirements you need to specify, the complexity of your test codebase can scale linearly with the tests that you run.

All lucifer tests are specified in plain YAML to maximise the readability and ease of writing. Developers, QA, Analysts, and anyone else who knows what a CLI is can read these tests easily.

This comes at the tradeoff of customizability. Lucifer is responsible for executing the data, which makes it harder to customize the tool should you have a need to. If you find that you need to do something lucifer doesn't offer, there are a few options.

1. Create an issue (Or better yet, a pull request!)

Lucifer may be missing features. Use the issue tab in GitHub to create new feature requests and connect with me about what you're looking for.

2. Consider whether it should be an integration test.

Lucifer supports many different types of tests. If there's something specific that happens which lucifer doesn't cover, consider whether that should be a unit test.

More information on the testing pyramid

3. Write your own tool

If worst comes to worst, you can write a simple bash script to wrap your tool and validate what needs to be validated. Just remember that performance metrics will envolve any custom verification steps.

Why is it called Lucifer?

I was talking with a friend of mine who studies these things and he told me that the original translations of "the Satan" actually translate better as "the challenger." This alters the understanding of what happened with Job (in the book of Job in the old testament) - it's not that God and "Satan" were talking, it's that God was discussing something and someone spoke up, making them "the Satan" in that scenario.

Of course, I'm misrepresenting all of this by calling this project lucifer and not satan. Lucifer is the reference to the fallen angel as far as I am aware. But darn it, lucifer sounded better.

This project aims to challenge your assumptions of what your code looks like. And in doing so, become "the Satan" for you so that you don't have to.

Getting Started

Install

Prerequisites:

lucifer is built and distributed using Rust. You'll need a copy of Rust's package manager, cargo, installed on your local system.

To install lucifer, run the following command in your terminal of choice:

cargo install lucifer-testing

Running a test

Once you have lucifer installed, it's time to start testing! Let's create a simple test.

  1. Create a yaml file called "feature.yaml" or any meaningful name.
  2. Paste this yaml into the file
command: echo
tests:
  - name: echo replies
    description: |
      Given any string
      When echo is called
      Then that string should be returned
    args:
      - hello
    expectations:
      - output: hello

Run this file with the command:

lucifer -i ./feature.yaml

For more examples, visit the test syntax reference.

Alternatives

Lucifer may not be the right choice for you. That's ok. I hope you will consider supporting one of these other open source projects:

Finally

If you try out lucifer, please give it a start on GitHub. I love knowing that someone thought this effort was valuable.

Commit count: 203

cargo fmt