[{"data":1,"prerenderedAt":292},["ShallowReactive",2],{"project-40441093":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":34,"aspects":35,"strip":43,"post_text":45,"what":46,"said":77,"maker_in_thread":157,"shape":167,"grid":172,"attempts":253,"same_week":254,"maker_shows":33,"maker_hidden":284,"reader_version":285,"card":286},"40441093","PBT","A property-based testing library for Ruby","title","Show HN: PBT – A property-based testing library for Ruby","https:\u002F\u002Fgithub.com\u002Fohbarye\u002Fpbt","github.com","ohbarye",1716386305,2024,196,33,404,3515,12,"notable","dev_tools","property-based testing library","library",[24,25,26,27],"property-based testing","ruby","shrinking","test generators","curious",0.148,{"positive":31,"neutral":32,"mixed":33,"critical":33},3,8,1,13,{"execution":36,"idea":39,"design":40,"docs":41,"performance":42},{"positive":37,"critical":38},2,0,{"positive":38,"critical":38},{"positive":38,"critical":38},{"positive":38,"critical":38},{"positive":38,"critical":38},[44,38,31,38,31,38,38,38,38,38,38,38,38,31,38,31,31,31,38,38,31,38,38,31,38,31,38,44,38,44,38,33,38],5,"Hello HN,\n\nI introduce a property-based testing tool for Ruby. Ruby's ease of test-writing and rich ecosystem are widely acclaimed. However, property-based testing is not as widely used as in other languages such as Haskell or Elixir, and I think this is because there is no de facto testing tool.\n\nThis gem currently not only has the basic functionality of stateless property-based testing but also has the following features:\n\n- Support verbose mode that allows you to see its shrinking procedure and algorithms.\n\n- Support several concurrency\u002Fparallel executions of each test. As of now, Ractor\u002FTh",{"problem":47,"audience":53,"pricing":65,"motivation":66,"time_to_build":65,"stack":70,"openness":75,"stage":76,"team_size":76},{"value":48,"source":49,"evidence":50},"Ruby lacks a de facto property-based testing tool.","maker",[51],{"id":52},"post",{"value":54,"source":55,"evidence":56},"Ruby developers writing tests","inferred",[57,58,62],{"id":52},{"id":59,"by":60,"text":61},"40442307","cortesoft","Can this be used alongside rspec? Like have these be tests that are included in the rspec test run, and have the results alongside your other rspec tests?",{"id":63,"by":11,"text":64},"40442420","The answer to both questions is yes. This gem doesn't aim to reimplement a testing framework. It can also be considered just an assertion. You can use this alongside any testing…",null,{"value":67,"source":49,"evidence":68},"Ruby lacks a de facto PBT tool, which the maker thinks holds back PBT adoption.",[69],{"id":52},[71],{"value":72,"source":49,"evidence":73},"Ruby",[74],{"id":52},"open_source","unknown",{"praise":78,"objections":99,"requests":118,"questions":137,"alternatives":146},[79,92],{"value":80,"source":81,"evidence":82},"Useful, clean work welcomed as an effort toward PBT in Ruby","commenter",[83,87,91],{"id":84,"by":85,"text":86},"40451074","hdjrkaofbdjwm","Great work, looks really clean! Check out Minithesis [1] and the paper explaining internal shrinking [2]. It will strongly improve your library's shrinking capabilities and…",{"id":88,"by":89,"text":90},"40441948","lijok","Amazing work ! Happy to see any effort towards PBT.",{"id":88,"by":89,"text":90},{"value":93,"source":81,"evidence":94},"Excited to see Ractor support",[95],{"id":96,"by":97,"text":98},"40447607","Lammy","Excited to see libraries using Ractors as somebody who has also fallen in love with them ♡",[100,111],{"value":101,"source":81,"evidence":102},"Saved seed-based cases break when generator order changes",[103,107],{"id":104,"by":105,"text":106},"40443661","tybug","(not OP but I would be surprised if the answer wasn't) yes, because you're changing the order in which the random draws are interpreted. But this isn't a problem in practice…",{"id":108,"by":109,"text":110},"40445235","parentheses","So, this means refactoring becomes potentially difficult. While the gem is still a great accomplishment and very useful, I'd have to engineer my way around this issue before…",{"value":112,"source":81,"evidence":113},"Possible slowdown of test suites",[114],{"id":115,"by":116,"text":117},"40442792","mberning","Very cool. Wonder how much time this adds to a test suite as you incorporate it more. Might need to have some different test targets to keep things fast.",[119,126,130],{"value":120,"source":81,"evidence":121},"Integration with Rails models",[122],{"id":123,"by":124,"text":125},"40442687","jack_riminton","Interesting! I wonder how this could be applied to a Rails project (since that's what ruby is most used for). For example how would it know to test a wide selection of possible…",{"value":127,"source":81,"evidence":128},"Save failing examples to a file",[129],{"id":108,"by":109,"text":110},{"value":131,"source":81,"evidence":132},"Type support from RBS or Sorbet",[133],{"id":134,"by":135,"text":136},"40451780","Lio","Lovely stuff, thank you. It would be cool if we could eventually make use of RBS or inline Sorbet or something better than both to get the types for property testing for free.",[138,142],{"value":139,"source":81,"evidence":140},"Can it run alongside RSpec",[141],{"id":59,"by":60,"text":61},{"value":143,"source":81,"evidence":144},"How PBT handles Rails model data generation",[145],{"id":123,"by":124,"text":125},[147,151],{"value":148,"source":81,"evidence":149},"Minithesis",[150],{"id":84,"by":85,"text":86},{"value":152,"source":49,"evidence":153},"fast-check",[154],{"id":155,"by":11,"text":156},"40456307","It's very basic content though, here's the slides of my presentation at RubyKaigi 2024. This also includes the PBT gems's explanations.…",{"comments":158,"answered":37,"key":159},11,[160,163,164],{"id":161,"text":162},"40454315","Wow, I didn't know about them. Thanks for letting me know!",{"id":63,"text":64},{"id":165,"text":166},"40454261","Yeah, the easiest way is to generate attributes and instantiate any Rails model like the one below: ``` Pbt.assert do Pbt.property(name: Pbt.printable_string, age:…",{"commenters":168,"max_depth":169,"maker_replies":158,"first_comment_mins":170,"lifespan_hours":171},18,6,69,26,[173,175,177,179,180,182,186,189,192,194,198,201,203,205,207,209,212,213,215,218,220,225,229,230,231,233,235,238,241,243,244,246,251],[84,38,44,174,85,38],"project\u002Fpositive\u002Fexecution",[161,38,38,176,11,33],"maker\u002Fneutral\u002Fnone",[59,33,31,178,60,38],"project\u002Fneutral\u002Fexecution",[63,33,38,178,11,33],[123,37,31,181,124,38],"project\u002Fneutral\u002Fidea",[183,37,38,184,185,38],"40442934","other\u002Fneutral\u002Fnone","Alifatisk",[187,37,38,184,188,38],"40443335","mikepurvis",[190,37,38,184,191,38],"40443582","portpecos",[193,37,38,184,185,38],"40444209",[195,37,38,196,197,38],"40445079","commenter\u002Fneutral\u002Fnone","sam2426679",[199,37,38,184,200,38],"40452619","ilvez",[202,37,38,184,185,38],"40453043",[204,37,38,184,185,38],"40444169",[206,37,31,178,109,38],"40443251",[165,37,38,208,11,33],"maker\u002Fneutral\u002Fdocs",[210,31,31,211,109,38],"40443303","project\u002Fneutral\u002Fdesign",[104,31,31,211,105,38],[108,31,31,214,109,38],"project\u002Fmixed\u002Fdesign",[216,31,38,217,11,33],"40450935","maker\u002Fneutral\u002Fdesign",[219,31,38,217,11,33],"40450876",[221,222,31,223,224,38],"40443992",4,"project\u002Fneutral\u002Fdocs","bloopernova",[226,222,38,227,228,38],"40449727","other\u002Fneutral\u002Fdocs","arialdomartini",[155,222,38,208,11,33],[134,44,31,181,135,38],[232,44,38,176,11,33],"40454339",[115,169,31,234,116,38],"project\u002Fneutral\u002Fperformance",[236,169,38,237,11,33],"40450841","maker\u002Fneutral\u002Fperformance",[88,239,44,240,89,38],7,"maker\u002Fpositive\u002Fnone",[242,239,38,176,11,33],"40442432",[96,32,44,174,97,38],[245,32,38,176,11,33],"40450847",[247,248,33,249,250,38],"40453125",9,"project\u002Fcritical\u002Fnone","slackstation",[252,248,38,176,11,33],"40454389",[],[255,260,265,270,275,280],{"id":256,"name":257,"points":258,"category":259},"40431126","Pls Fix",444,"web_saas",{"id":261,"name":262,"points":263,"category":264},"40429200","graphgame.sabrina.dev",321,"games",{"id":266,"name":267,"points":268,"category":269},"40441945","Unify",298,"ai",{"id":271,"name":272,"points":273,"category":274},"40392548","EquityVal",287,"finance_crypto",{"id":276,"name":277,"points":278,"category":279},"40443927","Neosync",246,"data",{"id":281,"name":282,"points":283,"category":279},"40432213","Openpanel",244,false,"v2",{"id":287,"name":5,"line":6,"ai":284,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":288,"top":18,"kw":289,"maker":11,"domain":10,"tier":19,"attempts":38,"strip":290,"url":9,"mix":291,"praise":80,"objection":101,"sub":21},40441093,0.15,[24,25,26,27],"503030000000030333003003030505010",[31,32,33,33],1794036655158]