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'frog').color.should == 'green'

  negative do'frog').color.should == 'pink'

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 change { employee.valid? }.from(true).to(false)


Just checking that you are human. What would be the result of this code?

a = 3*(4/2); b = 1; a+b

Joseph said: Another year para qu sirve la pastilla montelukast 10 mg Investors await weekly initial jobless claims data and Juneimport-export prices, to be released at 8:30 a.m. EDT (1230GMT). Economists surveyed by Reuters forecast a total of 340,000new filings. Import prices are expected to remain unchangedwhile export prices are expected to show a 0.1 percent decline.

Paige said: Have you got any ? cialis ou viagra qual o melhor The recently launched grant giving body co-founded by the effervescent Jo Bostock and fifth degree black belt Tammy Parlour is dedicated to fattening up the profile of women's sport in the UK. WST is for the 18-year-old Watkins of the world – those growing up in sleepy towns like Leek in Staffordshire with meagre sports facilities, maybe they're a “bit on the chubby side” and never with the inkling that they would be anything other than average at sport.

Kelley said: I'm happy very good site ventolin albuterol sulfate inhalation solution Sanghvi imagines a future in which users could extract the information housed in Datastores from, for example, a fitness-tracking app, combine that with data from a healthcare app, and hand the result to a doctor. In this scenario, Dropbox doesn’t just free apps from iOS- or Android-dependence. Instead of just letting you work on that spreadsheet from your office desktop at home on your iPad, Dropbox becomes a data liberator, a transparency tool that finally makes your personal, app-specific information independent.

Francis said: I'll put him on viagra natural para hombres en farmacias EasyJet said today that it is 67 percent hedged at anaverage price of $984 a metric ton of jet fuel for the yearending September 2014. At current prices and exchange rates thefirst-half fuel bill will be as much as 30 million pounds higherthan a year earlier, with exchange rates having an additional 10million-pound negative impact.

Gonzalo said: Incorrect PIN viagra ni dawa ya nini JPMorgan said in its filing that it had received "a requestfrom the SEC Division of Enforcement seeking information anddocuments relating to, among other matters, the firm'semployment of certain former employees in Hong Kong and itsbusiness relationships with certain clients."

Levi said: Looking for work opiniones You can find packages on websites such as, and You can also sign up for alerts on, which lets you select specific destinations to receive daily emails with the latest packages offered for those cities.

Filiberto said: In a meeting viagra netist kokemuksia The boom in Hpakant's population coincided with an exponential rise in opium production in Myanmar, the world's second-largest producer after Afghanistan. Its derivative, heroin, is cheap and widely available in Kachin State, and Hpakant's workforce seems to run on it.

Jorge said: Have you read any good books lately? pembe viagra kullananlar Plus500 is proving to be highly cash generative. In the company’s interim results it reported profits of $15.4m, supported by operating cash flow of $15.7m. “We plan to return more than half of all profits to shareholders in the future,” said Gal Haber, chief executive.

Stacey said: I support Manchester United seroplex viagra Raul Fernando Gomez Circunegui, who reportedly survived the brutal Andean winter eating rats, raisins and leftover supplies in a shelter, is accused of abusing an 8-year-old in the poor neighborhood of Cerro Navia in Santiago.

Eric said: I'm sorry, I didn't catch your name buy viagra "It's not so much the fact that you have all these federalworkers not consuming. It's the other 99 percent of thepopulation that are losing confidence in the people ingovernment and their ability to do a good enough job," saidJonathan Barratt, chief executive of commodity research firmBarrattBulletin in Sydney.

Gabrielle said: I'm sorry, I'm not interested precisa de receita para comprar viagra no brasil Just to get this Tea Party clown show over with Obama will probably agree to repealing the medical device tax to allow the Republicans to get out of the very deep hole they dug for themselves and save face. I can see them getting up in front of the whole country and making fools out of themselves all over again by saying, “We won! We won!”

Olivia said: I'm on business ed viagra Notaro, then 25, was sentenced to one year in jail in 1999 for his role in a Las Vegas telemarketing scheme that victimized elderly residents nationwide. As one of six men charged in connection to the Century Pacific Group, Notaro was also ordered to make $12,230 in restitution.

Cleveland said: I'm doing an internship diclofenaco sodico voltaren In his speech, Mr Gurria will ask if leaders overseeing the financial system that led to the "train wreck" of the banking crisis would have been happy to take the risks if they had known the consequences.

Damion said: We'd like to invite you for an interview que es mejor cialis o viagra yahoo "Our Constitution is not a Chinese buffet, which we like and do not like," the Jefferson City attorney told the AP. "The First Amendment is part of the Constitution that we must uphold. ... (And) the supremacy clause means that states cannot criminalize the activities of agents of the federal government."

Felix said: I support Manchester United clonidine er for adhd Up to 30 trainee cabin crew were yesterday told by Aer Lingus their training was being stopped and to hand back their uniforms because the airline has had to use a contractor to crew its transatlantic services.

Taylor said: How much will it cost to send this letter to ? preco cymbalta 30 mg The grenade rolled to a stop. It began giving off a black, acrid smoke. Just feet away, Kashvi stayed face down, never looking up. Keya covered her head with her arms and waited for the blast, which never came.

Jane said: Have you read any good books lately? escitalopram effects on male fertility According to MENA, the committee has proposed scrapping articles that accorded Islam more weight in lawmaking, gave the Sunni Muslim religious authority al-Azhar a role in vetting legislation, committed the state to upholding "morals and public order" and banned insults to "prophets and religions".

Dogkill said: I'd like to transfer some money to this account floxigra ciprofloxacin 500 mg kegunaan Some homeowners are choosing to limit or eliminate upper cabinets. Kitchens without uppers offer a clean look and they make a powerful statement, designers say. Storage space is one concern of many people who are considering freeing the kitchen of upper cabinets, but below-the-counter cabinets with pull-out drawers hold all the essentials.

Brendan said: I saw your advert in the paper lamisil comprim maroc Data-transmitting waves, whether they come from radios, cell phones, or computers are essentially disturbances in our natural electromagnetic fields. The crest of Wi-Fi waves are understood by a computer as a 1. The troughs are equivalent to a 0. Ultimately, these chains of 1s and 0s form an intricate pattern that is then translated into the letters, numbers, and codes that make up websites.