如何在Github中显示我的测试通过/失败?

时间:2012-11-24 22:06:40

标签: unit-testing github continuous-integration

我在github上有一个项目,它有大量的单元测试(使用mocha作为node.js)。

我想通过在每个页面上显示通过/失败的测试来展示。我注意到Github上的其他项目正在这样做。

enter image description here

我一直无法找到有关如何显示测试状态的任何文档。

  • 如何让Github显示单元测试输出?
  • Github是运行测试还是需要连接外部Web应用程序?
  • 是否有免费的网络服务(我的应用程序是开源)?

4 个答案:

答案 0 :(得分:49)

看看Travis CI。您可以将它与GitHub一起使用。

他们有docs on using NodeJS

您看到的徽章会在项目的README.md文件中调用"status images" and Travis provides MarkDown that you can insert

答案 1 :(得分:11)

请注意,自2013年4月26日起,您可以在build status上看到GitHub repo branch page

build status on GitHub repo branches

Commit Status API允许您在其他地方使用它:请参阅“ Repo Statuses API”。

从2013年4月30日开始,API endpoint for commit statuses已扩展为允许分支和标记名称,以及提交SHA

答案 2 :(得分:5)

CircleCI the status badges也只是一些图片,您可以通过降价将其放入README.md文件中。例如:

![Build Status](https://circleci.com/gh/<your github name>/<repo name>.png?circle-token=:circle-token)

![Build Status](https://circleci.com/gh/<your github name>/<repo name>.svg?style=shield&circle-token=:circle-token)

答案 3 :(得分:2)

是的,我很确定你的意思是詹金斯或https://travis-ci.org/ 他们在你的github帐户上工作!在每次提交时都会执行测试。