In last post, we have seen available annotation in TestNG.
Beginner and experienced professionals are always confused in understanding order of execution of annotated methods and usage. In this post, I will try to help you in understanding this concept better. I will recommend to read this post first which explains hierarchy of testng xml.
All annotations provided by TestNG is directly related to testng.xml tags. TestNG XML has four major tags:
So, TestNG provides you annotations at these levels which can be used for prerequisite and post requisites setup as a whole or individual.
[table id=2 /]
- A testng xml can have single <suite> tag.
- You can have multiple <test> tags in a <suite> tag.
- You can have single <classes> tag in a <test> tag.
- You can have multiple <class> tag inside a <classes> tag.
- You can have multiple test method (@Test annotated) names inside <methods> tag inside a <class> tag.
Below xml explains when TestNG annotated methods will be called:
Hope, above xml will help you in understand calling of TestNG annotated methods.
More about TestNG in upcoming posts. Stay tuned.
If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.