We are implementing a web test automation project for some intranet applications.
To easy the writing of each test, we are designing a Java DSL that can be implemented using different adapters (we've chosen Sahi and Selenium/WebDriver so far, as we want to measure them side by side in terms of performance, readability, maintainability, etc.).
We've identified two types of operations in the DSL:
1) Primitive: its implementation will surely have to deal with HTML/Selenium/Sahi/etc specifics. Example: (using Sahi web driver)
public void insertProjectRecord(String projectName) {
b.link("Create new project").click();
b.textbox("ctl00$ProjectForm$Name").setValue(projectName);
b.span("Insert").click();
}
2) Non-Primitive: an operation worth including in our DSL for reusability purposes, although that can be built using primitives. Example:
public void createFormulation(String projectName, String rteDummyText) {
goToAddProjectPage();
insertProjectRecord(projectName);
switchToEditModeForFirstAvailableRecord();
editBeneficiaryCountries();
editAcronyms(rteDummyText);
saveSectionChanges();
}
Question: we initially started with an interface with only primitive operations, but later we changed it to an abstract class in order to include the non-primitive methods (which a specific implementations are allowed to override, if needed). However, it doesn't feel "OK" to mix primitives and non-primitives, and the list of methods will certainly became very long.
What other approach would you suggest and/or explore?