Test failed when change CurrentCulture

Feb 7, 2012 at 8:17 PM

Hi,

I have a basic test where I change the CurrentCulture and tries to get a resource in the new culture.

Running the test using the TestPage of Silverlight works but when I test my .xap by command line using StatLight doesn't works.

My project is a Silverlight application test project, I have two cultures(the neutral for english and another for spanish).

I have set the neutral language to Englisth in the assembly info and I have added the spanish language code in the SupportedCultures.

This is my test:

[

TestMethod]

 

public void GetAvailableWidgetCategories_SpanishResources()

{

 

Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("es-ES");

 

Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("es-ES");

 

Assert.AreEqual("hola", Resources.hello);

}

Could you help me please?

Thanks a lot!.

 

 

Coordinator
Feb 7, 2012 at 11:19 PM

Would you mind running statlight with the --debug and post that here so I can see what it is/isnot copying into the xap? (If you have issues posting it publicly, feel free to contact me through codeplex).

Feb 8, 2012 at 7:44 AM

For completing the information, the resx files has the property Build Action = Embedded Resource and Copy to Output Directory = Always.

I have run it with --debug option and this is the output info:

****************** Input options as configured ******************

ContinuousIntegrationMode : False

Dlls : IEnumerable<string>

{

}

ForceBrowserStart : False

IsRequestingDebug : True

MethodsToTest : IEnumerable<string>

{

}

MicrosoftTestingFrameworkVersion :

NumberOfBrowserHosts : 1

OutputForTeamCity : False

QueryString :

ReportOutputFileType : StatLight

ShowHelp : False

ShowTestingBrowserHost : False

StartWebServerOnly : False

TagFilters :

UnitTestProviderType : Undefined

UseRemoteTestPage : False

WebBrowserType : SelfHosted

XapPaths : IEnumerable<string>

{

'UIFramework\iSOFT.BlueBird.Localization.Test\Bin\Debug\iSOFT.BlueBird.Localization.Test.xap'

}

XmlReportOutputPath :

*****************************************************************

RunnerType = OneTimeConsole

Starting configuration for: UIFramework\iSOFT.BlueBird.Localization.Test\Bin\Debug\iSOFT.BlueBird.Localization.Test.xap

XapItems.FilesContainedWithinXap = AppManifest.xaml

XapItems.FilesContainedWithinXap = iSOFT.BlueBird.Interface.dll

XapItems.FilesContainedWithinXap = iSOFT.BlueBird.Localization.dll

XapItems.FilesContainedWithinXap = iSOFT.BlueBird.Localization.Test.dll

XapItems.FilesContainedWithinXap = Microsoft.Practices.Prism.dll

XapItems.FilesContainedWithinXap = Microsoft.Practices.ServiceLocation.dll

XapItems.FilesContainedWithinXap = Microsoft.Practices.Unity.Silverlight.dll

XapItems.FilesContainedWithinXap = Microsoft.Silverlight.Testing.dll

XapItems.FilesContainedWithinXap = Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll

XapItems.FilesContainedWithinXap = System.ComponentModel.DataAnnotations.dll

XapItems.FilesContainedWithinXap = System.Windows.Controls.Data.Input.dll

XapItems.FilesContainedWithinXap = System.Windows.Controls.dll

Incoming Microsoft.Silverlight.Testing.dll file's hash = 357A677957F309AE85C3E5AEEDA43A32BCA23AD3

Attempting to open port at http://localhost:8887/

testPageUrlWithQueryString = http://localhost:8887/GetHtmlTestPage?

IRunner typeof(OnetimeRunner)

 

Starting Test Run: 08/02/2012 8:36:35

Listening on http://localhost:8887/

Loading XapHost file [MSTestApril2010]

Loading XapHost [C:\BlueBird\v1.1\Sprint2\External\CodePlex\StatLight\StatLight.Client.For.April2010.xap]

XapItems.FilesContainedWithinXap = AppManifest.xaml

XapItems.FilesContainedWithinXap = iSOFT.BlueBird.Interface.dll

XapItems.FilesContainedWithinXap = iSOFT.BlueBird.Localization.dll

XapItems.FilesContainedWithinXap = iSOFT.BlueBird.Localization.Test.dll

XapItems.FilesContainedWithinXap = Microsoft.Practices.Prism.dll

XapItems.FilesContainedWithinXap = Microsoft.Practices.ServiceLocation.dll

XapItems.FilesContainedWithinXap = Microsoft.Practices.Unity.Silverlight.dll

XapItems.FilesContainedWithinXap = Microsoft.Silverlight.Testing.dll

XapItems.FilesContainedWithinXap = Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll

XapItems.FilesContainedWithinXap = System.ComponentModel.DataAnnotations.dll

XapItems.FilesContainedWithinXap = System.Windows.Controls.Data.Input.dll

XapItems.FilesContainedWithinXap = System.Windows.Controls.dll

re-writing host xap with the following files

- already has file AppManifest.xaml

add - iSOFT.BlueBird.Interface.dll

updated AppManifest - iSOFT.BlueBird.Interface

add - iSOFT.BlueBird.Localization.dll

updated AppManifest - iSOFT.BlueBird.Localization

add - iSOFT.BlueBird.Localization.Test.dll

updated AppManifest - iSOFT.BlueBird.Localization.Test

add - Microsoft.Practices.Prism.dll

updated AppManifest - Microsoft.Practices.Prism

add - Microsoft.Practices.ServiceLocation.dll

updated AppManifest - Microsoft.Practices.ServiceLocation

add - Microsoft.Practices.Unity.Silverlight.dll

updated AppManifest - Microsoft.Practices.Unity.Silverlight

- already has file Microsoft.Silverlight.Testing.dll

- already has file Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll

add - System.ComponentModel.DataAnnotations.dll

updated AppManifest - System.ComponentModel.DataAnnotations

add - System.Windows.Controls.Data.Input.dll

updated AppManifest - System.Windows.Controls.Data.Input

- already has file System.Windows.Controls.dll

 

Coordinator
Feb 9, 2012 at 6:52 PM

I struggled to repeat your issue last night. I actually can't seem to get the happy path you report to work :(

I'll give you some options to try on your own to investigate.

One thing you can try is to get a copy of the actual Xap that is to be run. You can do this by the following steps.

  1. Run Statlight as you normally would but use the "--webserveronly" option.
  2. It will print a url you can use to paste in any browser.
  3. Say your url is http://localhost:8887/* you should be able to use the following URL to download a copy of the xap
    1. http://localhost:8887/StatLight.Client.Harness.xap
  4. Now look at the contents of that xap and inspect that it has what should/should not be in there.

At a high level StatLight takes your xap and copies in it's contents and modifies it's appmanifest.

Could you analyze this output and see if it's not doing something right?

Another option would be to create a small sample test project with a repro of your issue that I can use to digg into...

Also, what version of StatLight are you using?