shUnit2 是基于伯恩的 shell 脚本,xUnit 单元测试框架,它旨在 JUnit、 PyUnit 等以类似的方式工作。如果你有过写一个 shell 脚本的单元测试的愿望,shUnit2 不能通过测试的 job.has。

下载地址:
https://code.google.com/p/shunit2/
帮助:
https://code.google.com/p/shunit2/wiki/GeneralFaq

使用方式:http://wenku.baidu.com/view/4096d90eba1aa8114431d943.html
#!/bin/sh
hello()
{
    echo "hello,word!";
}
test_hello()
{
    assertEquals "$(hello)" 'hello,word!'
}
. /usr/share/shunit2/shunit2

输出:

shunit2单元测试框架

shunit2单元测试框架
assertEquals三个参数时:

assertEquals "${msg}" "${expected}" "${actual}"


相关文章:

  • 2021-06-30
  • 2021-04-29
  • 2021-09-16
  • 2021-12-16
  • 2021-08-09
  • 2021-11-26
  • 2021-11-28
  • 2021-08-01
猜你喜欢
  • 2021-11-20
  • 2021-06-29
  • 2021-05-11
  • 2021-08-02
  • 2021-04-11
  • 2021-06-08
  • 2021-06-27
  • 2022-01-10
相关资源
相似解决方案