For months, Minnesota’s candidates for governor have been eating too much pastry and drinking too much burned coffee as they trek from Woodbury to Willmar and Marshall to Mankato.

They’ve marched in parades and listened to questions, rants and combinations of both. They’ve told the same jokes and stories to polite laughter and explained their views on health care, taxes and guns to crowds both large and — just as frequently — very small.

In that time, a dozen serious contenders were whittled down to half that. Now, the most dedicated political activists from both parties are gathering next weekend for state political conventions where they’ll endorse their candidates for the state’s top political job.

“It’s been a long campaign. Test one is coming up,” said Jeff Johnson, the Hennepin County commissioner who was GOP nominee for governor in 2014 and is seen as a favorite for the GOP endorsement as he tries again this year.

The endorsements for governor are the marquee events at the Republican convention in Duluth and the DFL convention in Rochester. But the party gatherings also kick off a five-month sprint to November in Minnesota’s most momentous election year in decades: In addition to governor, the two parties are competing for two U.S. Senate seats; eight U.S. House seats, at least four of which could be national priorities for both parties; state attorney general and two other statewide offices; and control of the entire Legislature.

In the case of Republicans, the roughly 2,200 delegates expected won’t decide the party nominee. Former Gov. Tim Pawlenty will skip the convention and take his campaign straight to the GOP primary on Aug. 14, meaning he’ll compete with an endorsed candidate bearing the party imprimatur and organizing resources that come with it.

Greg Bartz, chairman of the Brown County Republicans, said Pawlenty erred in forgoing the convention.

“He needs support in the trenches to do the tough political work,” said Bartz, a veterinarian who is supporting Johnson instead. “He has more experience and a good handle on the issues that are important to us, especially in Greater Minnesota, which sometimes gets ignored.”

On the DFL side, U.S. Rep. Tim Walz is widely seen as front-runner, but he faces tough, well-organized challenges from state Rep. Erin Murphy and State Auditor Rebecca Otto. Walz has left the door open to a primary bid without the endorsement, but winning it would make him the heavy favorite for the primary — giving him months to preserve money and campaign without serious intraparty conflict.

The candidates from the two parties offer starkly divergent visions of the state’s future. Republicans want to sweep away the legacy of DFL Gov. Mark Dayton, who raised taxes and heightened the rate of state spending growth, especially on education. They want to repeal what they say are burdensome regulations on agriculture, and business more broadly.

The DFL candidates trying to win over the roughly 1,400 delegates are expected to promise to protect Dayton’s legacy and expand on it, including paid family leave, universal health care and better access to child care. Each have said they would support legalizing recreational use of marijuana, a change that has spread to a growing number of U.S. states in recent years.

For both parties, immigration has emerged as a leading issue, though from opposite perspectives.

“If there’s one consistent message across the entire state it’s security, and the exploitation of social [welfare] benefits,” said Phillip Parrish, a Naval reservist seeking the Republican endorsement on a promise to shut the door on refugee resettlement in Minnesota. Parrish said Republican voters were galvanized by a recent television news report, which alleged that money stolen from the state’s child care program was in some cases sent overseas and into the hands of radical groups.

The DFL candidates are making appeals to the party’s younger, more racially diverse base. At a recent forum hosted by Faith in Politics, an interdenominational political group seeking to push the debate in a more progressive direction, each of the DFL candidates said they would refuse to use any state resources to help carry out the Trump administration’s agenda on immigration.

“That’s who we are and we’re going to ensure that we fight side by side,” said state Rep. Peggy Flanagan, Walz’s running mate. She mentioned Pawlenty’s recent attack on Walz for supporting so-called “sanctuary” policies on immigration.

“When Tim Pawlenty attacks us for saying that we want a sanctuary state, we say ‘Yes, that’s absolutely correct,’ ” she said.

Walz, who represents southern Minnesota’s small cities and rural areas in Congress, has tried to leverage Flanagan’s appeal to progressive groups in the Twin Cities. The leader in fundraising on the DFL side, he has touted his ability to win votes in his congressional district and in other parts of greater Minnesota. He argues that the DFL’s best shot is a candidate who could harness the party’s traditional turnout advantage in the Twin Cities while holding their own in the more Republican-leaning remainder of the state.

Murphy has been charging hard after Walz. In recent weeks, she has piled up key labor endorsements, though Walz also secured a few big ones.

At a Faith in Minnesota event last week, Murphy took a shot at Walz over his 2015 vote to delay and toughen security checks for Syrian and Iraqi refugees, a vote he has since said he regrets. “We saw Congressman Walz take a vote against Syrian refugees, women and children fleeing war in a country — that kind of caution in the short term to win an election is no good for us and we see that in our politics all the time and that is what we must stand up against,” Murphy said.

Otto, who finished second to Walz in the February caucus straw poll, is telling delegates she is the progressive alternative. She’s touting detailed plans on health care, climate change, two years of free college for all Minnesotans and a state bank.

“We’re Pawlenty’s worst nightmare,” Zarina Baber, Otto’s running mate, said at the Faith in Minnesota forum.

On the GOP side, Johnson dominated the February statewide precinct caucus straw poll. But Woodbury Mayor Mary Giuliani Stephens is drawing close, winning the Seventh Congressional District convention straw poll.

“They’re looking for a different candidate who brings a different perspective,” Giuliani Stephens said of Republican delegates. “I’m not part of that political machine and gridlock of the past.”

Both parties see huge stakes in the governor’s race. Republicans, with a losing streak in statewide races that reaches back more than a decade, hope to build on the rightward drift of state legislative races in recent years. And for DFLers, losing the governor’s race would likely leave the party shut out of power in St. Paul — and a Republican governor and legislative majority with the ability to transform Minnesota’s government into something more like Gov. Scott Walker’s Wisconsin.

The next governor will also oversee redrawing of congressional and legislative district lines after the 2020 census, which will shape the state’s politics for the next decade.