H.G.H. is believed to boost lean muscle mass, aid in recovery and improve stamina, but it is illegal to possess in the United States without a prescription. Although there is no urine test for H.G.H., Olympic athletes have been blood-tested for the substance for nearly a decade. Within baseball, however, there was skepticism about the test, with some critics pointing to the fact that it was not producing any positives. Meanwhile, evidence emerged that the substance was indeed being used in the sport.

In 2007, an investigation into a ring of pharmacies and doctors in Florida led to disclosures that tied numerous players to H.G.H. And at the end of 2007, George J. Mitchell, at the behest of Selig, produced a report on drug use in baseball that linked a number of players — including Andy Pettitte and Roger Clemens — to the substance.

Sentiment in baseball began to change in 2010, when a professional rugby player in England was suspended for testing positive for H.G.H. It was proof that at least some were seeking.

Selig embraced the development and several months later started the blood tests at the minor league level. This year, first baseman Mike Jacobs, who had played in the major leagues for a number of seasons, became the first minor league player to test positive for the substance.

Although H.G.H. testing may be the most notable element of the new bargaining agreement, there were other issues the two sides had to wrestle with as they moved toward a deal that will last for five seasons and will guarantee two decades of peace in a sport that endured numerous work stoppages before that.

In particular, baseball wanted a tougher financial slotting system for draft picks to better control what teams now spend on players coming out of high school and college. In the end, the sides agreed on a luxury tax of sorts that would penalize teams that go over an overall threshold for money spent signing picks. In addition, the system of free-agent compensation, in which teams surrender first-round picks in exchange for signing a Type A player, is being eased and there will be changes to the system that governs the signing of players from outside the country.

But perhaps most significant for Selig and everyone else in the sport is that an overall agreement is within reach without public rancor in a year in which the N.F.L. went through a protracted lockout and the N.B.A. is in a labor standoff that could cost it the 2011-12 season. And that the agreement will have a drug-testing clause that will put baseball ahead of other sports.