Got UnauthorizedAccessException when run a Specs test

Topics: Troubleshooting, Writing modules
Dec 14, 2012 at 4:27 PM

Hi guys,

I'm learning about Specflow and try to execute an existing spec test in Orchard using NUnit Test Console. I receive an UnauthorizedAccessException

Orchard.Specs.BlogFeature.EnablingRemoteBlogPublishingInsertsTheAppropriateMetaweblogapiMarkupIntoTheBlogSPage:System.UnauthorizedAccessException : Access to the path 'C:\Users\username\AppData\Local\Temp\Orchard.Specs\rysnhj1j.3yg\Modules\Orchard.Packaging\Module.txt' is denied.

Here is the stack trace

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 D:\Documents\Koneka\TFS\Koneka\Clients\Consort\Dev\src\Orchard.Specs\Util\PathExtensions.cs:line 54
at Orchard.Specs.Util.PathExtensions.<>c__DisplayClass7.<ShallowCopy>b__6(Path file) in D:\Documents\Koneka\TFS\Koneka\Clients\Consort\Dev\src\Orchard.Specs\Util\PathExtensions.cs:line 39
at Bleroy.FluentPath.PathCollection.ForEach(Action`1 action)
at Orchard.Specs.Util.PathExtensions.ShallowCopy(Path sourcePath, String pattern, Path targetPath) in D:\Documents\Koneka\TFS\Koneka\Clients\Consort\Dev\src\Orchard.Specs\Util\PathExtensions.cs:line 37
at Orchard.Specs.Hosting.WebHost.CopyExtension(String extensionFolder, String extensionName, ExtensionDeploymentOptions deploymentOptions) in D:\Documents\Koneka\TFS\Koneka\Clients\Consort\Dev\src\Orchard.Specs\Hosting\WebHost.cs:line 196
at Orchard.Specs.Bindings.WebAppHosting.GivenIHaveModule(String moduleName) in D:\Documents\Koneka\TFS\Koneka\Clients\Consort\Dev\src\Orchard.Specs\Bindings\WebAppHosting.cs:line 132
at Orchard.Specs.Bindings.WebAppHosting.GivenIHaveACleanSiteWith(String virtualDirectory, Table table) in D:\Documents\Koneka\TFS\Koneka\Clients\Consort\Dev\src\Orchard.Specs\Bindings\WebAppHosting.cs:line 161
at Orchard.Specs.Bindings.OrchardSiteFactory.GivenIHaveInstalledOrchard(String virtualDirectory) in D:\Documents\Koneka\TFS\Koneka\Clients\Consort\Dev\src\Orchard.Specs\Bindings\OrchardSiteFactory.cs:line 23
at Orchard.Specs.Bindings.OrchardSiteFactory.GivenIHaveInstalledOrchard() in D:\Documents\Koneka\TFS\Koneka\Clients\Consort\Dev\src\Orchard.Specs\Bindings\OrchardSiteFactory.cs:line 16
at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()
at Orchard.Specs.BlogFeature.ScenarioCleanup() in D:\Documents\Koneka\TFS\Koneka\Clients\Consort\Dev\src\Orchard.Specs\Blogs.feature.cs:line 0
at Orchard.Specs.BlogFeature.EnablingRemoteBlogPublishingInsertsTheAppropriateMetaweblogapiMarkupIntoTheBlogSPage() in d:\Documents\Koneka\TFS\Koneka\Clients\Consort\Dev\src\Orchard.Specs\Blogs.feature:line 110

I set the Security of the ..\Temp\Orchard.Specs to Everyone and removed the "Read Only" attribute. I would assume that by doing so, all of the subfolders should be readable.

Any helps would be appreciated.

Thanks in advance!