From: Timothy W. <tw...@us...> - 2009-03-31 11:46:23
|
ComponentReference is used by the scripting level, and generally isn't needed for hand-coded tests (you use Matchers and CompnentFinder instead). On Mar 31, 2009, at 12:13 AM, Eric Kolotyluk wrote: > Thanks for the tips... > > If I derive from ComponentTestFixture, then I can't call getResolver > which is needed by ComponentReference. Also, ResolverFixture is a > subclass of ComponentTestFixture. I'm just trying to understand why > I shouldn't use ResolverFixture. > > Yes, I have a custom renderer for my JTree so I understand how > rendering works - it just took me a while to remember that :-) > > I thought about breaking things up into smaller tests, but I thought > each individual test was supposed to be independent. In the test I > was trying to write, there is a specific order of how things work > that is related, it didn't seem right to break all the assertions up > into separate tests. Again, I'm still trying to understand the best > way to construct tests. > > Cheers, Eric > > Timothy Wall wrote: >> You'll want to derive from ComponentTestFixture, not ResolverFixture. >> >> It helps to understand how Swing aggregate components (JTable, >> JTree, JList) work to recognize that the subcomponents are not >> separate Swing components but only rendered with one. >> >> You'll also want to break your tests up into smaller bits, putting >> all the common setup/teardown in the fixture itself. That's not >> specific to using Abbot, though. >> >> On Mar 30, 2009, at 6:37 PM, Eric Kolotyluk wrote: >> >>> OK, I made a bit more progress. I think it helps to start writing >>> Abbot tests on a Monday morning when you are refreshed by the >>> weekend. I think the trick is to just start writing a test case, >>> make mistakes, and push through the pain. Several times I almost >>> resorted to asking for help in this mail-list, but eventually I >>> was able to work my way through it by searching the JavaDoc and >>> web. A really useful page I found was http://www.cafeaulait.org/slides/sd2006west/guitesting/ >>> - yeah Google! >>> >>> Not starting out too easy my first test was testing some JTree UI, >>> but I was able to start getting the hang of things. Maybe I'll >>> wait until next Monday morning before cutting my teeth on Costello. >>> >>> It's too bad that Abbot is not being actively maintained. Based on >>> the JavaDoc it looks like a lot of work was put into Abbot. >>> >>> I'm somewhat pleased to see that Abbot integrates smoothly with >>> Eclipse running along side the regular JUnit tests. Too bad there >>> is not an Abbot plug-in for Eclipse that can build all the >>> boilerplate for your tests the way Eclipse can build your initial >>> JUnit tests -- although I'm not sure what that would look like >>> anyway. >>> >>> Below is my first attempt at writing an Abbot test. It took me a >>> while to realize that tree nodes are not components and I could >>> not use a component based approach to testing, but once I found >>> JTreeTester things started making sense. >>> >>> Cheers, Eric >>> >>> package com.kodak.gcg.unified.ui.tree; >>> >>> import java.awt.Dimension; >>> >>> import javax.swing.tree.TreePath; >>> >>> import abbot.script.ComponentReference; >>> //import abbot.tester.ComponentTester; >>> import abbot.tester.JTreeTester; >>> import junit.extensions.abbot.ResolverFixture; >>> import junit.extensions.abbot.TestHelper; >>> >>> public class AssetTreeTest extends ResolverFixture >>> >>> { >>> //private ComponentTester tester; >>> TestAsset colorAsset = new TestAsset("The Colors", "Color"); >>> TestAsset redAsset = new TestAsset("The Color Red", "Red"); >>> TestAsset greenAsset = new TestAsset("The Color Gree", "Green"); >>> TestAsset blueAsset = new TestAsset("The Color Blue", "Blue"); >>> AssetRootTreeNode rootAsset = new AssetRootTreeNode(); >>> AssetTree assetTree = new AssetTree(); >>> BaseTreeModel assetTreeModel = new BaseTreeModel(rootAsset);; >>> TreePath redPath = new TreePath(new Object[]{rootAsset, >>> colorAsset, redAsset}); >>> TreePath greenPath = new TreePath(new Object[]{rootAsset, >>> colorAsset, greenAsset}); >>> TreePath bluePath = new TreePath(new Object[]{rootAsset, >>> colorAsset, blueAsset}); >>> >>> class TestAsset extends AssetTreeNode >>> { >>> String fullName; >>> String treeName; >>> public TestAsset(String fullName, String treeName) >>> { >>> this.fullName = fullName; >>> this.treeName = treeName; >>> } >>> >>> @Override >>> public String getFullName() >>> { >>> return fullName; >>> } >>> >>> @Override >>> public String getTreeName() >>> { >>> return treeName; >>> } >>> } >>> >>> public AssetTreeTest(String name) >>> { >>> super(name); >>> } >>> >>> protected void setUp() >>> { >>> //tester = ComponentTester.getTester(AssetTree.class); >>> colorAsset.add(redAsset, greenAsset, blueAsset); >>> rootAsset.add(colorAsset); >>> assetTree.setModel(assetTreeModel); >>> } >>> public void testTree() >>> { >>> showFrame(assetTree, new Dimension(200, 400)); >>> JTreeTester jTreeTester = new JTreeTester(); >>> jTreeTester.assertComponentShowing(new >>> ComponentReference(getResolver(), assetTree)); >>> jTreeTester.assertPathExists(assetTree, redPath); >>> jTreeTester.assertPathExists(assetTree, greenPath); >>> jTreeTester.assertPathExists(assetTree, bluePath); >>> // Make sure the colors are in alphabetical order >>> >>> jTreeTester.actionSelectPath(assetTree, bluePath); >>> assertEquals(assetTree.getSelectionCount(), 1); >>> assertEquals(assetTree.getSelectionRows()[0], 1); >>> jTreeTester.actionSelectPath(assetTree, greenPath); >>> assertEquals(assetTree.getSelectionCount(), 1); >>> assertEquals(assetTree.getSelectionRows()[0], 2); >>> jTreeTester.actionSelectPath(assetTree, redPath); >>> assertEquals(assetTree.getSelectionCount(), 1); >>> assertEquals(assetTree.getSelectionRows()[0], 3); >>> >>> } >>> public static void main(String ... arguments) >>> { >>> TestHelper.runTests(arguments, AssetTreeTest.class); >>> } >>> } >>> >>> >>> ----- Original Message ----- >>> From: "Timothy Wall" <tw...@us...> >>> To: "Eric Kolotyluk" <er...@sf...> >>> Cc: "Grant Birchmeier" <gbi...@co...>, "abbot-users" <abb...@li... >>> > >>> Sent: Thursday, March 26, 2009 10:39:05 AM GMT -08:00 US/Canada >>> Pacific >>> Subject: Re: [abbot-users] Is Abbot still supported? >>> >>> The bulk of the documentation is in the overview page of the >>> JavaDoc. >>> >>> I'm not actively developing the project, since I'm no longer doing >>> Java UIs. When I was, I focused primarily on tests coded in Java, >>> which works pretty well for test-driven development, especially for >>> development of custom components. I still use it. >>> >>> There really isn't that much to put into a user guide. GUI >>> testing is >>> about setting up a fixture, finding components, and operating on >>> them. Costello is a different matter, but the basic concepts are >>> the >>> same. >>> >>> While the docs may not help you with advanced concepts, the basic >>> ones >>> are all laid out on the web page (as well as explaining clearly what >>> the project does and how to use it in a straightforward example). >>> >>> I am pretty much the only developer; Oracle and IBM have >>> occasionally >>> had guys contributing a patch here or there, but abbot doesn't >>> seem to >>> be the sort of project that attracts developers (they seem to go off >>> and write their own, see Jemmy, JFCUnit, Pounder, FEST, et al.). >>> >>> On Mar 26, 2009, at 12:20 PM, Eric Kolotyluk wrote: >>> >>>> Wow, thanks for some great feedback. >>>> >>>> How did you find was the most effective way to actually learn >>>> Abbot? >>>> Reading the JavaDocs, looking at examples (wherever they may >>>> exist?), other articles? There really does not seem to be a user >>>> guide, at least not the kind of user guide I am use to. >>>> >>>> Initially I would like to create some automated unit tests for our >>>> UI that I can include in our build. >>>> >>>> Eventually I would like to see if it's practical to use Abbot for >>>> test driven development. >>>> >>>> Cheers, Eric >>>> >>>> ----- Original Message ----- >>>> From: "Grant Birchmeier" <gbi...@co...> >>>> Cc: "abbot-users" <abb...@li...> >>>> Sent: Thursday, March 26, 2009 8:18:30 AM GMT -08:00 US/Canada >>>> Pacific >>>> Subject: Re: [abbot-users] Is Abbot still supported? >>>> >>>> There is a learning curve, but we have been using it successfully >>>> for >>>> about 6 months or so with a securities trading client. I'm not >>>> sure >>>> if we're using it in the most efficient fashion, but it works for >>>> us. >>>> >>>> (Our testing is mostly hand-coded XML scripts we developed by >>>> examining the scripts generated by Costello, but our tinkering >>>> usually >>>> involves large <expression> blocks. We'd prefer pure Java-coded >>>> test >>>> cases, but I wasn't able to get Netbeans-managed GUI programs to >>>> play >>>> nice.) >>>> >>>> The forums and wiki are crap. If you have questions, send them >>>> here. >>>> Yes, this list is incredibly low traffic, but the creator, Tim >>>> Wall, >>>> does reply to this list and answers questions. I'm surprised he >>>> hasn't replied. >>>> >>>> Frankly, the developer base seems small. It may not be much more >>>> than >>>> Tim himself. As open source projects go, this one doesn't have >>>> much >>>> of a critical mass. >>>> >>>> -Grant >>>> >>>> >>>> >>>> On Thu, Mar 26, 2009 at 9:53 AM, Eric Kolotyluk <er...@sf...> >>>> wrote: >>>>> Actually, I'm really looking at Swing testing - we don't use SWT. >>>>> Thanks for the tip though. >>>>> >>>>> I've noticed some other projects include Abbot unit tests in their >>>>> release, so I thought Abbot might have become a standard of some >>>>> sort, akin to JUnit, for GUI testing. >>>>> >>>>> Given by what I've seen on the Abbot web site, the wiki site looks >>>>> like it's been compromised by some hacker, the fact the the forum >>>>> discussion is no longer used, and the very low traffic in this >>>>> mail- >>>>> list, it leaves me with the impression that Abbot is no longer >>>>> actively supported or being developed/improved. >>>>> >>>>> I understand the basics of Abbot, and like the fundamental idea of >>>>> how it works, but I don't want to go to heroic efforts learning >>>>> how >>>>> to use it if no-one is supporting it, or there is no user >>>>> community >>>>> to turn to for help. >>>>> >>>>> So, can anyone tell me if Abbot is still supported? >>>>> >>>>> Cheers, Eric >>>>> >>>>> >>>>> ----- Original Message ----- >>>>> From: "Veneet Raina" <ven...@te...> >>>>> To: "Eric Kolotyluk" <er...@sf...> >>>>> Sent: Thursday, March 26, 2009 2:44:11 AM GMT -08:00 US/Canada >>>>> Pacific >>>>> Subject: Re: [abbot-users] Is Abbot still supported? >>>>> >>>>> Hi eric, >>>>> >>>>> I saw your post in the abbnot mailing list and i ca safely say >>>>> that/* >>>>> SWTBot*/ is a better tool if you are looking at SWT testing >>>>> abbot is far more complex to understand and work with see the >>>>> Tool at >>>>> http://www.eclipse.org/swtbot/ >>>>> >>>>> cheers >>>>> Bye >>>>> Veneet >>>>> >>>>> >>>>> Eric Kolotyluk wrote: >>>>>> I've been trying to use and understand Abbot, but I'm having an >>>>>> incredibly difficult time. The documentation is very sketchy and >>>>>> incomplete - some of the poorest I've ever seen. The web site is >>>>>> very limited and poor. The wiki site is effectively broken and >>>>>> does not render pages correctly - in one case it took me to a >>>>>> phishing site which tried to trap me into downloading and running >>>>>> some software. >>>>>> >>>>>> Is this the normal state of things for Abbot? How do people learn >>>>>> how to use it? Do people still use it? >>>>>> >>>>>> At this point in time I'm trying to determine if there is any >>>>>> value in trying to learn to use it or just give up and find some >>>>>> other GUI test system. >>>>>> >>>>>> Any help would be greatly appreciated. >>>>>> >>>>>> Cheers, Eric >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> Apps built with the Adobe(R) Flex(R) framework and Flex >>>>>> Builder(TM) are >>>>>> powering Web 2.0 with engaging, cross-platform capabilities. >>>>>> Quickly and >>>>>> easily build your RIAs with Flex Builder, the Eclipse(TM)based >>>>>> development >>>>>> software that enables intelligent coding and step-through >>>>>> debugging. >>>>>> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com >>>>>> _______________________________________________ >>>>>> abbot-users mailing list >>>>>> abb...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/abbot-users >>>>>> >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> _______________________________________________ >>>>> abbot-users mailing list >>>>> abb...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/abbot-users >>>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> _______________________________________________ >>>> abbot-users mailing list >>>> abb...@li... >>>> https://lists.sourceforge.net/lists/listinfo/abbot-users >>>> >>>> ------------------------------------------------------------------------------ >>>> _______________________________________________ >>>> abbot-users mailing list >>>> abb...@li... >>>> https://lists.sourceforge.net/lists/listinfo/abbot-users >>> >>> >>> ------------------------------------------------------------------------------ >>> _______________________________________________ >>> abbot-users mailing list >>> abb...@li... >>> https://lists.sourceforge.net/lists/listinfo/abbot-users >> > |