When you have large number test classes and you want to combine then and manage them the you can create a Test Suit. Execution of test case means execution of all test classes inside the Suite as per specified order.
The following example gives outline of Suit class. It contains 3 test classes FirstTestClass and SecondTestClass. You can add as many test classes as you want.
import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) @SuiteClasses({ FirstTestClass.class, SecondTestClass.class, ThirdTestClass.class }) public class AllTests { }
Test Execution Order within Class - Junit Assumes that the test cases written inside class and independent and can be executed randomly. But in case if you have to define the flow of Junit test cases within a class then there is annotations @FixMethodOrder which you can use. Consider below example with Class MyTests with Test Cases BTest(), ATest() and CTest() and we can define the order of execution as per method name ascending order alphabetically.
In following example the order of execution will be -
1. ATest()
2. BTest()
3. CTest()
@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class MyTests { @Test public void BTest() { } @Test public void ATest() { } @Test public void CTest() { } }
Very nice blog and worthy to go through it for freshers to gain some knowledge about this domain.
ReplyDeleteAppium Training in Coimbatore
Appium Courcse in Coimbatore
Appium Coaching in Coimbatore
Devops Training in Bangalore
Best Devops Training in Bangalore
Devops Training Institutes in Bangalore
The blog is really superb, I like it. I got more techniques and surely this post will be helpful for my growth. continue the great work and Please updates
ReplyDeleteExcel Training in Chennai
Advanced Excel Training in Chennai
Unix Training in Chennai
corporate training in chennai
Tableau Training in Chennai
Oracle Training in Chennai
Primavera Training in Chennai
Power BI Training in Chennai
Excel Training in Chennai
Advanced Excel Training in Chennai
suits season 9 full episodes watch online
ReplyDeleteI got wonderful information from this blog. Thanks for sharing this post. it becomes easy to read and understand the information.
ReplyDeletePHP Training in Chennai
PHP Training in Bangalore
PHP Course in Bangalore
PHP Training Institute in Bangalore
PHP Classes in Bangalore
Best PHP Training Institute in Bangalore
AWS Training in Bangalore
Data Science Courses in Bangalore
DevOps Training in Bangalore
DOT NET Training in Bangalore
I was very pleased to find this site. I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.
ReplyDeleteData Science Course
I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
ReplyDeleteBest Data Science Courses in Bangalore
Two full thumbs up for this magnificant article of yours. I've really enjoyed reading this article today and I think this might be one of the best article that I've read yet. Please, keep this work going on in the same quality.
ReplyDeleteData Science Training
really a good information oracle training in chennai
ReplyDelete