Careeroza
Real World Example
Hybrid Tests at an Insurance Portal
An insurance client of a service company had a 4-hour UI suite. Every test created a policy through 6 UI screens before checking its own screen. The team moved the setup to the policy API and kept only the screen under test in the browser.
@Test(groups = "regression")
public void renewalPageShowsPremiumWithNcb() {
// Arrange via API: a motor policy expiring in 10 days with 2 claim-free years
String policyNo = policyApi.createMotorPolicy(Map.of(
"vehicle", "KA01AB1234", "idv", 650000, "claimFreeYears", 2,
"expiry", LocalDate.of(2026, 3, 24).toString()));
// Act + Assert in the UI: only the renewal screen
RenewalPage renewal = new LoginPage(driver).open()
.loginViaApiSession(agentUser)
.openRenewal(policyNo);
Assert.assertEquals(renewal.ncbPercent(), "25%");
Assert.assertEquals(renewal.premium(), "₹11,842");
}Example
mvn test -Dgroups=regressionExample output
[INFO] Tests run: 186, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 41:07 min [INFO] BUILD SUCCESS
Result
| Before | After | |
|---|---|---|
| Suite time | 4 h 10 min | 41 min (same 186 tests) |
| Flaky failures per night | 12–15 | 2–3 |
| Time to add a renewal test | half a day | one hour |