Re: [TFUI] The TFUI Principles
Andrew McDonagh <andrew.mcdonagh-t9JT+EbDRNpWk0Htik3J/[email protected]>
| Newsgroups | gmane.comp.programming.test-first-user-interfaces |
|---|---|
| Message-ID | <[email protected]> |
Phlip wrote:
>Thomas Eyde wrote:
>
>
>
>>I found these principles so good that I just had to add them here:
>>http://c2.com/cgi/wiki?TestFirstUserInterfacesPrinciples
>>
>>
>
>That's righteous! I used the page to add a paragraph on behalf of Chris Hanson:
>
> "Many of those ideas seem too obvious. Your GuiToolkit might
> spontaneously solve one of those problems for you"
>
>At least I hope that's what's happening. Otherwise Cocoa might be too
>far over my head...
>
>May I ask if anyone has added a 'reveal()' method to their test cases?
>
>
>
I 'think' we are doing almost the same as your (v good essay) talks
about. We used the Humble Dialog approach and adapted it for any gui
component, not just dialogs.
We already use the MVC pattern and applied the humbleness to the Views,
which results in
Controller
Model SmartView ----> RealViewInterface
|
RealViewImpl
Using either a factory method or an abstract Factory to create the
actual RealView object. our tests can create mock real views to simulate
user interactions.
We haven't currently had an urgent need to use a reveal() mechanism, as
the development stations are setup to run the app as easy as possible.
Its not quite one-button-testing but its close. However, on occasion we
may forget to setup the factory which creates realviews and so will see
the gui component if its possible. :-)
Like your essay, our SmartView <--> RealView interface does not contain
any mention of the gui toolkit library or its contents, or at least as
little as is reasonable as in the example below.
This means the actual implementations of the RealViewInterface have very
small amounts of code to convert the toolkit messages into our own.
An example (in Java).
public interface OptionDialogRealView {
public int showDialog(String message, String title, Object[]
buttonTexts, Object initialValue);
}
public class OptionDialogRealViewImpl implements OptionDialogRealView {
public int showDialog(String message, String title, Object[]
buttonNames, Object initialValue) {
Component frame = (TopPaneView)TopPane.getInstance().getView(0);
return JOptionPane.showOptionDialog(frame, message, title,
JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, buttonNames,
initialValue);
}
}
public class MockOptionDialogRealViewImpl implements OptionDialogRealView {
public int showDialog(String message, String title, Object[]
buttonTexts, Object defaultButton) {
m_message = message;
m_title = title;
m_defaultButton = (String) defaultButton;
m_wasShown = true;
m_shownCount++;
return m_buttonPressed;
}
public int getShownCount() { return m_shownCount; }
public String getMessage() { return m_message; }
public String getTitle() { return m_title; }
public String getDefaultButton() { return m_defaultButton; }
public boolean wasShown() { return m_wasShown; }
public int getButtonPressed() { return m_buttonPressed; }
public void simulateButtonPressed(int buttonIndex) {
m_buttonPressed = buttonIndex;
}
public void simulateCloseDialog() {
m_wasShown = false;
}
...
}
To unsubscribe, email:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/TestFirstUserInterfaces/
<*> To unsubscribe from this group, send an email to:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/