1
votes

I am trying to run unit test cases from fake , while i run the script , it throws an error , i.e. access to the path c:/users/local/application data is denied.

Code :

Target "Test" (fun _ ->
!! (testDir + "/NUnit.Test.*.dll")
  |> NUnit (fun p ->
      {p with
         DisableShadowCopy = true;
         OutputFile = testDir + "TestResults.xml" }))

Please Explain above code .

1
Have you tried giving it access to the path? - Fyodor Soikin
yes , i tried giving path of my folder also , but still it is throwing same error. - KMittal
What's the value of testDir? Could it be that one of your tests tries to write to AppData? - CaringDev
On the first occurence of testDir you are using it like it has no '/' character at the end, hence you are adding it ("/NUnit...") On the second you are not adding '/' and maybe "TestResults.xml" is added to the name of the directory. It would be safer to use System.IO.Path.Combine - Bartek KobyƂecki

1 Answers

0
votes

you might to use @@ instead of + and might need \ before testresults.xml in OutputFile

try following

   Target "Test" (fun _ ->
!! (testDir + "/NUnit.Test.*.dll")
  |> NUnit (fun p ->
      {p with
         DisableShadowCopy = true;
         OutputFile = testDir @@ "\TestResults.xml" }))