Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using a resource folder in test project for test string data

I wanted to use a resource folder in my test project with Android Studio to store internationalized strings that I'll only use in my UI tests.

But as I'm able to create the /app/src/androidTest/res folder, I can't create a resource folder such as "values" in it.

Android Studio says that this folder already exists. It exists, but in my main project under /app/src/main/res.

So can I create resources available only for my test project, and how, or I'am completely wrong and the reason that I can't do it is that I mustn't do it ?

Thanks.

like image 558
Nicolas Massart Avatar asked Nov 26 '14 09:11

Nicolas Massart


People also ask

What is the path of resource folder in Java?

The resources folder belongs to the maven project structure where we place the configuration and data files related to the application. The location of the folder is “ src/main/resources “.

What is test folder in Android Studio?

Local tests location By default, the source files for local unit tests are placed in module-name/src/test/ . This directory already exists when you create a new project using Android Studio.


1 Answers

As mentioned in this answer, you are probably using the wrong package in the import statement.

import com.your.package.test.R;
like image 157
Vedant Agarwala Avatar answered Sep 17 '22 20:09

Vedant Agarwala