开发者

Can a class library read the app.config file of a Coded UI Test that is being executed?

开发者 https://www.devze.com 2023-02-17 12:36 出处:网络
I\'ve developed a little utility library that deals with a lot of the configuration and logging needed to by all of my Coded UI test projects.I have the class library set up to read the app.config fil

I've developed a little utility library that deals with a lot of the configuration and logging needed to by all of my Coded UI test projects. I have the class library set up to read the app.config file using the following to read the values:

ConfigurationManager.AppSettings["KeyNa开发者_如何学JAVAme"]

I understand that when you include this class library in another project, the app.config of the new project should be used during execution. Actually, that's precisely what I want, it just doesn't appear to be happening.

My other project is a CUIT but it seems as though my class library it includes isn't reading any sort of app.config. Not its own, not the CUIT's.

Is this even possible?


Looks like I was missing the following line in my class library. After adding it things worked as I expected.

ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
0

精彩评论

暂无评论...
验证码 换一张
取 消