SpecFlow 测试因访问被拒绝异常而失败

发布于 2024-11-09 12:48:52 字数 2626 浏览 0 评论 0原文

在启动并运行 Orchard CMS,然后检查我们的 Subversion 存储库后,我一直在查看现有的测试覆盖率,特别是 SpecFlow 测试。

当我尝试从 CodeRush 测试运行程序或 NUnit GUI (v2.5.10) 运行测试时,我在 67 个测试中遇到异常:

Orchard.Specs.AdditionFeature.AnonymousUserCanSeeTheHomePageButNotTheDashboard:
System.UnauthorizedAccessException : Access to the path
'C:\Users\richard.slater\AppData\Local\Temp\Orchard.Specs\5dchvodt.b1i\Modules\
Orchard.Packaging\Views\.svn\all-wcprops' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
at Orchard.Specs.Util.PathExtensions.FileCopy(Path sourcePath, Path targetPath, Path sourceFile) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Util\PathExtensions.cs:line 51
at Orchard.Specs.Util.PathExtensions.c__DisplayClass1.b__0(Path file) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Util\PathExtensions.cs:line 22
at Bleroy.FluentPath.PathCollection.ForEach(Action`1 action)
at Orchard.Specs.Util.PathExtensions.DeepCopy(Path sourcePath, Path targetPath) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Util\PathExtensions.cs:line 20
at Orchard.Specs.Hosting.WebHost.CopyExtension(String extensionFolder, String extensionName, ExtensionDeploymentOptions deploymentOptions) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Hosting\WebHost.cs:line 202
at Orchard.Specs.Bindings.WebAppHosting.GivenIHaveModule(String moduleName) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Bindings\WebAppHosting.cs:line 132
at Orchard.Specs.Bindings.WebAppHosting.GivenIHaveACleanSiteWith(String virtualDirectory, Table table) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Bindings\WebAppHosting.cs:line 161
at Orchard.Specs.Bindings.OrchardSiteFactory.GivenIHaveInstalledOrchard(String virtualDirectory) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Bindings\OrchardSiteFactory.cs:line 23
at Orchard.Specs.Bindings.OrchardSiteFactory.GivenIHaveInstalledOrchard() in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Bindings\OrchardSiteFactory.cs:line 16
at TechTalk.SpecFlow.Bindings.MethodBinding.InvokeAction(Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
at TechTalk.SpecFlow.TestRunner.ExecuteStepMatch(BindingMatch match, Object[] arguments)
at TechTalk.SpecFlow.TestRunner.ExecuteStep(StepArgs stepArgs)
at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()
at Orchard.Specs.AdditionFeature.AnonymousUserCanSeeTheHomePageButNotTheDashboard() in c:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\PermissionModel.feature:line 28

我尝试以管理员身份执行测试,但是我真正了解 SpecFlow,所以我怀疑我缺少一些关键的东西。

After getting the Orchard CMS up and running then checked into our Subversion repository, I have been looking at the existing test coverage and specifically the SpecFlow tests.

When I try and run the tests from the CodeRush test runner or from NUnit GUI (v2.5.10) I get exceptions on 67 of the tests:

Orchard.Specs.AdditionFeature.AnonymousUserCanSeeTheHomePageButNotTheDashboard:
System.UnauthorizedAccessException : Access to the path
'C:\Users\richard.slater\AppData\Local\Temp\Orchard.Specs\5dchvodt.b1i\Modules\
Orchard.Packaging\Views\.svn\all-wcprops' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
at Orchard.Specs.Util.PathExtensions.FileCopy(Path sourcePath, Path targetPath, Path sourceFile) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Util\PathExtensions.cs:line 51
at Orchard.Specs.Util.PathExtensions.c__DisplayClass1.b__0(Path file) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Util\PathExtensions.cs:line 22
at Bleroy.FluentPath.PathCollection.ForEach(Action`1 action)
at Orchard.Specs.Util.PathExtensions.DeepCopy(Path sourcePath, Path targetPath) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Util\PathExtensions.cs:line 20
at Orchard.Specs.Hosting.WebHost.CopyExtension(String extensionFolder, String extensionName, ExtensionDeploymentOptions deploymentOptions) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Hosting\WebHost.cs:line 202
at Orchard.Specs.Bindings.WebAppHosting.GivenIHaveModule(String moduleName) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Bindings\WebAppHosting.cs:line 132
at Orchard.Specs.Bindings.WebAppHosting.GivenIHaveACleanSiteWith(String virtualDirectory, Table table) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Bindings\WebAppHosting.cs:line 161
at Orchard.Specs.Bindings.OrchardSiteFactory.GivenIHaveInstalledOrchard(String virtualDirectory) in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Bindings\OrchardSiteFactory.cs:line 23
at Orchard.Specs.Bindings.OrchardSiteFactory.GivenIHaveInstalledOrchard() in C:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\Bindings\OrchardSiteFactory.cs:line 16
at TechTalk.SpecFlow.Bindings.MethodBinding.InvokeAction(Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
at TechTalk.SpecFlow.TestRunner.ExecuteStepMatch(BindingMatch match, Object[] arguments)
at TechTalk.SpecFlow.TestRunner.ExecuteStep(StepArgs stepArgs)
at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()
at Orchard.Specs.AdditionFeature.AnonymousUserCanSeeTheHomePageButNotTheDashboard() in c:\Project\Damovo.co.uk_NEW\src\Orchard.Specs\PermissionModel.feature:line 28

I have tried executing the tests as Administrator, however I have know real knowledge of SpecFlow so I suspect I am missing something critical.

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

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

发布评论

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

评论(1

执笏见 2024-11-16 12:48:52

看起来它正在尝试访问隐藏的 Subversion 文件夹 (.svn),但它们根本无法访问。可能的原因是:

  • 您当前操作的用户帐户没有足够的访问权限(读取)。尝试在顶级存储库的“安全”选项卡上为当前登录的用户设置这些权限文件夹属性屏幕 - 更改应传播到所有较低的文件夹。
  • 有一个 Subversion 客户端(如 TortoiseSVN)在后台运行,它打开这些文件进行读/写。这种可能性更大。尝试将其关闭(或者如果没有选项可以关闭它,则终止 SVN 客户端进程),看看会发生什么。

弄乱内部 .svn 文件可能很危险,并会损坏您签出的存储库文件夹。我不知道 SpecFlow 是否在此过程中修改了这些文件 - 如果没有,那很好

还有一个解决方案可以将存储库文件导出(通过 TortoiseSVN 导出选项)到单独的文件夹( 与 SVN 相关的内容不会被复制),在副本上完成所有工作,并且每次您想要提交时 - 将更改的文件复制回 SVN 绑定文件夹。

It looks like it's trying to access the hidden Subversion folders (.svn) and they are simply not accessible. Possible reasons are:

  • The user accound, under which you are currently operating doesn't have sufficient access rights (read). Try setting those for the currently logged in user on Security tab on the top-level repository folder Properties' screen - changes should propagate to all lower folders.
  • There is a Subversion client (like TortoiseSVN) running in the background, which has those files opened for reading/writing. This is more likely. Try turning it off (or killing the SVN client process if there is no option to close it) and see what would happen.

Messing with internal .svn files can be dangerous and corrupt your checked-out repository folder. I don't know if SpecFlow modifies those files in the process - if not, that's good

There is also a solution to Export the repository files (via TortoiseSVN Export option) to separate folder (the SVN-related stuff will not be copied), do all work on the copy, and every time you'd like to commit - copy changed files back to the SVN-bound folder.

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