Cruisecontrol phpunit 不创建输出

发布于 2024-09-03 21:43:18 字数 7721 浏览 7 评论 0原文

我似乎无法弄清楚为什么 phpunit 目标不输出任何测试结果,即使我已经进行了测试。

我发现的问题是没有任何迹象表明问题是什么!令人难以置信的令人沮丧。

输出如下:

<build error="C:\Program Files (x86)\CruiseControl\projects\myProject\build.xml:46: exec returned: 255" time="1 second">
    <message priority="debug"><![CDATA[Adding reference: ant.PropertyHelper]]></message>
    <message priority="debug"><![CDATA[Detected Java version: 1.6 in: C:\Program Files (x86)\Java\jdk1.6.0_18\jre]]></message>
    <message priority="debug"><![CDATA[Detected OS: Windows Vista]]></message>
    <message priority="debug"><![CDATA[Adding reference: ant.ComponentHelper]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: XmlLogger.file -> log.xml]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: cclastgoodbuildtimestamp -> 20100604161400]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: cctimestamp -> 20100604194749]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: cvstimestamp -> 2010-06-04 18:47:49 GMT]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: projectname -> myProject]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: buildforced -> true]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: label -> build.153]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: cclastbuildtimestamp -> 20100604192123]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: lastbuildsuccessful -> false]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: ant.file -> C:\Program Files (x86)\CruiseControl\projects\myProject\build.xml]]></message>
    <message priority="debug"><![CDATA[Adding reference: ant.projectHelper]]></message>
    <message priority="debug"><![CDATA[Adding reference: ant.parsing.context]]></message>
    <message priority="debug"><![CDATA[Adding reference: ant.targets]]></message>
    <message priority="debug"><![CDATA[parsing buildfile C:\Program Files (x86)\CruiseControl\projects\myProject\build.xml with URI = file:/C:/Program%20Files%20(x86)/CruiseControl/projects/myProject/build.xml]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: ant.project.name -> binarydreams]]></message>
    <message priority="debug"><![CDATA[Adding reference: myProject]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: ant.file.myProject-> C:\Program Files (x86)\CruiseControl\projects\myProject\build.xml]]></message>
    <message priority="debug"><![CDATA[Project base dir set to: C:\Program Files (x86)\CruiseControl\projects\myProject]]></message>
    <message priority="debug"><![CDATA[ +Target: ]]></message>
    <message priority="debug"><![CDATA[ +Target: build]]></message>
    <message priority="debug"><![CDATA[ +Target: phpunit]]></message>
    <message priority="debug"><![CDATA[Attempting to create object of type org.apache.tools.ant.helper.DefaultExecutor]]></message>
    <message priority="debug"><![CDATA[Adding reference: ant.executor]]></message>
    <message priority="debug"><![CDATA[Build sequence for target(s) `build' is [phpunit, build]]]></message>
    <message priority="debug"><![CDATA[Complete build sequence is [phpunit, build, ]]]></message>
    <message priority="debug"><![CDATA[Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.]]></message>
    <message priority="debug"><![CDATA[Execute:Java13CommandLauncher: Executing 'phpunit.bat' with arguments:
'--log-junit'
'C:\Program Files (x86)\CruiseControl\projects\myProject/build/logs/phpunit.xml'
'--coverage-clover'
'C:\Program Files (x86)\CruiseControl\projects\myProject/build/logs/phpunit.coverage.xml'
'--coverage-html'
'C:\Program Files (x86)\CruiseControl\projects\myProject/build/coverage'
'tests/'

The ' characters around the executable and arguments are
not part of the command.]]></message>
    <target name="phpunit" time="1 second">
      <task location="C:\Program Files (x86)\CruiseControl\projects\myProject\build.xml:46: " name="exec" time="1 second">
        <message priority="debug"><![CDATA[Current OS is Windows Vista]]></message>
        <message priority="debug"><![CDATA[Executing 'phpunit.bat' with arguments:
'--log-junit'
'C:\Program Files (x86)\CruiseControl\projects\myProject/build/logs/phpunit.xml'
'--coverage-clover'
'C:\Program Files (x86)\CruiseControl\projects\myProject/build/logs/phpunit.coverage.xml'
'--coverage-html'
'C:\Program Files (x86)\CruiseControl\projects\myProject/build/coverage'
'tests/'

The ' characters around the executable and arguments are
not part of the command.]]></message>
      </task>
    </target>
    <stacktrace><![CDATA[C:\Program Files (x86)\CruiseControl\projects\myProject\build.xml:46: exec returned: 255
    at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:636)
    at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:662)
    at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:487)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
    at org.apache.tools.ant.Main.runBuild(Main.java:698)
    at org.apache.tools.ant.Main.startAnt(Main.java:199)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
]]></stacktrace>
  </build>

我的build.xml如下:

<?xml version="1.0" encoding="UTF-8"?>
<project name="myProject" default="build" basedir=".">

  <target name="build" depends="phpunit"/>

  <target name="phpunit">
    <exec executable="phpunit.bat" dir="${basedir}/source" failonerror="on">
      <arg line="--log-junit '${basedir}/build/logs/phpunit.xml'
          --coverage-clover '${basedir}/build/logs/phpunit.coverage.xml'
          --coverage-html '${basedir}/build/coverage' tests/" />
    </exec>
  </target>

</project>

我的系统: Vista、PHP 5.2.9、PHPUnit 3.4、PHPUnderControl、CruiseControl

I cannot seem to figure out why the phpunit target does not output any test results even though I have tests in position.

The problem I am finding is there is no indication as to what the problem is! Incredibly frustrating.

The output is as follows:

<build error="C:\Program Files (x86)\CruiseControl\projects\myProject\build.xml:46: exec returned: 255" time="1 second">
    <message priority="debug"><![CDATA[Adding reference: ant.PropertyHelper]]></message>
    <message priority="debug"><![CDATA[Detected Java version: 1.6 in: C:\Program Files (x86)\Java\jdk1.6.0_18\jre]]></message>
    <message priority="debug"><![CDATA[Detected OS: Windows Vista]]></message>
    <message priority="debug"><![CDATA[Adding reference: ant.ComponentHelper]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: XmlLogger.file -> log.xml]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: cclastgoodbuildtimestamp -> 20100604161400]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: cctimestamp -> 20100604194749]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: cvstimestamp -> 2010-06-04 18:47:49 GMT]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: projectname -> myProject]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: buildforced -> true]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: label -> build.153]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: cclastbuildtimestamp -> 20100604192123]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: lastbuildsuccessful -> false]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: ant.file -> C:\Program Files (x86)\CruiseControl\projects\myProject\build.xml]]></message>
    <message priority="debug"><![CDATA[Adding reference: ant.projectHelper]]></message>
    <message priority="debug"><![CDATA[Adding reference: ant.parsing.context]]></message>
    <message priority="debug"><![CDATA[Adding reference: ant.targets]]></message>
    <message priority="debug"><![CDATA[parsing buildfile C:\Program Files (x86)\CruiseControl\projects\myProject\build.xml with URI = file:/C:/Program%20Files%20(x86)/CruiseControl/projects/myProject/build.xml]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: ant.project.name -> binarydreams]]></message>
    <message priority="debug"><![CDATA[Adding reference: myProject]]></message>
    <message priority="debug"><![CDATA[Setting ro project property: ant.file.myProject-> C:\Program Files (x86)\CruiseControl\projects\myProject\build.xml]]></message>
    <message priority="debug"><![CDATA[Project base dir set to: C:\Program Files (x86)\CruiseControl\projects\myProject]]></message>
    <message priority="debug"><![CDATA[ +Target: ]]></message>
    <message priority="debug"><![CDATA[ +Target: build]]></message>
    <message priority="debug"><![CDATA[ +Target: phpunit]]></message>
    <message priority="debug"><![CDATA[Attempting to create object of type org.apache.tools.ant.helper.DefaultExecutor]]></message>
    <message priority="debug"><![CDATA[Adding reference: ant.executor]]></message>
    <message priority="debug"><![CDATA[Build sequence for target(s) `build' is [phpunit, build]]]></message>
    <message priority="debug"><![CDATA[Complete build sequence is [phpunit, build, ]]]></message>
    <message priority="debug"><![CDATA[Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.]]></message>
    <message priority="debug"><![CDATA[Execute:Java13CommandLauncher: Executing 'phpunit.bat' with arguments:
'--log-junit'
'C:\Program Files (x86)\CruiseControl\projects\myProject/build/logs/phpunit.xml'
'--coverage-clover'
'C:\Program Files (x86)\CruiseControl\projects\myProject/build/logs/phpunit.coverage.xml'
'--coverage-html'
'C:\Program Files (x86)\CruiseControl\projects\myProject/build/coverage'
'tests/'

The ' characters around the executable and arguments are
not part of the command.]]></message>
    <target name="phpunit" time="1 second">
      <task location="C:\Program Files (x86)\CruiseControl\projects\myProject\build.xml:46: " name="exec" time="1 second">
        <message priority="debug"><![CDATA[Current OS is Windows Vista]]></message>
        <message priority="debug"><![CDATA[Executing 'phpunit.bat' with arguments:
'--log-junit'
'C:\Program Files (x86)\CruiseControl\projects\myProject/build/logs/phpunit.xml'
'--coverage-clover'
'C:\Program Files (x86)\CruiseControl\projects\myProject/build/logs/phpunit.coverage.xml'
'--coverage-html'
'C:\Program Files (x86)\CruiseControl\projects\myProject/build/coverage'
'tests/'

The ' characters around the executable and arguments are
not part of the command.]]></message>
      </task>
    </target>
    <stacktrace><![CDATA[C:\Program Files (x86)\CruiseControl\projects\myProject\build.xml:46: exec returned: 255
    at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:636)
    at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:662)
    at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:487)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
    at org.apache.tools.ant.Main.runBuild(Main.java:698)
    at org.apache.tools.ant.Main.startAnt(Main.java:199)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
]]></stacktrace>
  </build>

My build.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<project name="myProject" default="build" basedir=".">

  <target name="build" depends="phpunit"/>

  <target name="phpunit">
    <exec executable="phpunit.bat" dir="${basedir}/source" failonerror="on">
      <arg line="--log-junit '${basedir}/build/logs/phpunit.xml'
          --coverage-clover '${basedir}/build/logs/phpunit.coverage.xml'
          --coverage-html '${basedir}/build/coverage' tests/" />
    </exec>
  </target>

</project>

My system:
Vista, PHP 5.2.9, PHPUnit 3.4, PHPUnderControl, CruiseControl

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦断已成空 2024-09-10 21:43:18

我遇到了同样的问题:当使用 Cruisecontrol 项目的 build.xml 运行测试时,我得到了预期的输出:

    me@developer-laptop:$ cd cruisecontrol/projects/myproject/
    me@developer-laptop:$ ../../apache-ant-1.7.0/bin/ant phpunit
    ... this created correct unit-tests output

但是当通过 PHPUnderControl 浏览器查看时,它显示为 0 个测试。

我发现这是因为在 Cruisecontrol 的 config.xml 中没有为发布者设置正确的路径。

这是我的有效示例:

<log dir="logs/${project.name}">
    <merge dir="projects/${project.name}/build/logs/"></merge>
</log>
<publishers>
    <artifactspublisher dir="projects/${project.name}/build/coverage" dest="artifacts/${project.name}" subdirectory="coverage"></artifactspublisher>
    <execute command="phpuc graph logs/${project.name} artifacts/${project.name}"></execute>
</publishers>

希望这有帮助!

I had the same problem: when runing tests using Cruisecontrol project's build.xml I was getting the expected output:

    me@developer-laptop:$ cd cruisecontrol/projects/myproject/
    me@developer-laptop:$ ../../apache-ant-1.7.0/bin/ant phpunit
    ... this created correct unit-tests output

But when looking via the PHPUnderControl browser it was showing as 0 tests.

I found that this was due to not having correct paths set up for publishers in cruisecontrol's config.xml.

Here's my sample that works:

<log dir="logs/${project.name}">
    <merge dir="projects/${project.name}/build/logs/"></merge>
</log>
<publishers>
    <artifactspublisher dir="projects/${project.name}/build/coverage" dest="artifacts/${project.name}" subdirectory="coverage"></artifactspublisher>
    <execute command="phpuc graph logs/${project.name} artifacts/${project.name}"></execute>
</publishers>

Hope this helps!

盛装女皇 2024-09-10 21:43:18

nuqqsa

是的,预期的日志文件没有出现。不过,测试似乎确实已运行,因为我必须修复我的 require_once 路径。

在命令提示符中,我将在源文件夹中执行以下操作:

phpunit.bat --log-junit "C:\Program Files(x86)\CruiseControl\projects\myProject/build/logs/phpunit.xml" 
--coverage-clover "C:\Program Files(x86)\CruiseControl\projects\myProject/build/logs/phpunit.coverage.xml" 
--coverage-html "C:\Program Files(x86)\CruiseControl\projects\myProject/build/coverage" tests/

我希望这与路径中的空格或路径另一半的斜杠无关。

我有一个想法。我在运行构建时进行了调试(使用 PHPEdit),并且 PHPUnit 似乎已执行,但我没有在任何测试中放置断点来查看它们是否已执行。当我回家并报告时我会这样做。

nuqqsa:

Yep, the expected log files do not appear. The tests do seem to be run though as I had to fix my require_once paths.

In the command prompt I would do the following in my source folder:

phpunit.bat --log-junit "C:\Program Files(x86)\CruiseControl\projects\myProject/build/logs/phpunit.xml" 
--coverage-clover "C:\Program Files(x86)\CruiseControl\projects\myProject/build/logs/phpunit.coverage.xml" 
--coverage-html "C:\Program Files(x86)\CruiseControl\projects\myProject/build/coverage" tests/

I hope it's nothing to do with the space in the path or the slashes the other half of the paths.

I have had a thought. I have debugged (using PHPEdit) when running the build and PHPUnit does seem to be executed but I haven't put a breakpoint in any of the tests to see if they are executed. I will do that when I get home and report back.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文