When China’s top leader, Xi Jinping, hosts President Vladimir V. Putin of Russia in China this week, it will be more than two years since the two autocratic leaders declared a “no limits” partnership to push back against what they consider American bullying and interference.

Growing challenges from the West have tested the limits of that partnership.

Mr. Xi is walking a narrowing tightrope, coming under increasing diplomatic and economic pressure to curtail Chinese support for Russia and its war in Ukraine. A tighter embrace of Mr. Putin now could further alienate Europe, a key trading partner, as Beijing seeks to improve its image in the West, and retain access for Chinese exports to help revitalize its sluggish economy.

“China sees Russia as an important strategic partner and wants to give Putin proper respect, but it also wants to maintain sound relations with Europe and the United States for economic reasons and beyond. It is a very difficult balancing act,” said Shen Dingli, a Shanghai-based international relations scholar.

Mr. Putin, for his part, may be testing Mr. Xi’s appetite for risk, as he tries to deter Western nations from more actively supporting Ukraine. Last week, while Mr. Xi was in France meeting President Emmanuel Macron, Mr. Putin ordered drills for the use of tactical nuclear weapons. The move was seen as the most explicit warning so far that Russia could potentially use battlefield nuclear weapons in the war, which Mr. Xi has explicitly drawn a line against.

The Russian leader is also likely to press Mr. Xi for more support to sustain his country’s isolated economy and its war machine in Ukraine.