对源代码管理中的历史版本进行侦探单元测试

发布于 2024-12-27 16:51:24 字数 155 浏览 1 评论 0原文

是否有工具可以对源代码控制中的以前版本的软件运行单元测试? 这个想法将是一个错误出现,我想知道它是什么时候引入的,所以我编写了一个新的测试,软件从源代码控制中检查每个旧版本,在每个版本上运行测试,直到测试不再失败或我们到达了起点。

我们使用颠覆,但我很好奇是否普遍存在这样的东西。

Is there a tool to run unit tests on previous versions of software that's in source control?
The idea would be a bug surfaced and I want to know when it was introduced so I write a new test and the software checks out each back version from source control, running the test on each one, until the test doesn't fail anymore or we reach the beginning.

We use subversion but I'm curious of if anything like this exists in general.

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

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

发布评论

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

评论(3

追我者格杀勿论 2025-01-03 16:51:24

Mercurial 有一个名为 bisect 的内置命令,它基本上可以完成您正在寻找的任务。

它被设计为与用户编写的脚本一起使用,但简而言之,它执行二分搜索,其中您的脚本(运行单元测试)告诉二分法检出的修订版“通过”还是“失败”,并基于此遍历历史记录,直到找到引入错误的修订版。

我不确定 SVN 是否存在这样的工具,但我发现 bisect 与 Mercurial 对于此类事情非常有用。

Mercurial has a built in command called bisect that essentially does what you are looking for.

It is designed to work with a user-written script but in a nutshell, it does a binary search where your script (which runs the unit tests) tells bisect if the checked out revision "passes" or "fails" and based on that it moves through the history until it finds the revision where the bug was introduced.

I'm not sure if such a tool exists for SVN, but I've found bisect with Mercurial to be very useful for this sort of thing.

平安喜乐 2025-01-03 16:51:24

Mercurial(和 Git)中的 Bisect 完全执行此工作,除了检查每个旧版本之外 - 它更快地找到问题根源

Bisect in Mercurial (and Git) perform exactly this job, except of ckecking each back version - it finds source of problem faster

洒一地阳光 2025-01-03 16:51:24

几乎任何版本控制系统都可以让您检查整个构建的特定版本。并允许您跟踪构建的任何特定文件的历史记录/更改。

通常,我只是采取简单的“分而治之”的方法:

  a) Check out a really old version into a scratch directory

  b) Build and confirm it DOESN'T have the bug

  c) Manually compare the old and current versions and make "educated guesses" as to "what changed".

  d) Check out a version between the old and current version (based on what I found in step c).

  e) Build and test.

  f) If it has the bug, check out version between a) and d).

     If it doesn't have the bug, check out a version between d) and the current.

  g) Rinse and repeat

是的,其中部分或全部当然可以编写脚本。

使用 bash(如果您使用的是 Linux)或您选择的脚本语言。

Just about any version control system lets you check out a specific version of an entire build. And lets you track the history/the changes of any specific file(s) of the build.

Normally, I just take a simple "divide and conquer" approach:

  a) Check out a really old version into a scratch directory

  b) Build and confirm it DOESN'T have the bug

  c) Manually compare the old and current versions and make "educated guesses" as to "what changed".

  d) Check out a version between the old and current version (based on what I found in step c).

  e) Build and test.

  f) If it has the bug, check out version between a) and d).

     If it doesn't have the bug, check out a version between d) and the current.

  g) Rinse and repeat

And yes, some or all of this can certainly be scripted.

In bash (if you're on Linux), or in the scripting language of your choice.

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