Reputation: 775
I would like to call mehtods in my testing before they actually happen
@BeforeMethod
public void setUpMethod() throws Exception {
}
EXCEPT for a given test method
for example, I want to test delete() before it is applied sysmetaically at the beginning of the test methods
I would like thus to make something like:
@BeforeMethod("all methods except delete()")
public void setUpMethod() throws Exception {
delete();
}
Upvotes: 0
Views: 1436
Reputation: 8531
One way can be to put delete() in a group say @Test(group="excludeBef")
Now in your testng xml, setup two tests, one in which you just include this group, in which case it won't run the beforeMethod for this group and a separate test which excludes this group
<test verbose="2" name="Default test" >
<groups>
<run>
<include name="excludeBef"></include>
</run>
</groups>
<classes..go here>
</test>
<test>
<groups> - exclude the group </group>
<classes ..go here>
Upvotes: 1