R – ASP.Net resource files

asp.netresourcesselenium

I'm using selenium to run some functional tests on the UI for our current application.

I want to ensure that strings from the resource files in the Web project are being displayed at the correct time and place.

Simple (I thought) all I have to do is reference the assembly of the web application and assert that the text selenium is reading from the UI matches the test in the approriate resource file.

The problem is the ASP.Net does some precomilation processing on the resource files and compiles them into an assembly called App_GlobalResources, which isn't created by the normal build process so the functional tests fail because that can't find the App_GlobalResources assembly to look the string up from.

So, any suggestions? Do I need to abandon the App_GlobalResources approach and do something manual that I have control over?

Do you understand the problem or do I need to provide more info?

Best Answer

My interim solution is to use SVN:Externals to pull a copy of the resx files into the test project.

I can then access them via

ResourceManager resource = new System.Resources.ResourceManager("My.Web.Namespace.resources.ImageUrls", Assembly.GetExecutingAssembly());

Its ugly because I already have a reference to the webproject (which I can probably remove now...) and I don't like mixing source files between projects. It just feels like asking for trouble but until someone suggests something better this will have to do.