编写 Cucumber 功能以访问 SVN

发布于 2024-09-08 02:57:20 字数 863 浏览 4 评论 0原文

我正在开发一个工具,通过运行命令行 SVN 来获取信息并导出来访问 SVN。

我想编写一些 Cucumber 功能,这样我就不必手动测试,但我想模拟 SVN 访问。

  1. 我应该改用 Ruby SVN 库吗?如果是的话,选哪个?

  2. 或者是否有一个假的 svn.exe 将提供可编程响应?

编辑:

该工具采用文件路径,查找父 URL 的上几级修订版,然后将该修订版的一堆文件和文件夹导出到新目录中。我想写这样的内容:

Given the file "extra1.txt" contains:
"""
extra1
"""

And the file "file.txt" contains:
"""
file
"""

And SVN holds the following files at revisions:
| tests/extras/extra1.txt    | 123 | extra1.txt |
| tests/path/part05/file.txt | 73  | file.txt   |

When I run "ruby dry_run_create c:\tests\path\part05\file.txt"

Then the file "c:\tests\path\part05\dry_run\extra1.txt" should contain:
"""
extra1
"""

And the file "c:\tests\path\part05\dry_run\file.txt" should contain:
"""
file
"""

通过这些示例,我可以永远更多地演示从 SVN 中提取正确的修订版本,而无需实际创建存储库。

I'm developing a tool that accesses SVN by running the command line SVN to get info and export.

I'd like to write some Cucumber features so I don't have to keep manually testing but I'd like to mock out the SVN accesses.

  1. Should I switch to using a Ruby SVN library and if so, which one?

  2. Or is there a fake svn.exe that will provide programmable responses?

EDIT:

The tool takes a file path, finds the revision of parent URL a few levels up, then exports a bunch of files and folders at that revision into a new directory. I'd like to write something like:

Given the file "extra1.txt" contains:
"""
extra1
"""

And the file "file.txt" contains:
"""
file
"""

And SVN holds the following files at revisions:
| tests/extras/extra1.txt    | 123 | extra1.txt |
| tests/path/part05/file.txt | 73  | file.txt   |

When I run "ruby dry_run_create c:\tests\path\part05\file.txt"

Then the file "c:\tests\path\part05\dry_run\extra1.txt" should contain:
"""
extra1
"""

And the file "c:\tests\path\part05\dry_run\file.txt" should contain:
"""
file
"""

With examples like these I could demonstrate forever more that the correct revisions were being extracted from SVN without having to actually create a repository.

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

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

发布评论

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

评论(2

好久不见√ 2024-09-15 02:57:20

如果您不需要实际测试 SVN 功能,只需完全模拟调用即可。

Mocha 非常适合此

查看(没有双关语)http:// blog.floehopper.org/articles/2006/09/01/mocha-quickstart

If you don't need to actually test the SVN functionality, just mock out the calls completely.

Mocha is great for this

Check out (no pun intended) http://blog.floehopper.org/articles/2006/09/01/mocha-quickstart

忆依然 2024-09-15 02:57:20

我放弃了寻找和等待,编写了自己的 MockVersion

这提供了一些基本的 svn 和 svnadmin 功能,以便我可以创建具有特定修订的模拟存储库并验证这些文件是否已导出。

如果有人有兴趣查看更多功能,请在 github 上打开问题

I gave up looking and waiting and wrote my own, MockVersion.

This provides some basic svn and svnadmin functionality so that I can create a mock repository with specific revisions and verify that those files are exported.

If anyone is interested in seeing more functionality, please open an issue on github.

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