I wrote some tests that use XML files. I have two project one with code, the second with tests. I would like to store this XML files (they contain some data used during the tests) in the test project. But it is not possible because it seems that only files from src project are loaded to a device. Does anyone know the way to solve this problem ?
One way to organize elements could be to have a folder for each application you are testing and then create a subfolder under there for each page of the application. Elements can be easily moved to different folders by dragging and dropping them. You can also move them to another folder by using the more menu.
Upload File using XPath - This is an action that requires the XPath of the input element: //input[@type = 'file']. The second parameter is of course, the local path to the file you want to upload. Upload file to input element - This is an element action and you need to use it on the input element.
. test files are used for executing Unit tests for your application. Steps are that you write a . test file with a class that extends DrupalWebTestCase (or DrupalUnitTestCase). In this class you add a static function getInfo() that returns an array with information about the test.
Suppose you got assets folder in both android project and test project, and you put the XML file in the assets folder. in your test code under test project, this will load xml from the android project assets folder:
getInstrumentation().getTargetContext().getResources().getAssets().open(testFile);
This will load xml from the test project assets folder:
getInstrumentation().getContext().getResources().getAssets().open(testFile);
Make sure your TestCase class extends android.test.InstrumentationTestCase
instead of android.test.AndroidTestCase
to access this.getInstrumentation()
method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With