testng


My TestNG.xml leads to execution of #BeforeTest method even if there are no tests eligible for execution in that class


My TestNG.xml comprises of set of this kind of tag:-
<test name="Order">
<groups>
<run>
<include name="Smoke" />
<exclude name="Regression"></exclude>
</run>
</groups>
<classes>
<class name="com.test.myproject.class1"/>
</classes>
</test>
What is happening is Some of the classes only have Regression group names and no Smoke name. So, I was expecting that nothing of those classes should be executed. But, I can see the BeforeTest and AfterTest of these classes getting executed even though none of the tests are eligible to be executed.
Any tip on how can I not allow BeforeTest and AfterTest from getting executed?
I am using TestNG 6.9.9
Here is how my java testng code looks:-
#Listeners(AUTEventListener.class)
public class MyTest extends BaseTestCase {
#Parameters({ "browserName", "gridHubUrl", "gridNodeUrl" })
#BeforeTest(alwaysRun = true)
public void testInit(String browserName, String gridHubUrl, String gridNodeUrl) throws Exception {
//Before Test logic is here
}
#BeforeMethod(alwaysRun = true)
public void openBrowser() {
//BeforeMethod logic is here
}
#Test(priority = 1, groups={"Regression"}, description = "Testcase to Verify that a claimant is able to file a non cargo claim")
#TestInfo(testcaseIds={"TC-12344"})
public void TC_12344_MyTestMethod() throws Exception
{
// Test is here
}

Related Links

Android app does not launch in Appium
TestNG :my project can't run correctly in command line,but it can work well in IDE
How to run parallel suites programmatically with Testng?
TestNG dependsOnGroup and group-by-instances error
TestNG: get test method for configuration method?
First TestNG Code is not working
Getting error “The content of element type ”classes“ must match ”(class*,parameter*)“.” while configuring testng.xml file
How to group multiple testNG files into one testng file
Facing issue with parallel test execution in TestNG when using #DataProvider with TestNG XML
Test Factory to call another Test Factory
Handling failed testcases using testng
Maven-surefire. How to adjust the level of detail of the report?
Execute a task in TestNG when testng-result.xml file is generated
re-runned failed test cases are comming with status = 'Skipped' in the testng report
Why is TestNG Randomly Executing my Tests in parrallel?
Exclude Test in testNg

Categories

HOME
netsuite
keras
fft
syntax
jsp-tags
at-command
sqlite-net-extensions
setup-deployment
google-oauth
sharepoint-designer
binary-tree
azure-media-services
synchronization
elasticsearch-hadoop
user-input
reveal.js
modx-revolution
vaadin7
ghc
http-status-code-504
oxyplot
jprofiler
lldb
amazonsellercentral
sylius
bootstrap-tour
tooltipster
airconsole
titanium-mobile
pdb
google-sites-2016
column-family
pim
android-nestedscrollview
catalog
nssegmentedcontrol
webix-treetable
webdriver-manager
opshub
grid.mvc
dynamic-reports
ibpy
midl
mime
netcdf4
checkboxlist
osx-mavericks
react-scripts
prolog-setof
jlink
domain-model
powercli
nstextview
cudafy.net
angular-strap
setuptools
instant
disque
nsviewcontroller
pagerank
qtableview
execute
lib.web.mvc
computer-algebra-systems
coveralls
0xdbe
mmc
oberon
preferences
undefined-reference
mysqltuner
oam
google-cloud-save
rabl
robotics-studio
wsdl-2.0
pvrtc
sublist
bitsharp
osql
bigcouch
work-stealing
gnu-prolog
libc++
nsobject
external-accessory
mysql-error-1005
sortable-tables
firefox-5
nintendo-ds
memory-size
privilege
spec#
mediarss

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App