ChanGan
ChanGan

Reputation: 4318

Getting Error on using DependsOnMethod in TestNG

    @Test(priority = 13, enabled = true, dependsOnMethods = {"POM_Test.PaymentsTest.C2410997_FilterPaymentByPending"})
        public void C2410964_PendingBalanceOnHomePageAndMakePaymentPage()
                throws IOException, InterruptedException, ATUTestRecorderException, APIException{
            ///Some Code here.      
        }


@Test(priority = 28, enabled = false)
    public void C2410997_FilterPaymentByPending()
            throws IOException, InterruptedException, ATUTestRecorderException, APIException, AWTException, ParseException {
        //Some dependency is here. 


    }

Getting following error, POM_Test.ATransactionTest2.C2410964_PendingBalanceOnHomePageAndMakePaymentPage() is depending on method public void POM_Test.PaymentsTest.C2410997_FilterPaymentByPending() throws java.io.IOException,java.lang.InterruptedException,atu.testrecorder.exceptions.ATUTestRecorderException,com.testrail.connection.APIException,java.awt.AWTException,java.text.ParseException, which is not annotated with @Test or not included

How to resolve this?

Upvotes: 0

Views: 1207

Answers (1)

Kshetra Mohan Prusty
Kshetra Mohan Prusty

Reputation: 301

There are two issues in the given code.

C2410964_PendingBalanceOnHomePageAndMakePaymentPage() depends on C2410997_FilterPaymentByPending() but

  1. C2410964_PendingBalanceOnHomePageAndMakePaymentPage() has higher priority.
  2. C2410997_FilterPaymentByPending() has attribute enabled = false

To make things work, please

  1. don't mix using priority and dependsOnMethods. Preferred way is dependsOnMethods.
  2. set the enabled = true for test C2410997_FilterPaymentByPending.

Upvotes: 1

Related Questions