markdown BATS断言库比较

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown BATS断言库比较相关的知识,希望对你有一定的参考价值。


> _"Who would dare assert that we know all there is to be known?"_
> ~ Galileo Galilei

## Introduction

At the time of this writing there are 3 separate libraries that offer assertions
for the [Bash Automated Testing System](https://github.com/bats-core/bats-core) (otherwise known as BATS).

These are:

- [jasonkarns/bats-assert](https://github.com/jasonkarns/bats-assert)
- [thingsym/bats-assertion](https://github.com/thingsym/bats-assertion)
- [ztombol/bats-assert](https://github.com/ztombol/bats-assert)

This page shows a comparison of the functions each projects offers.

## Legend

|  Symbol   | Meaning |
| :-------: | ------- |
| JBA       | [jasonkarns/bats-assert](https://github.com/jasonkarns/bats-assert)
| TBA       | [thingsym/bats-assertion](https://github.com/thingsym/bats-assertion)
| ZBA       | [ztombol/bats-assert](https://github.com/ztombol/bats-assert)
| **`foo`** | Affirmatory function |
|   `foo`   | Negatory function |
| :+1:      | Function present |
| :v:       | Alias present    |

## Assert comparison Table

| Function Name                 | Also Known As             |  JBA  |  TBA  |  ZBA  |
| ----------------------------- | ------------------------- | :---: | :---: | :---: |
| **`pass`**                    |                           |       |       |       |
|   `fail`                      | `flunk`                   | :v:   |       |       |
| **`assert`**                  |                           | :+1:  |       | :+1:  |
|   `refute`                    |                           | :+1:  |       | :+1:  |
| **`assert_contains`**         |                           | :+1:  |       |       |
|   `refute_contains`           |                           | :+1:  |       |       |
| **`assert_equal`**            |                           | :+1:  | :+1:  | :+1:  |
|   `refute_equal`              | `assert_fail_equal`       |       | :v:   |       |
| **`assert_line`**             |                           | :+1:  |       | :+1:  |
|   `refute_line`               |                           | :+1:  |       | :+1:  |
| **`assert_lines_equal`**      |                           |       | :+1:  |       |
|   `refute_lines_equal`        | `assert_fail_lines_equal` |       | :v:   |       |
| **`assert_lines_match`**      |                           |       | :+1:  |       |
|   `refute_lines_match`        | `assert_fail_lines_match` |       | :v:   |       |
| **`assert_match`**            |                           |       | :+1:  |       |
|   `refute_match`              | `assert_fail_match`       |       | :v:   |       |
| **`assert_output`**           |                           | :+1:  |       | :+1:  |
|   `refute_output`             |                           |       |       | :+1:  |
| **`assert_output_contains`**  |                           | :+1:  |       |       |
|   `refute_output_contains`    |                           | :+1:  |       |       |
| **`assert_success`**          |                           | :+1:  | :+1:  | :+1:  |
|   `refute_success`            | **`assert_failure`**      | :v:   | :v:   | :v:   |
| **`assert_starts_with`**      |                           | :+1:  |       |       |
|   `refute_starts_with`        |                           |       |       |       |
| **`assert_status`**           |                           |       | :+1:  |       |
|   `refute_status`             |                           |       |       |       |
| _TOTAL (Per project)_         | <hr>                      |  _14_ |  _11_ |   _9_ |


## Summary

23 Function present across all projects,
 3 Function missing across all projects (`pass`, `refute_starts_with`, `refute_status`)

以上是关于markdown BATS断言库比较的主要内容,如果未能解决你的问题,请参考以下文章

bats-Bash自动化测试工具

text BATS测试框架片段

Cmake,Ninja,BATS,建立在 windows - Clion 风格

markdown 如何在Behat FeatureContext中使用PHPUnit断言

走进Java接口测试之流式断言库AssertJ

流利的断言;结合集合和对象图比较断言