lundi 16 mai 2016

Simplifying multiple boolean checks into a single one

In one of our tests, we have the following set of expectations:

expect(headerPage.dashboard.isDisplayed()).toBe(true);
expect(headerPage.queue.isDisplayed()).toBe(true);
expect(headerPage.claimSearch.isDisplayed()).toBe(true);
expect(headerPage.claim.isDisplayed()).toBe(true);
expect(headerPage.case.isDisplayed()).toBe(true);
expect(headerPage.calendar.isDisplayed()).toBe(true);

On one hand, having multiple simple expectations provide a more precise and understandable feedback, but, on another, this looks like it violates the DRY principle and the "one expectation per test" commonly acceptable guideline.

Is there a way to convert/simplify it to a single expect?


headerPage is a Page Object, dashboard and other page object fields are navigation links.

Aucun commentaire:

Enregistrer un commentaire