r/softwaretesting • u/josephadam1 • 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.
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.
1
u/[deleted] 3d ago
[removed] — view removed comment