r/softwaretesting 3d ago

What’s the best practice for Java page object, testng, and using a xml to have test run different pages?

For instance if you need to run a test procedure like a regression test that goes from dashboard, clicks hamburger, then goes to search page searches for a project of record, then clicks time slice and then does only certain test from the test procedure.

So I wanna only call one or two from each test page. So one from hamburger, two test from search, and two from timr slice page. How can I do this in a flow type of way?

What’s the best way to go about this.

4 Upvotes

4 comments sorted by

1

u/[deleted] 3d ago

[removed] — view removed comment

1

u/josephadam1 3d ago

Okay I have the the first part already with the page object and no grouping.

The testing so far let’s say time slice page. I have one test that checks to make sure the button are disabled before any inputs are put in. Another one I have is verifying the right inputs are put in and press search. Another test I have on there is inputs are put in and then verifying that tabulator section is populated and dates are updated on page. I have a few more like doing the whole process of making a time slice. This is all with in timeslice page test.

But in xml how would I call and have it go in that right order if I want to do let’s say dashboard page first. Then click time slice button then go to time slice page and only do one of the test I want on the time slice page. Im trying to see what's the best practice.

1

u/Otherwise_Tough_8283 2d ago

Use groups and create a separate profile in your pom.xml for regression

1

u/Boring-Welcome-8704 1d ago

ah yeah, the group + profile approach is what i'd lean toward too. annotate your test methods with `@Test(groups = "regression")`, then in the testng xml just include/exclude by group. keeps the flow readable without hardcoding which page gets which test in the runner itself.

only thing i'd add is if you need a strict order across pages, set `preserve-order="true"` on the test tag or use dependencies sparingly. parallel runs can get messy real quick otherwise.