定制 hgraca/shunit 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hgraca/shunit

最新稳定版本:v0.2.0

Composer 安装命令:

composer require hgraca/shunit

包简介

A unit testing framework for shell scripts functions.

README 文档

README

A unit test framework for shell scripts.

How to use

You can install this library in your project, using composer.

Once you have composer installed in your system, you can run composer install, which will install all dependencies and generate the autoloader in vendor/autoload.sh.

For an example, you can check the project Bash Overlay.

Creating and running test suites

Create a test by naming it with the suffix .unit_test.sh, ie my_test.unit_test.sh and put your tests in it while naming the functions with the prefix unit_test.

Ex:

Create this test file and put it in a folder ./tests:

#!/usr/bin/env bash

unit_test.it_should_test_something() {

  if [ "666" == "666" ]; then
    return $0
  fi

  echo "Some error message explaining what failed"
  return $1
}

Execute this test, and all other tests in the folder and sub-folders, by running:

./vendor/bin/shunit ./tests

Bootstrapping your tests

If you want to run some bootstrapping before running your tests, for example to set the logs level, you can do so in the file tests/bootstrap.sh.

Running this project tests

You can run this project test suite by running composer test.

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-30