Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running tests in parallel throws IOException #387

Closed
ghost opened this issue Oct 11, 2017 · 6 comments
Closed

Running tests in parallel throws IOException #387

ghost opened this issue Oct 11, 2017 · 6 comments

Comments

@ghost
Copy link

ghost commented Oct 11, 2017

If I have multiple tests running at the same time I get exceptions because of the "failedContexts.txt" file.
Is there a way to disable this?

System.IO.IOException: The process cannot access the file 'C:\Users\x\AppData\Roaming\canopy\failedContexts.txt' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path)
at canopy.history.save(FSharpList`1 results) in C:\projects\canopy\src\canopy\history.fs:line 12
at canopy.runner.run() in C:\projects\canopy\src\canopy\runner.fs:line 235

@lefthandedgoat
Copy link
Owner

lefthandedgoat commented Oct 11, 2017

In parallel, as in your launch your console app more than once and run them at the same time?

I will look to see if StreamWriter has the ability to write w/o a hard lock on the file.

@lefthandedgoat
Copy link
Owner

After doing some reading it looks like I don't need to do file create at all and the streamwriter will handle it all.

lefthandedgoat added a commit that referenced this issue Oct 11, 2017
@ghost
Copy link
Author

ghost commented Oct 11, 2017

I created multiple AppDomains in order to run the tests in parallel in the same instance of the console app.
This works perfectly except of this "failedContexts.txt".

But what happens if two tests try to write to this file at the same time now?

@lefthandedgoat
Copy link
Owner

Ok. I will publish a new version with these changes and they may help. The problem is that canopy was never really designed to run in parallel.

If you don't use the 'RunFailedContextsFirst' feature I can add a flag to not save history which will fix this for you for sure.

@ghost
Copy link
Author

ghost commented Oct 11, 2017

Yes, I saw the issue and your plans for v2. But all the other libraries and plain Selenium were never really satisfying and canopy just works :-)

I don't use the "RunFailedContextsFirst" so disabling it with a flag would work for sure.

Thanks for your fast help!

@lefthandedgoat
Copy link
Owner

This should fix it. If it does not please let me know.

https://www.nuget.org/packages/canopy/1.5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant