Loading ...
Sorry, an error occurred while loading the content.

Re: [XP] Re: More on Unit Testing

Expand Messages
  • Donald Murray, P.Eng.
    Hi, ... Maybe the Humble Dialog pattern would allow you to test your Delete function.See the original Michael Feathers paper here:
    Message 1 of 11 , Mar 4, 2010
    • 0 Attachment
      Hi,

      On Wed, Mar 3, 2010 at 12:04 PM, Kim Gräsman <kim.grasman@...> wrote:

      > Hi Bryn,
      >
      > On Wed, Mar 3, 2010 at 17:42, nyrb2 <ua485@...> wrote:
      > >
      > > My problem is that I'm working in C++ in Visaul Studio, using a unit test
      > library called cppunit. I've looked but haven't found any equivalent
      > library like WindowLicker, meaning that I am going to have to write all the
      > GUI communication myself. I've been doing that up till now, but it's
      > extremely onerous (using windows calls and handles to find the right
      > controls etc.)
      > >
      > > Do you (or anyone else here) know of any library I can hook into cppunit
      > to do this processing automatically?
      >
      > White [1] claims to be able to handle regular Win32 controls. I
      > haven't tried it, so I can't speak for it more than this.
      >
      > It won't plug into CppUnit (unless you invest some time and energy
      > into C++/CLI for bridging between the two, but I don't think that's
      > worth the effort), but you can build a parallel .NET test suite in C#
      > or VB, to drive your UI.
      >
      > FWIW,
      > - Kim
      >
      > [1] http://www.codeplex.com/white
      >
      >
      >
      Maybe the Humble Dialog pattern would allow you to test your Delete
      function.See the original Michael Feathers paper here:
      http://www.objectmentor.com/resources/articles/TheHumbleDialogBox.pdf

      Also, see Gerard Meszaros' site:
      http://xunitpatterns.com/Humble%20Object.html


      [Non-text portions of this message have been removed]
    • John Roth
      There s a stream of thought which says that the best way to test an application through the gui is to not test an application through the gui. Obviously, not
      Message 2 of 11 , Mar 4, 2010
      • 0 Attachment
        There's a stream of thought which says that the best
        way to test an application through the gui is to not
        test an application through the gui.

        Obviously, not everyone agrees with that, but there are
        some rather good reasons, mostly revolving around
        fragility of the tests, a tendency to freeze the gui way too
        early and a corresponding tendency to make "look and
        feel" tuning by a real user interface expert way too expensive,
        why automated testing should stay away from the gui.

        So how do you do it? The way I've always seen recommended
        is to split the gui classes into two. The outer class has the
        interfaces to the gui toolbox for that particular screen, and
        the absolute minimum of other code needed to make the
        toolbox work. In particular, there should be no application
        logic in it at all.

        The inner class has everything else, including everything that
        can remotely be described as application logic. It's designed
        so that the interface with the outer class can be called
        conveniently from the test scripts.

        The people who do most of this hang out on the fitnesse
        mailing list.

        John Roth

        nyrb2 wrote:
        >
        >
        > Thanks Klaus -- I bought the book and it's really helping a lot.
        > However, there's one big thing I'm struggling with. In order to do the
        > end-to-end "acceptance" tests the authors talk about, they employ a
        > Java open-source library called WindowLicker - a framework for the
        > test-driven development of Java systems through the GUI. It does
        > things like finding and controling Swing compenents, synchronizing
        > with Swing's threads and event queues, and wrapping that all up behind
        > a simple API which hooks into the unit testing framework they'd chosen
        > (I think it was JUnit).
        >
        > My problem is that I'm working in C++ in Visaul Studio, using a unit
        > test library called cppunit. I've looked but haven't found any
        > equivalent library like WindowLicker, meaning that I am going to have
        > to write all the GUI communication myself. I've been doing that up
        > till now, but it's extremely onerous (using windows calls and handles
        > to find the right controls etc.)
        >
        > Do you (or anyone else here) know of any library I can hook into
        > cppunit to do this processing automatically?
        >
        > Bryn G.
        >
        > --- In extremeprogramming@yahoogroups.com
        > <mailto:extremeprogramming%40yahoogroups.com>, Klaus Hebsgaard
        > <klaus@...> wrote:
        > >
        > > You should read the book called "Growing Object Oriented systems
        > guided by
        > > tests" - I think it will answer many of your questions...
        > >
        > > In short do end to end testing first (formulated them as acceptance
        > tests),
        > > and then in order for the end to end test to pass, tdd the
        > functionality out
        > > with unit tests...
        > >
        > > Best regards
        > >
        > > Klaus Hebsgaard
        > >
        > > Website: http://www.hebsgaard.dk <http://www.hebsgaard.dk>
        > > Blog: http://www.khebbie.dk <http://www.khebbie.dk>
        > >
        > >
        > > On Fri, Feb 19, 2010 at 12:23 AM, nyrb2 <ua485@...>wrote:
        > >
        > > >
        > > >
        > > > Thank you so much for all your responses! As a developer, I find
        > the input
        > > > invaluable in trying to formulate a plan for testing and I
        > appreciate all
        > > > your collective years of experience.
        > > >
        > > > What are your thoughts on "end-to-end" tests? Tests that don't
        > examine the
        > > > operability of various pieces of a function, but test the entire
        > function as
        > > > a whole? Our software lead was pretty insistent that we write
        > these kind of
        > > > tests in addition to unit tests so that the functionality can be
        > placed into
        > > > an "automated test" framework. The problem is, as I said in my
        > previous
        > > > post, the prospect of writing an end-to-end test even for something
        > > > relatively simple such as this "delete" function is rather daunting.
        > > >
        > > >
        > > >
        >
      • Keith Ray
        With c++ on ms windows and ui programming, I d try NOT writing any tests against purely ui code. If a ui-only bug shows up that isn t purely cosmetic, consider
        Message 3 of 11 , Mar 4, 2010
        • 0 Attachment
          With c++ on ms windows and ui programming, I'd try NOT writing any
          tests against purely ui code. If a ui-only bug shows up that isn't
          purely cosmetic, consider adding a test for that bit of the ui. I
          don't see much ROI for unit-testing GUI.

          If you export your app's functionality via COM, you can drive the
          application from a scripting language, and you can have app-level
          tests without ui sensitivity.

          C. Keith Ray
          Agile Coaching, training, eLearning
          http://www.industriallogic.com
          Sent from my iPhone

          On Mar 3, 2010, at 8:42 AM, "nyrb2" <ua485@...>
          wrote:

          > Thanks Klaus -- I bought the book and it's really helping a lot.
          > However, there's one big thing I'm struggling with. In order to do
          > the end-to-end "acceptance" tests the authors talk about, they
          > employ a Java open-source library called WindowLicker - a framework
          > for the test-driven development of Java systems through the GUI. It
          > does things like finding and controling Swing compenents,
          > synchronizing with Swing's threads and event queues, and wrapping
          > that all up behind a simple API which hooks into the unit testing
          > framework they'd chosen (I think it was JUnit).
          >
          > My problem is that I'm working in C++ in Visaul Studio, using a unit
          > test library called cppunit. I've looked but haven't found any
          > equivalent library like WindowLicker, meaning that I am going to
          > have to write all the GUI communication myself. I've been doing
          > that up till now, but it's extremely onerous (using windows calls
          > and handles to find the right controls etc.)
          >
          > Do you (or anyone else here) know of any library I can hook into
          > cppunit to do this processing automatically?
          >
          >
          > Bryn G.
          >
          >
          > --- In extremeprogramming@yahoogroups.com, Klaus Hebsgaard
          > <klaus@...> wrote:
          >>
          >> You should read the book called "Growing Object Oriented systems
          >> guided by
          >> tests" - I think it will answer many of your questions...
          >>
          >> In short do end to end testing first (formulated them as acceptance
          >> tests),
          >> and then in order for the end to end test to pass, tdd the
          >> functionality out
          >> with unit tests...
          >>
          >> Best regards
          >>
          >> Klaus Hebsgaard
          >>
          >> Website: http://www.hebsgaard.dk
          >> Blog: http://www.khebbie.dk
          >>
          >>
          >> On Fri, Feb 19, 2010 at 12:23 AM, nyrb2 <ua485@...>wrote:
          >>
          >>>
          >>>
          >>> Thank you so much for all your responses! As a developer, I find
          >>> the input
          >>> invaluable in trying to formulate a plan for testing and I
          >>> appreciate all
          >>> your collective years of experience.
          >>>
          >>> What are your thoughts on "end-to-end" tests? Tests that don't
          >>> examine the
          >>> operability of various pieces of a function, but test the entire
          >>> function as
          >>> a whole? Our software lead was pretty insistent that we write
          >>> these kind of
          >>> tests in addition to unit tests so that the functionality can be
          >>> placed into
          >>> an "automated test" framework. The problem is, as I said in my
          >>> previous
          >>> post, the prospect of writing an end-to-end test even for something
          >>> relatively simple such as this "delete" function is rather daunting.
          >>>
          >>>
          >>>
          >>
          >>
          >> [Non-text portions of this message have been removed]
          >>
          >
          >
          >
          >
          > ------------------------------------
          >
          > To Post a message, send it to: extremeprogramming@...
          >
          > To Unsubscribe, send a blank message to: extremeprogramming-unsubscribe@...
          >
          > ad-free courtesy of objectmentor.comYahoo! Groups Links
          >
          >
          >
        • Keith Ray
          Also: consider using google test and google mock frameworks for c++, gtest and gmock. Much more power and convience than cppunit. C. Keith Ray Agile Coaching,
          Message 4 of 11 , Mar 4, 2010
          • 0 Attachment
            Also: consider using google test and google mock frameworks for c++,
            gtest and gmock. Much more power and convience than cppunit.

            C. Keith Ray
            Agile Coaching, training, eLearning
            http://www.industriallogic.com
            Sent from my iPhone

            On Mar 3, 2010, at 8:42 AM, "nyrb2" <ua485@...>
            wrote:

            > Thanks Klaus -- I bought the book and it's really helping a lot.
            > However, there's one big thing I'm struggling with. In order to do
            > the end-to-end "acceptance" tests the authors talk about, they
            > employ a Java open-source library called WindowLicker - a framework
            > for the test-driven development of Java systems through the GUI. It
            > does things like finding and controling Swing compenents,
            > synchronizing with Swing's threads and event queues, and wrapping
            > that all up behind a simple API which hooks into the unit testing
            > framework they'd chosen (I think it was JUnit).
            >
            > My problem is that I'm working in C++ in Visaul Studio, using a unit
            > test library called cppunit. I've looked but haven't found any
            > equivalent library like WindowLicker, meaning that I am going to
            > have to write all the GUI communication myself. I've been doing
            > that up till now, but it's extremely onerous (using windows calls
            > and handles to find the right controls etc.)
            >
            > Do you (or anyone else here) know of any library I can hook into
            > cppunit to do this processing automatically?
            >
            >
            > Bryn G.
            >
            >
            > --- In extremeprogramming@yahoogroups.com, Klaus Hebsgaard
            > <klaus@...> wrote:
            >>
            >> You should read the book called "Growing Object Oriented systems
            >> guided by
            >> tests" - I think it will answer many of your questions...
            >>
            >> In short do end to end testing first (formulated them as acceptance
            >> tests),
            >> and then in order for the end to end test to pass, tdd the
            >> functionality out
            >> with unit tests...
            >>
            >> Best regards
            >>
            >> Klaus Hebsgaard
            >>
            >> Website: http://www.hebsgaard.dk
            >> Blog: http://www.khebbie.dk
            >>
            >>
            >> On Fri, Feb 19, 2010 at 12:23 AM, nyrb2 <ua485@...>wrote:
            >>
            >>>
            >>>
            >>> Thank you so much for all your responses! As a developer, I find
            >>> the input
            >>> invaluable in trying to formulate a plan for testing and I
            >>> appreciate all
            >>> your collective years of experience.
            >>>
            >>> What are your thoughts on "end-to-end" tests? Tests that don't
            >>> examine the
            >>> operability of various pieces of a function, but test the entire
            >>> function as
            >>> a whole? Our software lead was pretty insistent that we write
            >>> these kind of
            >>> tests in addition to unit tests so that the functionality can be
            >>> placed into
            >>> an "automated test" framework. The problem is, as I said in my
            >>> previous
            >>> post, the prospect of writing an end-to-end test even for something
            >>> relatively simple such as this "delete" function is rather daunting.
            >>>
            >>>
            >>>
            >>
            >>
            >> [Non-text portions of this message have been removed]
            >>
            >
            >
            >
            >
            > ------------------------------------
            >
            > To Post a message, send it to: extremeprogramming@...
            >
            > To Unsubscribe, send a blank message to: extremeprogramming-unsubscribe@...
            >
            > ad-free courtesy of objectmentor.comYahoo! Groups Links
            >
            >
            >
          • Charlie Poole
            +1 on all except the COM part... 1. Test directly below the UI, but... 2. make the UI incredibly thin The Visual Studio IDE is your enemy here. Every time you
            Message 5 of 11 , Mar 5, 2010
            • 0 Attachment
              +1 on all except the COM part...

              1. Test directly below the UI, but...
              2. make the UI incredibly thin

              The Visual Studio IDE is your enemy here. Every time you click to
              create an event handler the IDE opens up a spot for you to add
              more code to the UI itself. Resist that temptation and call into
              your separate assembly that handles business logic.

              Simply doing this can take you a long way. At some point, you
              should look into using MVC or MVP rather than just MV.

              COM, in my view, should be reserved for interacting with legacy
              code that already uses it. Live is complicated enough already. :-)

              Charlie

              > -----Original Message-----
              > From: extremeprogramming@yahoogroups.com
              > [mailto:extremeprogramming@yahoogroups.com] On Behalf Of Keith Ray
              > Sent: Thursday, March 04, 2010 6:12 PM
              > To: extremeprogramming@yahoogroups.com
              > Cc: extremeprogramming@yahoogroups.com
              > Subject: Re: [XP] Re: More on Unit Testing
              >
              > With c++ on ms windows and ui programming, I'd try NOT
              > writing any tests against purely ui code. If a ui-only bug
              > shows up that isn't purely cosmetic, consider adding a test
              > for that bit of the ui. I don't see much ROI for unit-testing GUI.
              >
              > If you export your app's functionality via COM, you can drive
              > the application from a scripting language, and you can have
              > app-level tests without ui sensitivity.
              >
              > C. Keith Ray
              > Agile Coaching, training, eLearning
              > http://www.industriallogic.com
              > Sent from my iPhone
              >
              > On Mar 3, 2010, at 8:42 AM, "nyrb2" <ua485@...>
              > wrote:
              >
              > > Thanks Klaus -- I bought the book and it's really helping a lot.
              > > However, there's one big thing I'm struggling with. In order to do
              > > the end-to-end "acceptance" tests the authors talk about,
              > they employ
              > > a Java open-source library called WindowLicker - a
              > framework for the
              > > test-driven development of Java systems through the GUI. It does
              > > things like finding and controling Swing compenents, synchronizing
              > > with Swing's threads and event queues, and wrapping that
              > all up behind
              > > a simple API which hooks into the unit testing framework
              > they'd chosen
              > > (I think it was JUnit).
              > >
              > > My problem is that I'm working in C++ in Visaul Studio,
              > using a unit
              > > test library called cppunit. I've looked but haven't found any
              > > equivalent library like WindowLicker, meaning that I am
              > going to have
              > > to write all the GUI communication myself. I've been doing that up
              > > till now, but it's extremely onerous (using windows calls
              > and handles
              > > to find the right controls etc.)
              > >
              > > Do you (or anyone else here) know of any library I can hook into
              > > cppunit to do this processing automatically?
              > >
              > >
              > > Bryn G.
              > >
              > >
              > > --- In extremeprogramming@yahoogroups.com, Klaus Hebsgaard
              > <klaus@...>
              > > wrote:
              > >>
              > >> You should read the book called "Growing Object Oriented systems
              > >> guided by tests" - I think it will answer many of your questions...
              > >>
              > >> In short do end to end testing first (formulated them as
              > acceptance
              > >> tests), and then in order for the end to end test to pass, tdd the
              > >> functionality out with unit tests...
              > >>
              > >> Best regards
              > >>
              > >> Klaus Hebsgaard
              > >>
              > >> Website: http://www.hebsgaard.dk
              > >> Blog: http://www.khebbie.dk
              > >>
              > >>
              > >> On Fri, Feb 19, 2010 at 12:23 AM, nyrb2 <ua485@...>wrote:
              > >>
              > >>>
              > >>>
              > >>> Thank you so much for all your responses! As a developer,
              > I find the
              > >>> input invaluable in trying to formulate a plan for testing and I
              > >>> appreciate all your collective years of experience.
              > >>>
              > >>> What are your thoughts on "end-to-end" tests? Tests that don't
              > >>> examine the operability of various pieces of a function, but test
              > >>> the entire function as a whole? Our software lead was pretty
              > >>> insistent that we write these kind of tests in addition to unit
              > >>> tests so that the functionality can be placed into an "automated
              > >>> test" framework. The problem is, as I said in my previous
              > post, the
              > >>> prospect of writing an end-to-end test even for something
              > relatively
              > >>> simple such as this "delete" function is rather daunting.
              > >>>
              > >>>
              > >>>
              > >>
              > >>
              > >> [Non-text portions of this message have been removed]
              > >>
              > >
              > >
              > >
              > >
              > > ------------------------------------
              > >
              > > To Post a message, send it to: extremeprogramming@...
              > >
              > > To Unsubscribe, send a blank message to:
              > > extremeprogramming-unsubscribe@...
              > >
              > > ad-free courtesy of objectmentor.comYahoo! Groups Links
              > >
              > >
              > >
              >
              >
              > ------------------------------------
              >
              > To Post a message, send it to: extremeprogramming@...
              >
              > To Unsubscribe, send a blank message to:
              > extremeprogramming-unsubscribe@...
              >
              > ad-free courtesy of objectmentor.comYahoo! Groups Links
              >
              >
              >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.