Failing Unit Test Can't Find Config Value

When you must duplicate code...

I wrote a simple unit test this past week which was failing unexpectedly. It gave me the classic "What you thought was true, isn't. Better luck next time."

When I debugged the test, I saw that it couldn't find a value in the config. For the sake of example, let's call the variable "AdminUsername".

I knew the code worked, so clearly I had specified it in the service config. What I didn't know is that unit tests need all necessary config values duplicated in the app config of the test project.


portrait title

About Scott

I am a software engineer from Bozeman, MT enjoying the slightly warmer climate of Colorado. I think code can change lives. I think lives are worth changing. I write code.

You can find me on Twitter, LinkedIn, , and Github.