Xamarin UITest, Possible to use AppResource functionality in tests?

Viewed 127

I'd like to check the text of a label in one of my tests (in this case the text will be "pending", "verified" etc), however our app is localised and uses AppResources, so the text will be different in other languages.

So I don't want to hard code the string to look for say "pending".

Just wondering if it's possible to include (some kind of link to the files) the resx files in the main project.

I'm also going to need someway of using the correct language / resx file.

1 Answers

Don't know if this is still relevant, assuming you have resx files for different localizations of the application and you want to access the German resx file what you need to do is to add the following attribute at the top of the test

[Test]
[SetUICulture("de-DE")]
public void MyTest()
{
// My test that read from resx file
}
Related