Display Logic Testing
Contents |
Introduction
It is possible to check display logic of the application. QA team provides this feature to assert Display Logic in ERP.
Display logic types
There are three different kind of verifiable Display Logic groups:
- Visible/not visible fields.
- Enabled/not enabled fields.
- Expanded/not expanded sections.
Display logic test template
The following is a template that shows how a simple Display Logic test is created. Much more complex tests can be created from this simple template.
Testlink template
- Login with:
- "User name": QAAdmin
- "Password": QAAdmin
- Go to "Procurement management" || "Transactions" || "Purchase Order" window
- Click "Create a new record in form".
- Fill the following field:
- "Business Partner": Vendor A
- Click Save.
- Verify:
- "Organization" field is visible.
- "Transaction Document" field is visible.
- "Document No." field is visible.
- "Delivery Notes" field is not visible.
Automated test code template
Definition of the parameters
@Parameters public static Collection<Object[]> purchaseOrderDisplayLogic() { return Arrays.asList(new Object[][] { { new PurchaseOrderHeaderData.Builder().businessPartner( new BusinessPartnerSelectorData.Builder().value("VA").build()).build(), new PurchaseOrderHeaderDisplayLogic.Builder().organization(true).transactionDocument(true) .documentNo(true).deliveryNotes(false).build() } }); }
The following code creates the record and the next action asserts the Display Logic.
/** * Test the display logic of the PurchaseOrderHeader */ @Test public void PROa_createPurchaseOrderAndInvoice() { logger.info("** Start of test case PurchaseOrderHeaderDisplayLogic. **"); final PurchaseOrder purchaseOrder = new PurchaseOrder(mainPage).open(); purchaseOrder.create(purchaseOrderHeaderData); purchaseOrder.assertDisplayLogicVisible(purchaseOrderHeaderDisplayLogic); logger.info("** End of test PurchaseOrderHeaderDisplayLogic. **"); } }
This fragment of code shows how Display Logic is managed. (In this certain case, visibility).
/** * Assert display logic visibility * * @param visibleDisplayLogic * DataObject with the fields whose visibility has to be asserted. */ public void assertDisplayLogicVisible(DataObject visibleDisplayLogic) { for (final String key : visibleDisplayLogic.getDataFields().keySet()) { if (visibleDisplayLogic.getDataFields().get(key).equals(true)) { assertTrue(key + " is not visible", this.getForm().getSection(key).isVisible()); } else { assertFalse(key + " is visible. It shouldn't", this.getForm().getSection(key).isVisible()); } } }