Hello sir - I'm struggling with the below problem while practicing the TestNG Datadriven Framework. Please help ASAP as this is barring me going forward.
Attached herewith is my project code.
Background of the problem: In Test 1, I added all three methods from the class BookingSearch, and only one method out of two, from the class PaymentManager. There's only one method in the class CustomerCommunications, I didn't add it to the List<XmlInclude> inclMethods. With this setup, I have five methods added to my Test 1.
When only Test 1 is added to the suite, it runs as expected (with only the methods which I add to inclMethods). When Test 2 is added with only the desired methods, below problems arise (In Test 2, I added all three methods from the class BookingSearch. I didn't add the class PaymentManager at all (because I don't require any method from this class in my Test 2). I didn't add any method from the class CustomerCommunications to inclMethods (I added the class though). With this setup, I have four methods added to my Test 2):
Prob 1: When the suite is executed, the methods added in Test 1 (but not added in Test 2) also get executed. I feel the reason behind this is as below:
When Test 1 was added to inclMethods, that time all the methods required in Test 1 (but NOT required in Test 2) were already added to inclMethods.
Therefore, I decided to clear the inclMethods before I begin writing Test 2.
Prob 2: If I clear the inclMethods before I begin writing Test2, the output shows that ALL the methods from ALL THE CLASSES are executed, including the methods which were not included EVEN IN TEST1.
Here's the screenshot explaining the issue.
Here's my code attached.
InstructorAshish Replied on 03/09/2021
Sorry for late reply
Is it working now
You can also debug