0

Is possible to write language agnostic Robotium tests? For example, if you use a PreferenceActivity, by definition there is no way to get an R.id reference to it.

Is there a mechanism to support this? Or maybe a way for Robotium to read from the String file?

Thank you.

Stephan Tual
  • 2,617
  • 3
  • 27
  • 49

1 Answers1

2

You can read from the application-under-test's strings.xml file from a Robotium test by simply accessing the current activity:

String myString = getActivity().getString(R.string.my_string);
tomato
  • 3,373
  • 1
  • 25
  • 33
  • Ah, sorry, after trying this, it turns it doesn't work. I can't get to the R.string of the project I'm testing on, only the strings of the test project. – Stephan Tual Apr 11 '12 at 15:11
  • This does work I use it in almost every test I write, there must be something wrong with the setup of your test project. – Brian Yarger Apr 25 '12 at 23:36