I am writing several xUnit tests for some helper classes that rely on some configuration parameters, usually stored in the App.config or on the Internet .config of the executable project.
The configuration looks like this:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="FileNamePattern" value="\\d{8}_\\w{4:20}\.png"/> </appSettings> </configuration>
I am running xUnit 1.9 with the GUI runner (xunit.gui.clr4.exe) and the xUnit console console (on the Jenkins CI server). Currently, I can โenterโ these configuration values โโinto test environments by manually installing xunit.gui.clr4.exe.config and xunit.console.exe.config); however it is tiring and error prone.
I could also make fun of these configuration parameters in the instrument. But using the same device in 10 different files is pretty repeated.
Is there a better way to trick these configuration options with xUnit, for example, provide an App.config file for a test project?
Thach mai
source share