{"thread":{"id":"13729","subject":"perl/Git.pm: Writing a test suite","startedAt":"2008-05-30T07:43:48Z","lastAt":"2008-05-30T20:28:30Z","messageCount":5,"participants":["Lea Wiemann","Rafael Garcia-Suarez","Petr Baudis","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"78114","messageId":"483FB034.3050507@gmail.com","threadId":"13729","inReplyTo":null,"subject":"perl/Git.pm: Writing a test suite","fromName":"Lea Wiemann","fromEmail":"lewiemann@gmail.com","sentAt":"2008-05-30T07:43:48Z","receivedAt":"2008-05-30T07:43:48Z","isPatch":false,"sender":{"key":"lewiemann@gmail.com","avatar":null},"body":"Git.pm doesn't currently have a test suite, and I think it should get one.\n\nSince Git.pm makes calls to the git binary, it would seem sensible to me \nto create mock output for the external calls, like Grit (a Ruby API) \ndoes it, here: http://github.com/mojombo/grit/tree/master/test/fixtures \n  (Having a complete test repository to test against like Ruby/Git \n(another API) at \nhttp://repo.or.cz/w/rubygit.git?a=tree;f=tests/files;hb=HEAD is probably \ntoo brittle and makes it hard to test edge cases.)\n\nI haven't done testing in perl before, so if someone wants to exchange \nideas and/or help me get this set up, please post here or message me on \nIRC (lea_w/lea_1 on #git at Freenode).\n\n-- Lea\n"},{"id":"78115","messageId":"b77c1dce0805300103ke5f0259m336ace5f6f7e2e30@mail.gmail.com","threadId":"13729","inReplyTo":"483FB034.3050507@gmail.com","subject":"Re: perl/Git.pm: Writing a test suite","fromName":"Rafael Garcia-Suarez","fromEmail":"rgarciasuarez@gmail.com","sentAt":"2008-05-30T08:03:54Z","receivedAt":"2008-05-30T08:03:54Z","isPatch":false,"sender":{"key":"rgarciasuarez@gmail.com","avatar":null},"body":"2008/5/30 Lea Wiemann <lewiemann@gmail.com>:\n> Git.pm doesn't currently have a test suite, and I think it should get one.\n>\n> Since Git.pm makes calls to the git binary, it would seem sensible to me to\n> create mock output for the external calls, like Grit (a Ruby API) does it,\n> here: http://github.com/mojombo/grit/tree/master/test/fixtures  (Having a\n> complete test repository to test against like Ruby/Git (another API) at\n> http://repo.or.cz/w/rubygit.git?a=tree;f=tests/files;hb=HEAD is probably too\n> brittle and makes it hard to test edge cases.)\n>\n> I haven't done testing in perl before, so if someone wants to exchange ideas\n> and/or help me get this set up, please post here or message me on IRC\n> (lea_w/lea_1 on #git at Freenode).\n\nTesting is big in the perl world. I suggest to start with reading :\nhttp://www.perlfoundation.org/perl5/index.cgi?testing\nI'm not overloaded with tuits at the moment, but I'll try to review a\nbit your testing patches when you post them here.\n"},{"id":"78127","messageId":"20080530100306.GF18781@machine.or.cz","threadId":"13729","inReplyTo":"483FB034.3050507@gmail.com","subject":"Re: perl/Git.pm: Writing a test suite","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-05-30T10:03:06Z","receivedAt":"2008-05-30T10:03:06Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"  Hi,\n\nOn Fri, May 30, 2008 at 09:43:48AM +0200, Lea Wiemann wrote:\n> Git.pm doesn't currently have a test suite, and I think it should get one.\n>\n> Since Git.pm makes calls to the git binary, it would seem sensible to me to \n> create mock output for the external calls, like Grit (a Ruby API) does it, \n> here: http://github.com/mojombo/grit/tree/master/test/fixtures  (Having a \n> complete test repository to test against like Ruby/Git (another API) at \n> http://repo.or.cz/w/rubygit.git?a=tree;f=tests/files;hb=HEAD is probably \n> too brittle and makes it hard to test edge cases.)\n\n  I think this is bad idea; you should test not just Git.pm\nfunctionality, but equally importantly also its integration with\n(current version of) Git. If Git's output/behaviour changes in some\nsubtle way, you want to see if it breaks Git.pm.\n\n> I haven't done testing in perl before, so if someone wants to exchange \n> ideas and/or help me get this set up, please post here or message me on IRC \n> (lea_w/lea_1 on #git at Freenode).\n\n  There are two possible ways, either using the Git test suite\ninfrastructure, or the Perl test suite infrastructure. I'm ambivalent\nabout which one to choose, both have their advantages; I wonder what\nothers' opinion is. I would personally go with the Perl test suite in\nthis case but can't support it with much more than just a gut feeling.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nWhatever you can do, or dream you can, begin it.\nBoldness has genius, power, and magic in it.\t-- J. W. von Goethe\n"},{"id":"78144","messageId":"484004AB.40008@gmail.com","threadId":"13729","inReplyTo":"20080530100306.GF18781@machine.or.cz","subject":"Re: perl/Git.pm: Writing a test suite","fromName":"Lea Wiemann","fromEmail":"lewiemann@gmail.com","sentAt":"2008-05-30T13:44:11Z","receivedAt":"2008-05-30T13:44:11Z","isPatch":false,"sender":{"key":"lewiemann@gmail.com","avatar":null},"body":"Petr Baudis wrote:\n> Lea Wiemann wrote:\n>> it would seem sensible to me to create mock output for the external calls\n> \n>  I think this is bad idea; you should test not just Git.pm\n> functionality, but equally importantly also its integration with\n> (current version of) Git.\n\nGood point.  So I'll work on test repositories with real calls to Git \nwhere possible.\n\n>   There are two possible ways, either using the Git test suite\n> infrastructure, or the Perl test suite infrastructure.\n\nI'd definitely want to use Perl's testing infrastructure, but probably \nit's sensible to use both Git's and Perl's infrastructure (e.g. call the \nGit.pm perl tests from the Git test suite shell scripts, and maybe have \nsetup code in the shell scripts).  Here are two questions:\n\n1. Is it OK for the Git.pm tests to be called from the Git test scripts \nbut generate different-looking output (since the tests are run in Perl)?\n\n2. I might need external test helpers from CPAN at some point.  Is that \na bad idea because of dependencies, or are we OK with having additional \ndependencies for running the test suite if necessary?\n\n-- Lea\n"},{"id":"78171","messageId":"7v1w3jk041.fsf@gitster.siamese.dyndns.org","threadId":"13729","inReplyTo":"484004AB.40008@gmail.com","subject":"Re: perl/Git.pm: Writing a test suite","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-30T20:28:30Z","receivedAt":"2008-05-30T20:28:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lea Wiemann <lewiemann@gmail.com> writes:\n\n> 1. Is it OK for the Git.pm tests to be called from the Git test\n> scripts but generate different-looking output (since the tests are run\n> in Perl)?\n\nCosmetics.  As long as they are not disproportionally chatty nor too\nterse, and correctly catch breakages and stop (if told to with -i) on the\nfirst one, I think it is Ok to be different (e.g. no support for colored\noutput).\n\n> 2. I might need external test helpers from CPAN at some point.  Is\n> that a bad idea because of dependencies, or are we OK with having\n> additional dependencies for running the test suite if necessary?\n\nAs long as you use the ones that is widely used in Perl world I do not\nthink it would be a problem.\n"}]}