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
assertEquals三个参数时:
下载地址:
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
输出:
assertEquals三个参数时:
assertEquals "${msg}" "${expected}" "${actual}"