One of the things I really liked about TestNG was the grouping feature. Are there any plans for rSpec to incorporate that? Is there any way to emulate that functionality in rspec? Will.
On Fri, Mar 7, 2008 at 9:40 PM, Will Sargent <will.sargent at gmail.com> wrote:> One of the things I really liked about TestNG was the grouping > feature. Are there any plans for rSpec to incorporate that? Is there > any way to emulate that functionality in rspec?I''m not familiar with the feature you''re talking about. What is it?> > Will. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Sat, Mar 8, 2008 at 9:11 AM, David Chelimsky <dchelimsky at gmail.com> wrote:> > On Fri, Mar 7, 2008 at 9:40 PM, Will Sargent <will.sargent at gmail.com> wrote: > > One of the things I really liked about TestNG was the grouping > > feature. Are there any plans for rSpec to incorporate that? Is there > > any way to emulate that functionality in rspec? > > I''m not familiar with the feature you''re talking about. What is it?The idea is that you can specify that certain tests exist in groups, and can be run as a set. You can define groups and groups of groups, and so you can run a set of functional tests or all the tests dealing with a specific feature without running through the entire thing. It''s kinda like an rspec pattern, but more flexible. Documentation is here: http://testng.org/doc/documentation-main.html#test-groups Will.
> The idea is that you can specify that certain tests exist in groups, > and can be run as a set. You can define groups and groups of groups, > and so you can run a set of functional tests or all the tests dealing > with a specific feature without running through the entire thing. > It''s kinda like an rspec pattern, but more flexible.Might not be of help, but my problem was a tad similar when I used test/spec (rspecish test/unit wrapper). I had five types of test tasks in my Rakefile: test:units, test:functionals, test:integration, test:libs and test:helpers. The integration and lib tests took the most of the time, so I created custom tasks test:all_but_integration (quite self-explanatory, no?) and test:webserver, which ran everything else except test:libs. The way I did it was that test:all_but_integration just depended on the tasks test:units, tests:functionals etc. So, if you want grouping inside features in a single test suite, this won''t help, but for me, being able to control which (whole) files were run with Rake was sufficient for me. The whole suite took something like 15 minutes, but we had thousands of tests and when we started, we didn''t use that much mock objects. That said, I have never needed nor wished the ability to combine test suites using test/spec or rspec. Being able to choose which contexts/describes or individual specs will be run has been more than sufficient to me, but of course, YNMDFTOM. -- "One day, when he was naughty, Mr Bunnsy looked over the hedge into Farmer Fred''s field and it was full of fresh green lettuces. Mr Bunnsy, however, was not full of lettuces. This did not seem fair." -- Terry Pratchett, Mr. Bunnsy Has An Adventure
Using the -e option from the command line, you can also specify a string which is to be run, this is a way to run only one describe block, or one it block. The rake task method suggested by Edvard is the other option On Mar 10, 2008, at 5:42 AM, Edvard Majakari wrote:>> The idea is that you can specify that certain tests exist in groups, >> and can be run as a set. You can define groups and groups of groups, >> and so you can run a set of functional tests or all the tests dealing >> with a specific feature without running through the entire thing. >> It''s kinda like an rspec pattern, but more flexible. > > Might not be of help, but my problem was a tad similar when I used > test/spec (rspecish test/unit wrapper). > I had five types of test tasks in my Rakefile: test:units, > test:functionals, test:integration, test:libs and test:helpers. The > integration and lib tests took the most of the time, so I created > custom tasks test:all_but_integration (quite self-explanatory, no?) > and test:webserver, which ran everything else except test:libs. The > way I did it was that test:all_but_integration just > depended on the tasks test:units, tests:functionals etc. > > So, if you want grouping inside features in a single test suite, this > won''t help, but for me, being able to control which (whole) files were > run with Rake was sufficient for me. The whole suite took something > like 15 minutes, but we had thousands of tests and when we started, we > didn''t use that much mock objects. > > That said, I have never needed nor wished the ability to combine test > suites using test/spec or rspec. Being able to choose which > contexts/describes or individual specs will be run has been more than > sufficient to me, but of course, YNMDFTOM. > > -- > "One day, when he was naughty, Mr Bunnsy looked over the hedge into > Farmer Fred''s field and it was full of fresh green lettuces. Mr > Bunnsy, however, was not full of lettuces. This did not seem fair." > -- Terry Pratchett, Mr. Bunnsy Has An Adventure > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-usersJames Deville http://devillecompanies.org james.deville at gmail.com rspec r3172 rspec_on_rails r3172 rails r8331
James Deville wrote:> Using the -e option from the command line, you can also specify a > string which is to be run, this is a way to run only one describe > block, or one it block. The rake task method suggested by Edvard is > the other optionI''m having problems with the -e option - it doesn''t recognise the string and so runs no tests. I have several nested describe blocks, and i want to run one of the top-level ones: describe "add_descendants_from_xml" do before do ... ... end I''m trying to run just this block like so: ruby script/spec spec/models/property_spec.rb --format specdoc -c -e "add_descendants_from_xml" (the linebreak after -e isn''t in my command, it''s just split to fit this text field) And it runs 0 tests. Can anyone tell me what i''m doing wrong? thanks max -- Posted via http://www.ruby-forum.com/.
On 10 Mar 2008, at 12:42, Edvard Majakari wrote:> Being able to choose which > contexts/describes or individual specs will be run has been more than > sufficient to me, but of course, YNMDFTOM.Hi Edvard Sorry for the delayed reaction, but was just catching up on old posts and saw this. I googled for "YNMDFTOM" and apparently this mailing list contains the only use of it in the known universe. Please put me out of my misery and explain the acronym :D Ashley
On Wed, Mar 19, 2008 at 1:12 AM, Ashley Moran <ashley.moran at patchspace.co.uk> wrote:> > sufficient to me, but of course, YNMDFTOM.> Please put me out of my misery and explain the acronym :DMy bad. My favorite hobby is to invent new acronyms on the fly, of which the one concerned is an example. It is short for "Your Needs May Differ From Those Of Mine" :) -- "One day, when he was naughty, Mr Bunnsy looked over the hedge into Farmer Fred''s field and it was full of fresh green lettuces. Mr Bunnsy, however, was not full of lettuces. This did not seem fair." -- Terry Pratchett, Mr. Bunnsy Has An Adventure
Edvard Majakari wrote:> On Wed, Mar 19, 2008 at 1:12 AM, Ashley Moran > <ashley.moran at patchspace.co.uk> wrote: > >> > sufficient to me, but of course, YNMDFTOM. > >> Please put me out of my misery and explain the acronym :D > > My bad. My favorite hobby is to invent new acronyms on the fly, of > which the one concerned is an example. > It is short for "Your Needs May Differ From Those Of Mine" :) > > -- > "One day, when he was naughty, Mr Bunnsy looked over the hedge into > Farmer Fred''s field and it was full of fresh green lettuces. Mr > Bunnsy, however, was not full of lettuces. This did not seem fair." > -- Terry Pratchett, Mr. Bunnsy Has An AdventureSorry to be pedantic, but shouldn''t that be "Your needs may differ from mine"? There''s no party called ''mine'', so ''mine'' has no needs :) Anyway, does anyone have any idea why -e "the name of a describe block" results in 0 tests being run for me? -- Posted via http://www.ruby-forum.com/.
On 20 Mar 2008, at 14:31, Max Williams wrote:> Sorry to be pedantic, but shouldn''t that be > "Your needs may differ from mine"? There''s no party called ''mine'', so > ''mine'' has no needs :)A quick google for "those of mine" brings back a google book hit for Shakespeare so maybe Edvard was being poetic :D> Anyway, does anyone have any idea why > -e "the name of a describe block" > > results in 0 tests being run for me?Are you sure you are running the outer-most group, and not an inner group or example? I just tried this file as test.spec.rb: describe "add_descendants_from_xml" do it "should add descendants" do true.should be_false end describe "with attributes" do it "should add attributes too" do false.should be_true end end end * the outer group name works ~/Desktop % spec -e "add_descendants_from_xml" test.spec.rb F 1) ''add_descendants_from_xml should add descendants'' FAILED expected false, got true ./test.spec.rb:3: Finished in 0.007168 seconds * testing the name of the inner group fails ~/Desktop % spec -e "with attributes" test.spec.rb Finished in 0.001734 seconds 0 examples, 0 failures * but, as expected ~/Desktop % spec -e "add_descendants_from_xml with attributes" test.spec.rb F 1) ''add_descendants_from_xml with attributes should add attributes too'' FAILED expected true, got false ./test.spec.rb:8: Finished in 0.007056 seconds Failing that, are you sure you haven''t got a typo? I can''t see a problem with the -e option. Ashley
> Are you sure you are running the outer-most group, and not an inner > group or example? I just tried this file as test.spec.rb: > describe "add_descendants_from_xml" do > it "should add descendants" do > true.should be_false > end > > describe "with attributes" do > it "should add attributes too" do > false.should be_true > end > end > end > > * the outer group name worksAh - that''ll be the problem then: i was trying to run an inner group. I tend to wrap all the tests in a single file up in a single block, and then lots of nested blocks inside. thanks max -- Posted via http://www.ruby-forum.com/.