Khefre is a god of renewal whose holy animal is the scarab beetle. In the Test of Khefre's Children, you selectively breed beetles to produce offspring with intricate and brightly colored patterns. These beetles -- technically, statues built to resemble the beetles -- then compete with others in one of several Beetle Gardens found throughout the land, where Egypt's citizens vote on the most beautiful designs.
Winning a beetle competition enables you to compete at a higher level. Additionally, winning Level 1 and Level 2 competitions qualifies you to learn the Indonesian Bee Care and Silkworm Farming skills, respectively. By winning a Level 3 competition, you pass the Test of Khefre's Children.
(For a complete guide to raising beetles, see this article.)
Beetles are bred in a beetle terrarium, which requires the Entomology skill to build. They eat cabbage. Beetles stud, so 9 females and 1 male breed almost twice as fast as 5 females and 5 males. Be careful not to let your terrarium get too crowded (death rate worsens steadily from 15 to about 30) or the cabbage run out, or the beetles will die. It may take a lot of generations of beetles to breed a good one, though they breed pretty fast. Fast enough that you should NEVER sign off with beetles in a terrarium; they will almost certainly overbreed and die. You can stash them in chests, where they won't eat or die.
Beetles are entered into competition by bringing them to a beetle garden and building a statue in one of the alcoves. You may only enter 1 beetle in a contest per week (note that's measured in TeppyTime). Note that a beetle which is not 100% yours may not be a valid beetle to enter (cutoff is somewhere around 90%). You must have a certificate from a Level 1 competition to enter a Level 2 competition, but you are not required to use the same beetle; the same is true for Level 3 competitions. Passing a Level 3 competition passes the test. Once judging ends, the owners have a few days during which only they may tear down their statues, so that they can reclaim materials (note that a spouse can do the tear-down too). After that anyone may tear them down to clear the garden for the next competition. The amount returned from tearing down a beetle is dependent on your salvage level.
Winning a level 1 competition allows one to buy the skill to construct and tend Indonesian Beehives. Winning a level 2 competition allows one to buy the Silkworm Farming skill. Winning level 3 passes the Test.
The ranking system for beetles is actually based on the number of unique beetles that your beetle has beaten. People voting on the garden determine the placement of the beetles and points are calculated based on how many unique beetles were beaten. At level 1, you must beat 4 other beetles to place (hence 3 passes at level 1). When you enter a beetle into level 2 or 3, the number of beetles you've beaten at previous levels will count towards whether or not your beetle advances, regardless of how it places - hence is is possible to have variable numbers of beetles advance in the later ranks. It is important to emphasise that it's unique beetles beaten, so if you beat beetles at level 2 that you've already beaten at level 1, they don't count towards your score.
(The wins are actually recorded on the beetle certificate you use, meaning you can enter different beetles at different levels - you're actually competing against other people's certificates, but it's easier to explain in terms of beating other beetles. So for a level 2 certificate, it has the names of all the players (not beetles) you beat in round 2, and all the players *they* beat in round 1. The total number of unique names is what matters for determining an advancement. Note that because player names are recorded, not beetle names, you can beat a new beetle from a previously beaten player and not gain points.)
You can determine how many wins your certificate has by examining it (tests->Khefre's Children menu when holding the certificate in inventory).
The scoring system is designed to prevent 'incestuous competition' - winning against players you've already beaten (possibly by proxy). However, this means that it will be impossible to pass the higher ranks until the beetle population in competition is large enough.
The following example will hopefully show how scoring works (note that it refers to 'beetles' for ease of comprehension, but means 'players owning the competing beetle'):
Now, A has beaten B, C, D, E and F, G (7 points), while F has beaten B, C, D, E, G (6 points) and C has beaten B, D, E, G (5 points). Say some of these beetles compete with others in a rank 2 garden (which have also won level 1 contests), it might look like this (second level indent shows which beetles each has beaten in the past):
If A, C and Y place first, second and third by votes, they will have beaten other beetles as follows:
Accumulating all these, A has directly beaten B, C, D, E, F, G, F (again), C (again), V, X, Z and by beating beetles in rank 2, it has beaten (B, C, D, E, G), (B, D, E, G), (X, D, P, Q, R, S), (P, Q, R, S), (C, I, J, K), (C, I, J, K, Y) by proxy. These are all combined into a single list as follows:
In total, this is 41 'wins', but only 18 unique wins, so A now has 18 points. Because C & F competed with A again (they were in the first rank-1 with A), A does not gain extra points from having beaten them again. Similarly D was beaten by V in another rank-1, and A has already beaten D in the past and does not gain from beating D via V. However, A does gain from having beaten other new (to A) beetles by proxy.
To advance from rank-1, your beetle needs to have 5 points. To advance from rank-2, you must have 15 points. Advancing from rank-3 and passing the Test requires 70 points.
In this example, A will advance to rank 3 with 18 points, having beaten (A, B, C, D, E, F, G, I, J, K, P, Q, R, S, V, X, Y, Z).
The theoretical maximum points are 7 points from rank-1, 49 points from rank-2 and 343 points from rank-3 (assuming all beetles are totally unique).
See also: notes on beetles, Locations of Beetle Gardens, Contests