首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Phabricator运行单元测试

Phabricator运行单元测试
EN

Stack Overflow用户
提问于 2016-06-28 10:50:16
回答 1查看 876关注 0票数 0

我想为Phabricator编写一个自定义单元测试。

为此,我检查了Phabricator的书写单元测试的文档,并在./phabricator/src/infrastructure/testing/testcase/PhabricatorTrivialTestCase.php上创建了一个文件(用于使用简单的phabricator测试用例),其内容如下

代码语言:javascript
复制
class PhabricatorTrivialTestCase extends PhabricatorTestCase {

  private $two;

  public function willRunOneTest($test_name) {
    // You can execute setup steps which will run before each test in this
    // method.
    $this->two = 2;
  }

  public function testAllIsRightWithTheWorld() {
    $this->assertEqual(4, $this->two + $this->two, '2 + 2 = 4');
  }

}

当我尝试运行它时,我会收到以下消息。

代码语言:javascript
复制
$ cd ./phabricator
$ arc unit src/infrastructure/testing/testcase/
No tests to run.

为什么我不能按记录运行测试?是不是漏了点什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-08-23 11:36:52

终于想出了解决办法。

有几件事必须做。

  • 将测试文件移动到./src/extensions/__tests__目录(该文件夹必须是__tests__)
  • 将类PhabricatorTrivialTestCase重命名为SomePhabricatorTrivialTestCase (因为名称PhabricatorTrivialTestCase的测试已经存在)
  • 运行arc liberate (使SomeTrivialPhabricatorTestCase可用于测试)
  • 提交更改
  • 运行arc unit --everything (因为arc unit返回“没有要运行的测试”,但是arc unit --everything工作
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38074170

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档