The first instance tantamount to an idea of imperial examination is mentioned in the
Shang shu ("Yao dian" ), long before a whole bureaucracy of testing was developed. The text describes
Emperor Yao's intent of examining abilities of his successor. Yao, one of the
Three Sovereigns and Five Emperors (traditional dates of rule approximately 2852-2070 BC), saw commencement of the
Great Flood. As he grew old in age, the Emperor Yao perceived that he would not live long enough to see the end of the flood. Therefore, he began to seek a successor, someone worthy enough and capable enough to rescue the people from this great calamity. Yao did not turn to the patriarchal system of choosing one of his sons. Yao wished to find the most talented and worthy person in the kingdom. Yao offered his throne to
Four Mountains, but Four Mountains declined. Instead, they recommended
Shun. At the time, Shun is said to have been at home displaying
filial piety. Despite this evidence of his virtue, and the recommendation of Four Mountains, Yao decided that in order to recruit a replacement for the highest of the civil service offices, that of emperor himself, it would only be prudent to instigate a series of tests. The tests included marrying Shun to his two daughters,
Fairy Radiance (Ehuang) and Maiden Bloom (Nüying), to see whether Shun could maintain family harmony at home, and ended by sending him down from the mountains to the plains below where Shun had to face fierce winds, thunder, and rain during the course of some test of unexplained mystery. Candidate Shun successfully passed this series of imperial examinations and was recruited as emperor, serving, it is said, as co-emperor, until the death of Yao. Shun and Yao both became mythological
cultural heroes, due, in part, to their fight against the flood, and helping the people to lead better lives. The story of how Yao chose Shun by seeking and testing for the most virtuous and meritorious person in the whole empire became a mainstay of
Confucian discourse, with Yao and Shun being glorified as epitomes of virtue. A likewise pattern, glorifying
merit on the expense of the family ties, is described in succession of Shun by
Yu the Great. Also, in later mythology and folk religion, the stories of the examinations of the dead in Heaven or Hell show certain parallels, in the way
Chinese folk religion typically depicts the non-mundane world and the world of humans to mirror each other. ==Triennial examination tradition==