I'm test driven

Search

  • Blogroll

  • Chi sono su LinkedIn

    License

    This blog is licensed under a Creative Commons License

    Test di accettazione con Abbot e Fitnesse(2)

    October 20th, 2006 by Enri

    Nel primo articolo dedicato ad Abbot ho spiegato come creare i jar per testare GUI Swing e GUI SWT con Abbot.Vediamo ora come agganciare Abbot a Fitnesse così da poter scrivere i nostri test di accettazione.

    Installare Fitnesse è davvero banale: scaricate lo zip dal sito di Fitnesse, unzip e siete pronti!

    Sfruttando il jar di esempio che abbiamo creato, testiamo che tutto sia installato correttamente e che Fitnesse, FIT e abbot comunichino correttamente, facendo eseguire da Fitnesse tutta la suite di unit test di abbot.swt.example.

    Questa la tabellina, davvero molto semplice, che definisce il nostro test:

    
                     |!-Test Installation-! |
                     |execute all unit tests|
                     |check|that number of failures is|0|
    

    Notare come il test sia espresso praticamente in linguaggio naturale “execute all unit tests [and] check that number of failures is zero“.

    L’implementazione di questo test è altrettanto banale:

    
             public class TestInstallation extends DoFixture {
                    TestResult tr = new TestResult();
                    public TestInstallation() {
                             tr = new TestResult();
                    }
    
                    public void executeAllUnitTests() {
                             CelsiusConverterTest.suite().run(tr);
                             CelsiusConverterFindingTest.suite().run(tr);
                    }
    
                    public int thatNumberOfFailuresIs() {
                             return tr.failureCount();
                    }
             }

    Se eseguite il test da fitnesse noterete come vengano eseguiti tutti gli unit test che pilotano la GUI e come venga verificato, per mezzo del metodo thatNumberOfFailuresIs(), che non vi siano stati failure.

    Posted in Test Driven Development (TDD), Acceptance Test |

    Leave a Comment

    Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.