DES MOINES, Iowa — For candidates in the Midwest, almost nothing tops a photo opportunity with a barnyard animal or a colorful anecdote about life on the farm.

Take Mary Burke, a former business executive running as a Democrat for governor in Wisconsin, who recently paused to check out the cows at a county fair. Or Illinois venture capitalist Bruce Rauner, who talks about his dairy farmer grandfather as a role model in his Republican bid for governor. And then there is Iowa U.S. Senate candidate Joni Ernst, who gained national attention with an ad touting her hog castration skills.

Most voters in these states don’t work on farms. Most candidates don’t either. But many of those seeking office seem to be stretching farther than ever for a barnyard background to establish some common-man authenticity.

“It’s the classic ‘I grew up in a log cabin and walked uphill to school both ways,'” said Sue Dvorksy, a former chair of the Iowa Democratic Party.

Sometimes the connection requires a bit of tractor-pulling effort.

Rauner is a millionaire with two Ivy League degrees, but his official biography stresses that thanks to granddad: “Bruce knew how to ride a horse at 6, milk a cow at 8, and shoot a rifle at 10.” Burke’s main selling point is her successes with the family bicycle company, but a key photo on her website shows her in a denim shirt in front of a tractor.

Recently in Iowa, both the governor and lieutenant governor, who do have rural backgrounds, felt the need to also assert their animal slaughter resumes.

“I held the hogs while the veterinarian castrated it,” Gov. Terry Branstad said at a June news conference.

Then Lt. Gov. Kim Reynold chimed in: “I didn’t castrate hogs, but I do know how to skin a chicken and I can do that pretty well.”

So far, they have not demonstrated those skills on the campaign trail.

Nowhere is a rural record more desirable than Iowa, a state with strong farming roots even though two-thirds of the population lives in urban areas. Candidates here trek around farms, gobble pie at state fairs and talk farm subsidies. While Ernst’s ad became fodder for late-night comedy, it also struck a chord that helped propel the state lawmaker to victory in the five-way GOP primary.

“The great thing about Joni’s ad is people relate to her,” said Rob Jesmer, a Republican consultant.

Ernst, a lieutenant colonel in the Iowa National Guard who was raised on a farm, now faces Democratic Rep. Bruce Braley in the battle to replace retiring Sen. Tom Harkin. The two are locked in a dead heat, and Ernst’s campaign has tried to brand Braley as a lawyer who doesn’t understand rural issues.

Braley’s campaign has countered that he was raised in a small town, his grandfather was a farmer and he worked agricultural jobs in his youth. But he spent time apologizing earlier this year after a video was released of him referring to senior Sen. Charles Grassley, a six-term Republican, as a “farmer from Iowa who never went to law school, never practiced law.”

Since then, Republican operatives have tried to hit Braley with a video they say shows him claiming to be a farmer at a parade and with a story on a dispute he had with a neighbor at his vacation community over her chickens.

“Bruce understands what rural Iowa is all about because that’s where he came from,” said Braley campaign spokesman Jeff Giertz.

Candidates in nearby states are also reaching for rural connections.

In Nebraska, Republican Pete Ricketts selected Lt. Gov. Lavon Heidemann as his running mate in the governor’s race, citing his dairy farming experience. His Democratic opponent, Chuck Hassebrook, has touted the fact that he lives in a rural town.

And in Wisconsin, Burke cites her ancestors as she seeks to topple Republican Gov. Scott Walker.

“My great-grandparents were farmers,” said the former Trek Bicycle executive as she pet cows at the Rock County fair.

The candidates must be careful not to overreach. Of Rauner, Ken Snyder, a Chicago-based Democratic media consultant, notes: “everybody knows he didn’t make $53 million last year as a farmer.”

Rauner’s spokesman, Mike Schrimpf, said the candidate just wants voters to know “what guided his life.”

To the folks actually raising hogs, the fixation with farming may not be a bad thing, said Chris Peterson, a lifelong famer from Clear Lake, Iowa.

Since candidates “pander to everybody,” he said, “I’m glad they’re remembering us whichever way possible.”