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.
- 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.
Author: Amod Mahajan
My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning