mercredi 28 janvier 2015

what is the name of this design (anti-)pattern?

Recently I took a project which was initially a thick client Java application written in Swing. Later they got a requirement to support http requests. So they implemented a code like this:



public void handleRequest(...) {
if(contextPath.equals("purchase-product")) {
getMainPanel().getPurchasePanelButton().doClick();
getMainPanel().getPurchasePanel().selectProductById(productId);
if(getMainPanel().getPurchasePanel().getPurchaseButton().isEnabled()) {
getMainPanel().getPurchasePanel().getPurchaseButton().doClick();
...
}
}
....
}


My first thought was WTF. Weren't they familiar with MVC pattern?


But then I was thinking they implemented the code like this to be able to do Swing GUI tests via http requests using JMeter or SoapUI instead of complicated GUI frameworks like Squish.


My question is do people use similar technique to simplify their component tests? What is the name of this (anti-) pattern ?


Aucun commentaire:

Enregistrer un commentaire