2017-01-26 17:37
浏览 84

Net Beans 8和PHPUnit-Skeleton-Generator

This question is geared towards anyone using Net Beans 8, or any newer version, and PHPUnit. I'm a little confused by which direction to go in and am wondering if anyone who has already done this can point me in the best direction.

I have setup PHPUnit and PHPUnit-Skeleton-Generator in my Net Beans 8.2 installation. I ran the demo in their documents and everything works as it is supposed to.

The demo from the Net Beans document creates a simple calculator class to add two numbers. You use the @assert notation in block quotes above the class with two values to be added and the expected result. The PHPUnit-Skeleton-Generator reads each @assert and creates a test script using PHPUnit for testing. All works as planned.

My next step was to find other more complicated examples to learn from. In that research, I find that PHPUnit-Skeleton-Generator is deprecated and the assert methods are different in PHPUnit.

My dilemma is, do I continue using it as Net Beans designed it with PHPUnit-Skeleton-Generator and @assert notation, or do I just manually write my tests based on the documentation on PHPUnit's website?

I know most will say to use the PHPUnit docs, and I can't say I disagree. However, I want to still see the results in Net Beans GUI per their documentation. If I ditch the Skeleton and manually write my tesets, will I still be able to use the Net Beans integration to run and utilize the tests?

If I must still use the Skeleton to be able to use the Net Bean integration, is there a good resource to learn how to use the skeleton? Are there other types of @asserts

图片转代码服务由CSDN问答提供 功能建议

此问题适用于使用Net Beans 8或任何较新版本以及PHPUnit的任何人。 我对进入哪个方向感到有点困惑,我想知道是否有人已经做到这一点可以指出我的最佳方向。

我已经设置了PHPUnit和PHPUnit-Skeleton- 我的Net Beans 8.2安装中的Generator。 我在他们的文档中运行了演示,一切都按预期工作。

Net Beans文档中的演示创建了一个简单的计算器类来添加两个数字。 您可以在类上方的块引号中使用@assert表示法,并添加两个值和预期结果。 PHPUnit-Skeleton-Generator读取每个@assert并使用PHPUnit创建测试脚本进行测试。 一切都按计划进行。

我的下一步是找到其他更复杂的例子来学习。 在那项研究中,我发现PHPUnit-Skeleton-Generator已弃用且断言方法在PHPUnit中有所不同。

我的困境是,我是否继续使用它,因为Net Beans使用PHPUnit设计它 -skeleton-Generator和@assert表示法,或者我只是根据PHPUnit网站上的文档手动编写我的测试?

我知道大多数人会说使用PHPUnit文档,我可以 不要说我不同意。 但是,我仍然希望在他们的文档中看到Net Beans GUI中的结果。 如果我放弃Skeleton并手动编写我的tesets,我是否仍然可以使用Net Beans集成来运行和利用测试?

如果我仍然必须使用Skeleton能够 要使用Net Bean集成,是否有很好的资源来学习如何使用骨架? 还有其他类型的@asserts

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongsisui7562 2017-01-27 05:41

    You surely can just write your tests and run them via NetBeans gui and watch results in it as well. Just don't forget to configure you testing preferences and options in Project properties => Testing => PHPUnit

    enter image description here

    If you don't need any special settings you can just choose to run all *Test.php files in testing directory (shown at screenshot).

    解决 无用
    打赏 举报

相关推荐 更多相似问题