SpecFlow 测试因访问被拒绝异常而失败
在启动并运行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来它正在尝试访问隐藏的 Subversion 文件夹 (.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:
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.