# \[ANN\] bbt 0.3.0

**URL:** <https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369>\
**Category:** Releases\
**Created:** [April 25, 2026, 11:34pm UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369 "2026-04-25T23:34:48Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [April 25, 2026, 11:34pm UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/1 "2026-04-25T23:34:48Z")

</div>

_bbt_ is the most effective solution I’m aware of for documenting and testing CLI software.

As a reminder, the principle is to describe your examples / scenarios in near-natural language by using the usual Gherkin framework (Given/When/Then) and _bbt_ syntax for the steps.  
And then you just run your scenarios with (for example) `bbt my_features.md`, meaning that the same file is both your documentation and the test script, and you get both for the price of one.

Version 0.3.0 brings some more user assistance, including:

- A `bbt explain` command that clearly shows what _bbt_ understands from the submitted file and what will be executed / tested;

- An integrated tutorial accessible with `bbt help tutorial`;

- Generation of an example with `bbt help example`;

- A complete grammar with an example for each recognized step syntax via `bbt help grammar`.

There are also some new syntax features, such as “when I run x **or** y”:

```markdown
# Scenario: testing command line help
- When I run `awk` or `awk --help`
- Then the output contains `Usage: awk etc.`

```

Or the ability to execute a command in preconditions or postconditions, as in:

```markdown
# Example: repairing an xml file
- Given that `xmllint my.xml` fails
- When I run `repair --auto my.xml`
- Then I successfully run `xmllint my.xml`

```

_bbt_ 0.3.0 is available at [https://github.com/LionelDraghi/bbt](https://github.com/LionelDraghi/bbt) for Linux/Mac/Windows, and coming soon to Alire.

* * *

---

<div class="post-metadata">

**Author:** ![pyj](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/pyj/32/5_2.png) [@pyj](https://forum.ada-lang.io/u/pyj)\
**Post date:** [April 26, 2026, 3:17am UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/2 "2026-04-26T03:17:28Z")

</div>

> [@LionelDraghi](#):
>
> _bbt_ is the most effective solution I’m aware of for documenting and testing CLI software.

It is absolute _fantastic_ at this. BBT is also great for [golden file testing](https://softwareengineering.stackexchange.com/questions/358786/what-are-golden-files).

---

<div class="post-metadata">

**Author:** ![sbenitezb](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/sbenitezb/32/285_2.png) [@sbenitezb](https://forum.ada-lang.io/u/sbenitezb)\
**Post date:** [April 26, 2026, 7:25pm UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/3 "2026-04-26T19:25:26Z")

</div>

I started using it to validate macOS software (antimalware daemon) in my day job. The biggest problems I’ve found is that I need to write several shell scripts that take care of things bbt cannot do natively because it doesn’t launch programs as a shell.

So far, I’m very happy about it, even though I have to rely on those scripts to do the heavy lifting.

---

<div class="post-metadata">

**Author:** ![mgrojo](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/mgrojo/32/15_2.png) [@mgrojo](https://forum.ada-lang.io/u/mgrojo)\
**Post date:** [April 26, 2026, 7:41pm UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/4 "2026-04-26T19:41:39Z")

</div>

You can do things like these:

```markdown
## Feature : Command line

bbt is using quotes for joining arguments as the shell, and the quotes are
not passed to the executed program.

### Scenario : command with quoted arguments
  - When I run `sh -c "if true; then echo True; fi"`
  - Then I get no error
  - And Output is `True`

```

```bash
$ bbt test.md

```

```markdown

# Document: [test.md](test.md)  
  ## Feature: Command line  
   ### Scenario: [command with quoted arguments](test.md): 
   - OK : When I run `sh -c "if $(true); then echo True; fi"`  
   - OK : Then I get no error  
   - OK : And Output is `True`  
   - [X] scenario [command with quoted arguments](test.md) pass  

## Summary : **Success** , 1 scenarios OK

```

See [Quotes passed to tested programs · Issue #11 · LionelDraghi/bbt · GitHub](https://github.com/LionelDraghi/bbt/issues/11)

---

<div class="post-metadata">

**Author:** ![sbenitezb](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/sbenitezb/32/285_2.png) [@sbenitezb](https://forum.ada-lang.io/u/sbenitezb)\
**Post date:** [April 26, 2026, 7:58pm UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/5 "2026-04-26T19:58:21Z")

</div>

That’s one of the cases I encountered actually, quoted JSON.

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [April 26, 2026, 10:06pm UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/6 "2026-04-26T22:06:43Z")

</div>

Happy to read that you’re using it!

I try to define only mechanisms that run on both Windows and Unix systems, without relying on tools outside the Ada runtime.

As an exception, there is a feature that run on Unix systems only, something that may help you, is the ability to create an executable shell script within the scenario.  
([bbt/docs/features/A006\_Given\_Executable\_File.md at eb646a1804c54e6f7738a535e9d914533793a45b · LionelDraghi/bbt · GitHub](https://github.com/LionelDraghi/bbt/blob/eb646a1804c54e6f7738a535e9d914533793a45b/docs/features/A006_Given_Executable_File.md))

````md
## Scenario: trying to run the same script created with the executable attribute should succeed
- Given the new executable file `cmd2.sh` containing
```
#!/bin/sh
echo "bbt rules!"
```
- When I run `./cmd2.sh`
- Then I get `bbt rules!`

````

That said, this is not more portable than what was suggested by Manuel.

* * *

**Side note:** I realize now that attributes are not documented !  
For the record, there is two attributes for now:

- `executable` so that the created file has +x attributes
- `unordered` so that result is OK even if lines in the output are not in the expected order

```md
- Then output contains file `Cities` (unordered)

```

I was envisioning to extend this list of atributes, for example to ignore case or blanks on file compare. It’s already possible thanks to command line options, but that goes against the spirit of the tools : the single source of truth is the doc, so the expected behavior must be in the doc, not on the command line. If you have good names to suggest…

---

<div class="post-metadata">

**Author:** ![Lucretia](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lucretia/32/17_2.png) [@Lucretia](https://forum.ada-lang.io/u/Lucretia)\
**Post date:** [May 3, 2026, 10:32am UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/7 "2026-05-03T10:32:16Z")

</div>

Does it implement the full gherkin/cucumber feature set? I got stuck ages ago when doing the [ray tracer challenge book](https://github.com/Lucretia/raytracer_challenge) because a certain feature wasn’t implemented in GNATBDD. I’d like to go back to redo it and complete it.

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [May 3, 2026, 8:18pm UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/8 "2026-05-03T20:18:11Z")

</div>

Pending action on my side, describing the differences with Gherkin!

Mostly:

Some Gherkin features are not implemented in _bbt_:

- table input (`Scenario Outlines` / `Examples`).
- the new “Rule” keyword (I don’t know what it is for)

Some differences :

- the file structure of gherkin files is simple: one feature per file, optionally a background, and some scenarios. _bbt_ is more flexible, zero, one or more features, one optional background at document level **and** one per feature;
- in Gherkin, tags are words starting with “@” put just below the scenario title. With _bbt_ there is no special marker, whatever string may be a tag. You can use @windows if you want.  
(in _bbt_ tests, to specify different file path format output, I use Windows\_Only and Unix\_Only as tag)

Some features are specific to _bbt_:

- for example the ability to specify a common output on several commands, within a single scenario:

> - when I run `add "1+2"` or `add "2+1"` or `add "0+3"`
> - then i get `3`

But the most important difference is in the use:

- gherkin is a doc format, it has no defined semantic within scenarios: to run stuff, you have to write code.
- _bbt_ is dedicated to cli black box testing, you do not have to write code, but you cannot use it for unit or integration or GUI testing.

---

<div class="post-metadata">

**Author:** ![sbenitezb](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/sbenitezb/32/285_2.png) [@sbenitezb](https://forum.ada-lang.io/u/sbenitezb)\
**Post date:** [May 3, 2026, 8:31pm UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/9 "2026-05-03T20:31:00Z")

</div>

> [@LionelDraghi](#):
>
> but you cannot use it for unit or integration or GUI testing.

Yes I can and I’m using (abusing) it for integration testing. But I have to use several shell scripts to do part of the hard work. I don’t particularly like that workflow, but I do like having an md file that acts as documentation for a specific feature and tests for it to validate it.

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [May 3, 2026, 8:49pm UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/10 "2026-05-03T20:49:46Z")

</div>

I’m a bit curious! 😀

---

<div class="post-metadata">

**Author:** ![Lucretia](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lucretia/32/17_2.png) [@Lucretia](https://forum.ada-lang.io/u/Lucretia)\
**Post date:** [May 3, 2026, 10:09pm UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/11 "2026-05-03T22:09:02Z")

</div>

Yeah, that book provides the gherkin inputs and uses tables.

This is the last bit I was on in that book:

```ada
Scenario: Constructing the PPM header
Given c ← canvas(5, 3)
When ppm ← canvas_to_ppm(c)
Then lines 1-3 of ppm are
"""
P3
5 3
255
"""

```

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [May 4, 2026, 8:15am UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/12 "2026-05-04T08:15:24Z")

</div>

> [@Lucretia](#):
>
> ```ada
> Scenario: Constructing the PPM header
> Given c ← canvas(5, 3)
> When ppm ← canvas_to_ppm(c)
> Then lines 1-3 of ppm are
> """
> P3
> 5 3
> 255
> """
> 
> ```

I suppose canvas and canvas\_to\_ppm are functions from your code?  
This illustrate what GNATBDD, Cucumber, behave, etc. are good at.  
_bbt_ wasn’t design for this.

Here you could twist things to use it, because the output PPM P3 is a text format, but it requires to also have the ability to pass the canvas to your exe on the command line, or in a text file. It would then looks like:

````md
# Scenario: Constructing the PPM header
- given the file `canvas.txt` 
  ```
  height=5
  width=3
  ```
- when I run `myraytracer canvas.txt` 
- then the output contains 
  ```
  P3
  5 3
  255
  ```

````

(Note also that _bbt_ has no “start with” semantics for now.)

---

<div class="post-metadata">

**Author:** ![Lucretia](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lucretia/32/17_2.png) [@Lucretia](https://forum.ada-lang.io/u/Lucretia)\
**Post date:** [May 4, 2026, 9:44am UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/13 "2026-05-04T09:44:53Z")

</div>

> [@LionelDraghi](#):
>
> I suppose canvas and canvas\_to\_ppm are functions from your code?

Well, that’s the senario from the book, which gnatbdd couldn’t handle iirc as it’s not committed locally.

> [@LionelDraghi](#):
>
> This illustrate what GNATBDD, Cucumber, behave, etc. are good at.  
> _bbt_ wasn’t design for this.

Would be nice to just have a full gherkin implementation for Ada.

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [October 12, 2026, 8:15pm UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/14 "2026-10-12T20:15:26Z")

</div>

> [@sbenitezb](#):
>
> But I have to use several shell scripts to do part of the hard work. I don’t particularly like that workflow, but I do like having an md file that acts as documentation for a specific feature and tests for it to validate it.

Hi Sebastian,  
I did open a discussion [here](https://github.com/LionelDraghi/bbt/discussions/42) on the possibility to have a “run shell” command to simplify the syntax (no more sh -c “…” trick needed) with " in the command that have to be escaped.  
If this is of any interest for you, please telle me.

---

<div class="post-metadata">

**Author:** ![LionelDraghi](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/lioneldraghi/32/416_2.png) [@LionelDraghi](https://forum.ada-lang.io/u/LionelDraghi)\
**Post date:** [October 13, 2026, 4:15pm UTC](https://forum.ada-lang.io/t/ann-bbt-0-3-0/4369/15 "2026-10-13T16:15:02Z")

</div>

> [@pyj](#):
>
> BBT is also great for [golden file testing](https://softwareengineering.stackexchange.com/questions/358786/what-are-golden-files).

Hi Paul,

Although I try to avoid it, on two projects I have run into the classic snapshot testing problem: I want to compare long logs where the diagnostics matter, but the timestamp at the beginning of each line does not.

I also get CI failures because the execution directory is different from the one on my machine, along with other situations that force me to write rather ugly things such as:

````md
- When I run "sh -c "smk st -l | sed 's/\[0-9\]\[0-9\]\*-\[0-9\]\[0-9\]-\[0-9\]\[0-9\]/YYYY:MM:DD/g' | sed 's/\[0-9\]\[0-9\]:\[0-9\]\[0-9\]:\[0-9\]\[0-9\].\[0-9\]\[0-9\]/HH:MM:SS.SS/g'""

- Then I get
```
Command "mkdir dir1", last run [YYYY:MM:DD HH:MM:SS.SS]
  Sources: (0)
  Targets: (1)
  - [If absence] [Dir] [Normal] [Target] [Identic] [YYYY:MM:DD HH:MM:SS.SS] dir1
```

````

To make these cases easier, I implemented a few shortcuts. For example, the above can be rewritten as:

````md
- When I run "smk st -l"

- Then I get (ignoring time)
```
Command "mkdir dir1", last run [2000:01:01 00:00:00.00]
etc.
```

````

There is also an `ignoring dir` option, which ignores both the path itself and path formatting differences (Windows vs Unix).

If you have other ideas for useful features when comparing against a golden file, I’d be interested to hear them.

Lionel
