Test cricket is played over five days, with three sessions of two hours interspersed with a 40-minute break for lunch and 20-minute break for afternoon tea per day.
A team winning the toss of the coin (for the purposes of this explanation, they will be termed "team A", with their opponents called "team B") chooses whether to bat or bowl first, and bats either until each batter is dismissed or they choose to stop batting (called a "declaration"). There is no limit to how long they can bat provided there remain at least two batsman who have not been dismissed. The teams then swap roles, with team B batting and team A bowling (and fielding). If team B is dismissed with a score 200 runs or more behind team A, team A has the choice whether to make team B bat again for their "second innings" (called "enforcing the follow-on"), or bat itself to gain a bigger lead.
If the follow-on is enforced, team B bats until it is dismissed or declares. If team B's total score from both its innings is less than team A's score from the first innings, team A wins the game. If this is not the case, team A must bat in its second innigs to attempt to score more than team B. If it succeeds in the remaining time, team A, wins. If it is dismissed before this occurs, team B wins (though this is very unusual - teams who enforce the follow-on very rarely lose). If time runs out before either of the above occurs, the game is called a draw.
If the follow-on is not enforced, or team B's score is sufficiently large so that the follow-on cannot be enforced, once team B is dismissed or declares, team A then bats again until it is dismissed or declares, or time runs out (in which case the game is a draw). If team A's total score for its two innings is less than team B's score from its innings, team B is declared the winner. Otherwise, team B must bat again. If their total score gets to more than team A's total, they win the match. If they are dismissed before reaching team A's total, team A wins the match. If neither occurs before the scheduled end of the match, it is a draw.
Finally, if both teams end up being dismissed twice with the same combined totals, the game is a tie. With the comparatively high scores in cricket, only two ties have occurred over the entire history of several thousand test match games.