Finding false negatives / false positives in unit tests

By: Johnathon Wright on: October 08, 2012

I get a lot of confidence from seeing my tests fail, then pass. Recently I wondered whether I shouldn't be codifying that. Just because I saw it fail initially doesn't mean I'm not getting a false positive now.

Caution: this is purely theoretical. It's worth exploring on a blog, but the agile part of me realizes that I rarely have issues with false-positives in tests. So don't start trying to codify potential false-negatives because you read it on a blog somewhere.

it 'exposes color' do
  positive do
    Animal.new('frog').color.should == 'green'
  end

  negative do
    Animal.new('frog').color.should == 'pink'
  end
end

So the interesting thing is that the failure I often see is that I haven't coded something yet. Subsequently, I can't really codify a false positive / false negative situation.

Nothing to see here. Move along!

update 2020-04-01

I saw this spec, which handles this neatly:

employee = FactoryGirl.create(:employee)
expect do
  employee.first_name = nil
end.to change { employee.valid? }.from(true).to(false)




Comments:

jordan 1 off white said: My spouse and i have been comfortable that John managed to finish up his basic research because of the precious recommendations he obtained through the web site. It is now and again perplexing to just possibly be offering tips and tricks which the others may have been making money from. We really acknowledge we have got you to be grateful to for this. The most important illustrations you've made, the easy blog menu, the friendships you will aid to engender - it's all superb, and it is letting our son in addition to our family feel that that issue is awesome, and that's quite vital. Many thanks for all the pieces! jordan 1 off white [url=http://www.offwhitexjordan1.com]jordan 1 off white[/url]

steph curry shoes said: I truly wanted to send a brief message in order to appreciate you for some of the nice ideas you are giving out at this website. My time-consuming internet lookup has now been paid with brilliant concept to talk about with my two friends. I would assert that we readers actually are undoubtedly endowed to exist in a useful site with very many perfect professionals with helpful points. I feel truly blessed to have seen your website and look forward to many more awesome moments reading here. Thank you once again for a lot of things. steph curry shoes

yeezy said: My husband and i were now joyous Michael managed to do his research because of the precious recommendations he came across through your site. It's not at all simplistic to just continually be giving for free points which often people may have been selling. So we see we've got the website owner to be grateful to because of that. All the illustrations you have made, the easy blog navigation, the relationships you make it possible to create - it's got many incredible, and it's really leading our son and the family recognize that this idea is awesome, and that is unbelievably mandatory. Thank you for all the pieces! yeezy

jordans said: I just wanted to write a brief word to express gratitude to you for those pleasant tactics you are giving at this site. My particularly long internet research has at the end been recognized with incredibly good concept to share with my company. I would assume that we visitors are quite lucky to be in a notable community with so many special people with very helpful hints. I feel pretty grateful to have encountered the webpage and look forward to some more excellent times reading here. Thank you once more for a lot of things. jordans

hermes birkin said: I enjoy you because of your own work on this site. Kate loves getting into internet research and it is easy to understand why. Almost all learn all of the powerful means you render sensible strategies through this blog and in addition recommend participation from other people on this idea while our princess has been understanding so much. Take pleasure in the rest of the year. You are always conducting a remarkable job. hermes birkin

vapormax said: I would like to convey my admiration for your kindness supporting individuals that have the need for guidance on this particular niche. Your personal dedication to getting the message all around ended up being really powerful and have in most cases helped people like me to realize their desired goals. This interesting report denotes a lot a person like me and additionally to my peers. Thanks a lot; from everyone of us. vapormax

off white said: I actually wanted to type a brief message to express gratitude to you for these wonderful points you are giving at this site. My incredibly long internet research has at the end of the day been recognized with extremely good information to talk about with my friends. I would express that many of us website visitors are truly endowed to dwell in a fine community with very many awesome individuals with helpful tips and hints. I feel pretty privileged to have seen the webpages and look forward to really more awesome minutes reading here. Thank you again for all the details. off white

supreme shirt said: I'm commenting to make you understand of the amazing discovery my wife's girl developed browsing yuor web blog. She realized many things, which include what it is like to have an ideal teaching mood to get the rest with no trouble master certain advanced topics. You truly exceeded our desires. Thanks for displaying these powerful, trusted, edifying and in addition cool tips about the topic to Evelyn. supreme shirt

jordan 12 said: Thanks for all of the hard work on this web page. My daughter take interest in doing investigation and it's easy to see why. My spouse and i learn all concerning the powerful manner you produce simple tips and tricks by means of this web site and even encourage contribution from the others about this idea then my daughter is always being taught a whole lot. Take advantage of the rest of the year. You're the one conducting a really great job. jordan 12

vasdvsd said: https://www.nikeairforce1vip.com/air-force-1-react-c-85/ air force 1 react , https://www.alexandermcqueensneakerssale.com/alexander-mcqueen-man-c-65/ Alexander McQueen Man , https://www.ashoeser.com/ Sport Shoes Outlet , https://www.goldengoosesneakersworld.com/golden-goose-stardan-c-13/ Golden Goose Stardan , https://www.ashoeser.com/air-vapormax-c-215/ Air Vapormax , https://www.goldengoosesneakerssales.com/golden-goose-purestar-c-30/ Golden Goose Purestar , https://www.ashoeser.com/air-max-95-c-7/ Air Max 95 , https://www.goldengoosesneakersworld.com/golden-goose-purestar-c-9/ Golden Goose Purestar , https://www.nikeairforce1vip.com/air-force-1-mid-c-75/ air force 1 mid , https://www.ashoeser.com/offwhite-c-326/ Off-White , https://www.ashoeser.com/air-max-90-c-6/ Air Max 90 , https://www.commonprojectssneakerssale.com/common-projects-man-c-69/ Common Projects Man , https://www.ashoeser.com/ultra-boost-c-270/ Ultra Boost , https://www.ashoeser.com/air-max-2090-c-212/ Air Max 2090 , https://www.newvalentinoshoes.com/heels-c-96/ Valentino Heels , https://www.alexandermcqueensneakerssale.com/alexander-mcqueen-woman-c-66/ Alexander McQueen Woman , https://www.nikeairforce1vip.com/supreme-air-force-1-c-83/ supreme x air force 1 , https://www.goldengoosesneakerssales.com/golden-goose-starter-c-9/ Golden Goose Starter , https://www.goldengoosesneakerssales.com/golden-goose-francy-c-7/ Golden Goose Francy , https://www.newvalentinoshoes.com/slingbacks-c-97/ Valentino Slingback , https://www.goldengoosesneakerssales.com/golden-goose-hi-star-c-15/ Golden Goose Hi Star , https://www.allgoldengoose.com/slide-c-71/ Golden Goose Slide , https://www.goldengoosesneakersworld.com/golden-goose-slide-c-11/ Golden Goose Slide , https://www.ggdbshoesonsale.com/ GGDB Sneakers , https://www.goldengoosesneakersworld.com/golden-goose-starter-c-15/ Golden Goose Starter , https://www.allgoldengoose.com/stardan-c-67/ Golden Goose Stardan , https://www.nikeairforce1vip.com/air-force-1-premium-c-76/ air force 1 premium , https://www.goldengoosesneakersworld.com/golden-goose-superstar-c-17/ Golden Goose Superstar , https://www.ashoeser.com/nike-lebron-c-338/ Nike LeBron Shoes , https://www.goldengoosesneakerssales.com/ Golden Goose Sneakers , https://www.ashoeser.com/adidas-alphabounce-c-297/ adidas Alphabounce , https://www.newvalentinoshoes.com/flats-c-90/ Valentino Flats , https://www.allgoldengoose.com/mid-star-c-70/ Golden Goose Mid Star , https://www.goldengoosesneakersworld.com/ Golden Goose Sale , https://www.goldengoosesneakerssales.com/golden-goose-man-c-29/ Golden Goose Man , https://shoesoutleti.tumblr.com/ Shoes Outlet , https://www.ggdbshoesonsale.com/ggdb-hi-star-c-7/ GGDB Hi Star , https://www.ashoeser.com/nike-kobe-ad-c-348/ Nike Kobe AD , https://www.pinterest.com/ggsneakersw/ Golden Goose Outlet , https://www.ggdbshoesonsale.com/ggdb-mid-star-c-9/ GGDB Mid Star , https://www.nikeairforce1vip.com/air-force-1-sage-c-86/ air force 1 sage , https://www.ggdbshoesonsale.com/ggdb-hanami-c-5/ GGDB Hanami , https://www.nikeairforce1vip.com/air-force-1-07-c-71/ air force 1 07 , https://www.goldengoosesneakerssales.com/golden-goose-woman-c-28/ Golden Goose Woman , https://www.nikeairforce1vip.com/air-force-1-ac-c-77/ air force 1 ac , https://www.newvalentinoshoes.com/cage-heels-c-92/ Valentino Cage Heels , https://shoesnewons.tumblr.com/ New Shoes , https://www.goldengoosesneakersworld.com/golden-goose-v-star-c-19/ Golden Goose V Star , https://www.goldengoosesneakerssales.com/golden-goose-superstar-c-3/ Golden Goose Superstar , https://www.goldengoosesneakerssales.com/golden-goose-mid-star-c-1/ Golden Goose Mid Star , https://www.goldengoosesneakersworld.com/golden-goose-may-c-26/ Golden Goose May , https://www.goldengoosesneakerssales.com/golden-goose-slide-c-5/ Golden Goose Slide , https://www.allgoldengoose.com/francy-c-68/ Golden Goose Francy , https://www.goldengoosesneakerssales.com/golden-goose-ball-star-c-17/ Golden Goose Ball Star , https://www.nikeairforce1vip.com/air-force-1-high-c-70/ air force 1 high , https://www.goldengoosesneakerssales.com/golden-goose-hanami-c-13/ Golden Goose Hanami , https://ggsneakersw.tumblr.com/ Golden Goose Sale , https://www.nikeairforce1vip.com/air-force-1-low-c-78/ air force 1 low , https://www.nikeairforce1vip.com/nba-air-force-1-c-69/ nba x air force 1 , https://www.commonprojectssneakerssale.com/ Common Projects Shoes , https://www.pinterest.com/shoesoutleti/ Shoes Outlet , https://www.pinterest.com/jojbender/nikeairforce1vip/ Air Force 1 Shoes , https://www.ashoeser.com/air-max-720-c-9/ Air Max 720 , https://www.nikeairforce1vip.com/air-force-1-lx-c-74/ air force 1 lx , https://www.ashoeser.com/air-max-97-c-8/ Air Max 97 , https://www.ggdbshoesonsale.com/ggdb-slide-c-11/ GGDB Slide , https://www.allgoldengoose.com/hi-star-c-73/ Golden Goose Hi Star , https://www.ashoeser.com/air-force-1-c-131/ Air Force 1 , https://www.commonprojectssneakerssale.com/common-projects-woman-c-70/ Common Projects Woman , https://www.nikeairforce1vip.com/air-force-1-upstep-c-87/ air force 1 upstep , https://www.nikeairforce1vip.com/air-force-1-lv8-c-72/ air force 1 lv8 , https://goldengooseti.tumblr.com/ Golden Goose Shoes , https://www.goldengoosesneakersworld.com/golden-goose-ball-star-c-1/ Golden Goose Ball Star , https://www.ashoeser.com/air-foamposite-c-12/ Air Foamposite , https://www.ashoeser.com/yeezy-boost-c-269/ Yeezy Boost , https://www.nikeairforce1vip.com/maharishi-air-force-1-c-88/ maharishi x air force 1 , https://www.ggdbshoesonsale.com/ggdb-francy-c-3/ GGDB Francy , https://www.balenciagasneakersvip.com/triple-s-sneakers-c-66/ Balenciaga Triple S Sneakers , https://www.ggdbshoesonsale.com/ggdb-v-star-c-17/ GGDB V Star , https://www.nikeairforce1vip.com/air-force-1-qs-c-79/ air force 1 qs , https://www.newvalentinoshoes.com/open-sneakers-c-95/ Valentino Open Sneakers , https://www.newvalentinoshoes.com/cage-sandals-c-93/ Valentino Cage Sandals , https://www.ashoeser.com/air-max-270-c-2/ Air Max 270 , https://www.goldengoosesneakersworld.com/golden-goose-mid-star-c-7/ Golden Goose Mid Star , https://www.nikeairforce1vip.com/travis-scott-air-force-1-c-84/ travis scott air force 1 , https://www.nikeairforce1vip.com/air-force-1-mens-c-73/ air force 1 mens , https://www.allgoldengoose.com/purestar-c-66/ Golden Goose Purestar , https://www.alexandermcqueensneakerssale.com/ Alexander McQueen Sale , https://www.newvalentinoshoes.com/sandals-c-91/ Valentino Sandals , https://www.balenciagasneakersvip.com/slide-shoes-c-67/ Balenciaga Slide Shoes , https://www.balenciagasneakersvip.com/ Balenciaga Sale , https://www.allgoldengoose.com/ball-star-c-72/ Golden Goose Ball Star , https://www.ggdbshoesonsale.com/ggdb-superstar-c-15/ GGDB Superstar , https://www.balenciagasneakersvip.com/speed-sneakers-c-65/ Balenciaga Speed Sneakers , https://www.ashoeser.com/adidas-nmd-c-306/ adidas NMD , https://www.allgoldengoose.com/superstar-c-65/ Golden Goose Superstar , https://www.nikeairforce1vip.com/air-force-1-utility-c-80/ air force 1 utility , https://www.nikeairforce1vip.com/air-force-1-shadow-c-81/ air force 1 shadow , https://www.ggdbshoesonsale.com/ggdb-starter-c-13/ GGDB Starter , https://www.nikeairforce1vip.com/ Air Force 1 Shoes , https://www.nikeairforce1vip.com/air-force-1-custom-c-66/ air force 1 custom , https://www.pinterest.com/newshoeser/ New Shoes , https://www.goldengoosesneakersworld.com/golden-goose-francy-c-3/ Golden Goose Francy , https://www.ashoeser.com/new-balance-c-16/ New Balance , https://www.ashoeser.com/air-jordan-1-c-4/ Air Jordan 1 , https://www.goldengoosesneakerssales.com/golden-goose-v-star-c-11/ Golden Goose V Star , https://www.pinterest.com/goldengooseti/ Golden Goose Sneakers , https://www.allgoldengoose.com/ Golden Goose Shoes , https://www.newvalentinoshoes.com/ Valentino Outlet , https://www.ashoeser.com/air-jordan-11-c-5/ Air Jordan 11 , https://www.goldengoosesneakersworld.com/golden-goose-hi-star-c-5/ Golden Goose Hi Star , https://www.allgoldengoose.com/starter-c-69/ Golden Goose Starter , https://www.nikeairforce1vip.com/clot-air-force-1-c-67/ clot x air force 1 , https://www.pinterest.com/shoesoutleti/nikeairforce1vipcom/ Nike Air Force 1 , https://www.nikeairforce1vip.com/air-force-1-womens-c-82/ air force 1 womens , https://www.ashoeser.com/air-huarache-c-3/ Air Huarache , https://www.newvalentinoshoes.com/sneakers-c-89/ Valentino Sneakers , https://www.nikeairforce1vip.com/air-force-1-kids-c-68/ air force 1 kids , https://www.nikeairforce1vip.com/offwhite-air-force-1-c-65/ off-white x air force 1 ,

jordan shoes said: I'm typically to running a blog and i actually admire your content. The article has actually peaks my interest. I am going to bookmark your web site and hold checking for brand spanking new information. jordan shoes

stone island t shirt said: you may have an excellent weblog right here! would you wish to make some invite posts on my blog? stone island t shirt

golden goose outlet said: You must participate in a contest for probably the greatest blogs on the web. I'll suggest this website! golden goose outlet

kd 12 said: A powerful share, I just given this onto a colleague who was doing somewhat evaluation on this. And he in truth bought me breakfast because I discovered it for him.. smile. So let me reword that: Thnx for the deal with! But yeah Thnkx for spending the time to debate this, I feel strongly about it and love reading extra on this topic. If attainable, as you become experience, would you mind updating your blog with more details? It's extremely helpful for me. Big thumb up for this blog publish! kd 12
Back