Hudson 运行一些测试,但不运行其他测试

发布于 2024-11-27 18:46:49 字数 1111 浏览 0 评论 0原文

我有一个 Maven 管理的 Java 项目,其中包括 JUnit 测试——这没什么不寻常的。最近,我的机器上开始出现损坏的版本,但 Hudson 仍然很高兴。我意识到我所做的更改破坏了单元测试,但注意到 Hudson 没有运行单元测试。我的大部分测试都运行良好,但我的一个包中的所有内容都完全不存在。未列为“跳过”,但实际上缺失

现在,我没有设置这个 Hudson 实例,而且我不是专家,所以我不知道从哪里开始。排名不分先后:

  • 我查看了项目设置页面,复制了正在使用的确切 Maven 命令行并在本地运行。 POM 中有一些 Hudson 特定的配置文件设置,所以我认为值得一试。缺少的测试仍然运行(并且失败)。
  • 我试图查看旧的处决,看看是否是最近的变化。不幸的是,我们只保留了 5 个旧版本,所以这是一个死胡同。
  • 我仔细检查了 POM,看看是否有任何东西可能导致它排除测试——不是 Maven 天才,但我可以非常自信地说,不应该有任何东西,无论如何,这都不重要由于第 1 点,
  • 我下载了 Hudson 工作区。有趣的是,在 /target 下有一个 test-classes 目录,其中包含所有缺少的测试的 .class 文件,但是 /target/ Surefire-reports 没有匹配的输出文件

我觉得我一定在某个地方缺少某种设置,或者至少缺少某种日志文件来表明这是如何发生的 - 也许是测试失败如此严重,因为在调用它们的 Surefire 进程写入故障之前对其进行核攻击? ——但就像我说的,哈德森纽布。我下一步应该做什么?


更新:在本地安装了 Jenkins 并尝试重现。我失去了理智:即使我自己登录,转到 Jenkins 作业工作区,并使用我自己的本地 m2 存储库(来自网络驱动器)在我自己的帐户下构建,它仍然无法运行相当

  • 测试
  • 多 相同的 Maven / Java 二进制文件(来自网络驱动器)
  • 运行相同的操作系统

据我所知,两台机器上的源是相同的,我的环境应该是相同的(相同的帐户)......我不认为任何差异,当然除了大量测试不要在詹金斯盒子上运行。

I have a Maven-managed Java project that includes JUnit tests -- nothing unusual. Recently, I started getting broken builds on my machine, but Hudson stayed happy. I realized that I had made a change that broke a unit test, but noticed that Hudson wasn't running the unit test. Most of my tests ran fine, but everything in one of my packages was totally absent. Not listed as 'skipped', but actually missing.

Now, I didn't set up this Hudson instance, and I'm not a guru, so I wasn't sure where to start. In no particular order:

  • I looked at the project settings page, and copied the exact Maven command line being used and ran it locally. There are some Hudson-specific profile settings in the POM, so I thought it was worth a shot. Missing tests still run (and fail).
  • I tried to look at old executions, to see if maybe it was a recent change. Unfortunately, we only keep 5 old builds, so dead end there.
  • I checked the POM carefully to see if anything might ever cause it to exclude tests -- not a Maven genius but I can say pretty confidently that there shouldn't be anything, and anyway it shouldn't matter because of bullet #1
  • I downloaded the Hudson workspace. Interestingly, there's a test-classes directory under /target which has .class files for all the missing tests, but /target/surefire-reports has no matching output files

I feel like I must be missing some kind of setting somewhere, or at least some kind of logfile that would indicate how this is happening -- maybe the tests are failing so badly as to nuke the Surefire process that invoked them before it can write about the failure? -- but like I said, Hudson newb. What should my next move be?


UPDATE: Installed Jenkins locally and tried to reproduce. I'm losing my mind: it still fails to run quite a few tests, even if I log in myself, go to the Jenkins job workspace, and build

  • under my own account
  • using my own local m2 repo (from a network drive)
  • using the same Maven / Java binaries (from a network drive)
  • running the same OS

As far as I can tell, the source on the two machines is identical, my environment should be the same (same account)... I can't think of any differences, except of course that a lot of tests don't run on the Jenkins box.

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

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

发布评论

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

评论(2

只是我以为 2024-12-04 18:46:50

我刚刚遇到了这个问题,我敢打赌您的一些测试没有遵循标准命名约定; *测试.java。 Surefire 默认情况下只接受符合特定命名约定的测试; http://maven.apache.org/plugins/maven -surefire-plugin/examples/inclusion-exclusion.html

I just had this exact problem and I'm willing to bet that some of your tests weren't following the standard naming convention; *Test.java. Surefire by default only picks up tests adhering to a certain naming convention; http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html

甜`诱少女 2024-12-04 18:46:50

我几乎肯定 这是这不是 Hudson 的错,甚至严格来说也不是 Maven 的错。我认为这是一个 JUnit 错误,我将在另一个问题中追查它。

I'm almost positive that this is not Hudson's fault, or even strictly Maven's fault. I think it's a JUnit bug, and I'll chase it down in this other question.

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