How to run @Test method multiple times if set dependent for more than one method

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to run @Test method multiple times if set dependent for more than one method

Rajiv Sharma
public class DepondsOnMain {


@Test()
public void funDepondsOnMain1() {
System.out.println("Main 1");

}

@Test(dependsOnMethods = "funDepondsOnMain1", priority = 1)
public void funDepondsOnMain2() {
System.out.println("Main 2");
}

@Test(dependsOnMethods = "funDepondsOnMain1", priority = 2)
public void funDepondsOnMain3() {
System.out.println("Main 3");
}

}

-----------------------------------
Output is - :

Main 1
Main 2
Main 3
-----------------------------------
But it should be -:
Main 1
Main 2
Main 1
Main 3

Thanks,
Rajiv

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to run @Test method multiple times if set dependent for more than one method

Krishnan Mahadevan

Rajiv,

 

What you are asking for is not possible. What exactly are you trying to solve ? Can you please help elaborate your use case ?

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Rajiv Sharma <[hidden email]>
Reply-To: <[hidden email]>
Date: Monday, January 22, 2018 at 2:33 AM
To: testng-users <[hidden email]>
Subject: [testng-users] How to run @Test method multiple times if set dependent for more than one method

 

public class DepondsOnMain {

 

 

                @Test()

                public void funDepondsOnMain1() {

                                System.out.println("Main 1");

 

                }

 

                @Test(dependsOnMethods = "funDepondsOnMain1", priority = 1)

                public void funDepondsOnMain2() {

                                System.out.println("Main 2");

                }

 

                @Test(dependsOnMethods = "funDepondsOnMain1", priority = 2)

                public void funDepondsOnMain3() {

                                System.out.println("Main 3");

                }

               

               

 

}

 

-----------------------------------

Output is - :

 

Main 1

Main 2

Main 3

-----------------------------------

But it should be -:

Main 1

Main 2

Main 1

Main 3

 

Thanks,

Rajiv

 

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.