Customize Annotations in TestNG
Mayur Sapre
Senior Consultant | Selenium | Java | Cucumber | TestNG | Maven | Jenkins | Github | RestAssured | Docker | Ansible | JMeter | ZAP | ElasticSearch | Kibana | Reportportal | GCP
As everyone knows, we are using TestNG annotations like @Test,@Beforetest etc. on daily basis.But are you aware in the same way we can create our customised annotations as per our requirement and do some cool stuffs like
So lets see how we can achieve same in our automation framework:
Steps:
2. As per your requirement,Put automation code inside the Annotation.
3. Put this annotation inside you test method
4. Now integrate this annotation methods like author() and category() with your Reporting code so that when Extent report will generate accordingly
5. Write your logic to get author and category from annotation and use it in onTestStart method.
6. Now trigger the automation
Hurray..We can see Author and Category tag inside the Extent Report.We can implement same using Custom Annotation.
Happy Learning..!!
Mobile & Web Automation Infrastructure Engineer
8 个月Thanks for sharing
SQA at Baker Hughes|Framework Development|Selenium Webdriver|Core Java|Appium|BDD|RPA|STB|Cucumber|REST API|Test complete|TestNG|JUnit|Agile Methodology
3 年Thank you for sharing ??
Integration Engineer | Mulesoft | Springboot | Apigee | Middleware
3 年Thanks for posting
Selenide Committer | Seasoned Test Automation & Devops Lead and Manager | Problem Solver | Tech Youtuber | Appium Conf 2024 Speaker
3 年Glad to see my work. If someone is interested in video version,? https://youtu.be/8zD2ASUdLDg