How to setup TestNG for Android Instrumented test











up vote
0
down vote

favorite












In my application's build.gradle file, I already added




testImplementation group: 'org.testng', name: 'testng', version: '6.14.3'




in my dependencies and run sync. and I already commented out junit dependency. But still my instrumentedTest class is still using Junit, and I cannot import testng



in the same file, I also tried adding




test{useTestNG()}




but that gave me an error: method test is not found in gradle
I tried adding in the same file




apply plugin: 'java'




but that gave me another error saying: android application is not compatible



can i use testng as my test framework in my intrumentedtest class? looks like i can, I just can't set it right I guess.










share|improve this question


























    up vote
    0
    down vote

    favorite












    In my application's build.gradle file, I already added




    testImplementation group: 'org.testng', name: 'testng', version: '6.14.3'




    in my dependencies and run sync. and I already commented out junit dependency. But still my instrumentedTest class is still using Junit, and I cannot import testng



    in the same file, I also tried adding




    test{useTestNG()}




    but that gave me an error: method test is not found in gradle
    I tried adding in the same file




    apply plugin: 'java'




    but that gave me another error saying: android application is not compatible



    can i use testng as my test framework in my intrumentedtest class? looks like i can, I just can't set it right I guess.










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      In my application's build.gradle file, I already added




      testImplementation group: 'org.testng', name: 'testng', version: '6.14.3'




      in my dependencies and run sync. and I already commented out junit dependency. But still my instrumentedTest class is still using Junit, and I cannot import testng



      in the same file, I also tried adding




      test{useTestNG()}




      but that gave me an error: method test is not found in gradle
      I tried adding in the same file




      apply plugin: 'java'




      but that gave me another error saying: android application is not compatible



      can i use testng as my test framework in my intrumentedtest class? looks like i can, I just can't set it right I guess.










      share|improve this question













      In my application's build.gradle file, I already added




      testImplementation group: 'org.testng', name: 'testng', version: '6.14.3'




      in my dependencies and run sync. and I already commented out junit dependency. But still my instrumentedTest class is still using Junit, and I cannot import testng



      in the same file, I also tried adding




      test{useTestNG()}




      but that gave me an error: method test is not found in gradle
      I tried adding in the same file




      apply plugin: 'java'




      but that gave me another error saying: android application is not compatible



      can i use testng as my test framework in my intrumentedtest class? looks like i can, I just can't set it right I guess.







      android testing testng






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 5 at 1:49









      M.A

      63




      63





























          active

          oldest

          votes











          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',
          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
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53147318%2fhow-to-setup-testng-for-android-instrumented-test%23new-answer', 'question_page');
          }
          );

          Post as a guest





































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53147318%2fhow-to-setup-testng-for-android-instrumented-test%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          這個網誌中的熱門文章

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud

          Zucchini