Inconsistent relative file paths for unit tests triggered from commandline Gradle and from Android Studio

67 views
Skip to first unread message

Farley Lai

unread,
Oct 9, 2014, 9:48:36 PM10/9/14
to adt...@googlegroups.com
Hi, all,

Version of Android Studio (available in the about box): 0.8.8
OS version: Mac OSX 10.9.4
Java JRE/JDK version: 8


A unit test in a subproject accesses a file through a relative path. If triggered from the Android Studio interface menu (right click and run the test), the path is relative to the root project. However, if triggered by the Gradle in the command line, it is relative to the subproject.

Though it's easier to run the unit tests from the interface, sometime we want the unit tests to be scheduled to run from command line Gradle. This inconsistency bugs the team once in a while. We would consider the AS should behave consistently as Gradle runs the tasks from the command line, that is, relative to the subproject path.

Any idea for a quick fix?
Thanks.

Jake Wharton

unread,
Oct 10, 2014, 1:14:51 AM10/10/14
to adt...@googlegroups.com
cmd+shit+a -> "edit configurations", default -> junit, working directory -> $MODULE_DIR$




--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Farley Lai

unread,
Oct 17, 2014, 10:23:25 PM10/17/14
to adt...@googlegroups.com
Thank you, sir. That works. BTW, where can I find the reference about those pre-defined variables?

Jake Wharton

unread,
Oct 17, 2014, 10:37:56 PM10/17/14
to adt...@googlegroups.com
There's only two that I know of, and both are listed when you click the little icon to the right of that field. I think it's MODULE_DIR and PROJECT_DIR.
Reply all
Reply to author
Forward
0 new messages