Home > Mobile >  How can I use TestNG's @Tag annotation? I am unable to find any documentation anywhere. (Smoke
How can I use TestNG's @Tag annotation? I am unable to find any documentation anywhere. (Smoke

Time:08-15

I am really new to all this stuff. I have to identify a subset of tests from our testing suite to create some smoke tests.

I was able to find some documentation on how to use the @Tag annotation for JUnit 5, and I saw that there is also a @Tag annotation for TestNG 6.x.x, but I am literally unable to find any examples online or any documentation saying how to use it.

I am aware of the Grouping feature on JUnit and TestNG -- is this typically the way that smoke testing is done? By grouping tests?

I spoke with the sr engineer on my team and he told me to look into the @Tag to use it as a filtering mechanism for smoke testing so I am kind of stuck on this.

Thanks

CodePudding user response:

Even though it looks like a duplicate of this question (it's worth checking out as well), I wanted to answer it to provide more sources showing that the "tagging" mechanism is in fact implemented as "test groups" in TestNG. @Tag annotation is a JUnit annotation and serves a similar purpose. You can read the articles below to see it in code:

TestNG documentation describes the grouping mechanism as well. I suppose that the senior engineer you've asked thought about a mechanism of tagging/grouping, which is conceptually the same thing, but is just named different in different testing tools.

To sum up: JUnit @Tag annotation is the same mechanism as TestNG groups attribute of @Test annotation.

  • Related