views:

379

answers:

2

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?

+1  A: 

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.

Frustrating Developments
+1  A: 

Have you considered moving your GlobalResources into a separate assembly and then referencing that from both your web project and your test project? This is quite easy to do in VS 2008, and achievable but a little more difficult in VS 2005.

I was able to solve a similar problem using that approach.

Peter Bernier
Could you provide some more info on how you managed this approach?
Dai Bok
I would also like more information about this approach.
Adam Tegen