Search code examples
f#visual-studio-test-runnerexpecto

How can I set Expecto configuration properties when running tests via Visual Studio test adapter


I'm using Expecto.VisualStudio.TestAdapter to integrate with Visual Studio 2017. How do I set configuration options for Expecto so that the Visual Studio test runner will pick them up?

I specifically need to set parallel = false for a given test assembly.


Solution

  • Looking at the code for the Expecto Visual Studio Test Adapter, I don't think you can. At least, not without modifying the Test Adapter code and creating your own version. Perhaps fork the project and create a Pull Request that allows the configuration to be tweaked.

    The relevant section is in Executor.fs on line 160 (in the ExecuteProxy class). It calls runTests with { defaultConfig with printer = testPrinters }. You could create your own ExecuteProxy class that takes the configuration to use when calling runTests as a parameter, and then create a generic version of AssemblyExecutor that takes a type parameter telling it what type of ExecuteProxy to use.