@Config constants parameter could not be found in Robolectric
I am trying to write a Robolectric test. I was following few tutorials where they seem to be using
@RunWith(RobolectricTestRunner::class)
@Config(constants = BuildConfig::class)
to setup the test, but in my case The parameter constants does not seem to resolve.
My Robolectric dependency looks like this:
testImplementation "org.robolectric:robolectric:4.0.2"
android android-testing robolectric android-junit
add a comment |
I am trying to write a Robolectric test. I was following few tutorials where they seem to be using
@RunWith(RobolectricTestRunner::class)
@Config(constants = BuildConfig::class)
to setup the test, but in my case The parameter constants does not seem to resolve.
My Robolectric dependency looks like this:
testImplementation "org.robolectric:robolectric:4.0.2"
android android-testing robolectric android-junit
have you resolved your issue? I'm facing the same problem.
– taurelas
Dec 20 '18 at 13:26
Not yet, I haven't been looking into it lately
– erluxman
Dec 20 '18 at 15:29
add a comment |
I am trying to write a Robolectric test. I was following few tutorials where they seem to be using
@RunWith(RobolectricTestRunner::class)
@Config(constants = BuildConfig::class)
to setup the test, but in my case The parameter constants does not seem to resolve.
My Robolectric dependency looks like this:
testImplementation "org.robolectric:robolectric:4.0.2"
android android-testing robolectric android-junit
I am trying to write a Robolectric test. I was following few tutorials where they seem to be using
@RunWith(RobolectricTestRunner::class)
@Config(constants = BuildConfig::class)
to setup the test, but in my case The parameter constants does not seem to resolve.
My Robolectric dependency looks like this:
testImplementation "org.robolectric:robolectric:4.0.2"
android android-testing robolectric android-junit
android android-testing robolectric android-junit
edited Jan 14 at 20:43
halfer
14.6k758114
14.6k758114
asked Nov 26 '18 at 3:13
erluxmanerluxman
5,88534270
5,88534270
have you resolved your issue? I'm facing the same problem.
– taurelas
Dec 20 '18 at 13:26
Not yet, I haven't been looking into it lately
– erluxman
Dec 20 '18 at 15:29
add a comment |
have you resolved your issue? I'm facing the same problem.
– taurelas
Dec 20 '18 at 13:26
Not yet, I haven't been looking into it lately
– erluxman
Dec 20 '18 at 15:29
have you resolved your issue? I'm facing the same problem.
– taurelas
Dec 20 '18 at 13:26
have you resolved your issue? I'm facing the same problem.
– taurelas
Dec 20 '18 at 13:26
Not yet, I haven't been looking into it lately
– erluxman
Dec 20 '18 at 15:29
Not yet, I haven't been looking into it lately
– erluxman
Dec 20 '18 at 15:29
add a comment |
2 Answers
2
active
oldest
votes
constants
parameter is now deprecated see the doc :
constants
Deprecated.
If you are using at least Android Studio 3.0 alpha 5 please migrate to the
preferred way to configure builds for Gradle with AGP3.0
http://robolectric.org/getting-started/
The proper way to set up Robolectric per the documentation is :
android {
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
dependencies {
testImplementation 'org.robolectric:robolectric:4.1'
}
add a comment |
Robolectric is for unit
test, not for androidTest
, so please confirm that your test case is under src/test
, NOT under src/androidTest
.
Yes is inside src/test its my reference Project/app/src/test/java/com/erluxman/productive/MainActivityRoboTest.kt
– erluxman
Nov 26 '18 at 3:23
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53474336%2fconfig-constants-parameter-could-not-be-found-in-robolectric%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
constants
parameter is now deprecated see the doc :
constants
Deprecated.
If you are using at least Android Studio 3.0 alpha 5 please migrate to the
preferred way to configure builds for Gradle with AGP3.0
http://robolectric.org/getting-started/
The proper way to set up Robolectric per the documentation is :
android {
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
dependencies {
testImplementation 'org.robolectric:robolectric:4.1'
}
add a comment |
constants
parameter is now deprecated see the doc :
constants
Deprecated.
If you are using at least Android Studio 3.0 alpha 5 please migrate to the
preferred way to configure builds for Gradle with AGP3.0
http://robolectric.org/getting-started/
The proper way to set up Robolectric per the documentation is :
android {
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
dependencies {
testImplementation 'org.robolectric:robolectric:4.1'
}
add a comment |
constants
parameter is now deprecated see the doc :
constants
Deprecated.
If you are using at least Android Studio 3.0 alpha 5 please migrate to the
preferred way to configure builds for Gradle with AGP3.0
http://robolectric.org/getting-started/
The proper way to set up Robolectric per the documentation is :
android {
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
dependencies {
testImplementation 'org.robolectric:robolectric:4.1'
}
constants
parameter is now deprecated see the doc :
constants
Deprecated.
If you are using at least Android Studio 3.0 alpha 5 please migrate to the
preferred way to configure builds for Gradle with AGP3.0
http://robolectric.org/getting-started/
The proper way to set up Robolectric per the documentation is :
android {
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
dependencies {
testImplementation 'org.robolectric:robolectric:4.1'
}
answered Dec 28 '18 at 15:16
Guerneen4Guerneen4
300614
300614
add a comment |
add a comment |
Robolectric is for unit
test, not for androidTest
, so please confirm that your test case is under src/test
, NOT under src/androidTest
.
Yes is inside src/test its my reference Project/app/src/test/java/com/erluxman/productive/MainActivityRoboTest.kt
– erluxman
Nov 26 '18 at 3:23
add a comment |
Robolectric is for unit
test, not for androidTest
, so please confirm that your test case is under src/test
, NOT under src/androidTest
.
Yes is inside src/test its my reference Project/app/src/test/java/com/erluxman/productive/MainActivityRoboTest.kt
– erluxman
Nov 26 '18 at 3:23
add a comment |
Robolectric is for unit
test, not for androidTest
, so please confirm that your test case is under src/test
, NOT under src/androidTest
.
Robolectric is for unit
test, not for androidTest
, so please confirm that your test case is under src/test
, NOT under src/androidTest
.
answered Nov 26 '18 at 3:20
shizhenshizhen
3,69741234
3,69741234
Yes is inside src/test its my reference Project/app/src/test/java/com/erluxman/productive/MainActivityRoboTest.kt
– erluxman
Nov 26 '18 at 3:23
add a comment |
Yes is inside src/test its my reference Project/app/src/test/java/com/erluxman/productive/MainActivityRoboTest.kt
– erluxman
Nov 26 '18 at 3:23
Yes is inside src/test its my reference Project/app/src/test/java/com/erluxman/productive/MainActivityRoboTest.kt
– erluxman
Nov 26 '18 at 3:23
Yes is inside src/test its my reference Project/app/src/test/java/com/erluxman/productive/MainActivityRoboTest.kt
– erluxman
Nov 26 '18 at 3:23
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53474336%2fconfig-constants-parameter-could-not-be-found-in-robolectric%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
have you resolved your issue? I'm facing the same problem.
– taurelas
Dec 20 '18 at 13:26
Not yet, I haven't been looking into it lately
– erluxman
Dec 20 '18 at 15:29