Do native speakers explicitly learn about 4 tones in school or do they naturally pick them up without formal education? If so how does the school test it? By having students write appropriate tone marks on words? Or do they have oral tests?
I think there are two different ways to read the first part of your question:
1. Do children learn how to say words with the appropriate tones prior to going to school?
2. Are children explicitly aware of the tones they're using. (e.g., When they say 中国, do they know or could they explain that 中 is zhong1 and 国 is guo2)?
The answer to #1 is (obviously!) yes. It's their native language, so of course they pronounce it (more or less) correctly, and that includes the tones. The answer to #2 is mostly no, and instruction in school builds that explicit knowledge.
To make an analogy to English speakers, consider stressed and unstressed syllables. Children who are native speakers of English correctly stress different syllables of multi-syllable words. In "computer" they will stress the 2nd syllable, and in "telephone" they will stress the 1st. But if I were to ask my 4-year-old son "Which syllable is stressed in the word 'computer'?" he wouldn't be able to tell me. When he gets older and begins to understand syllables and patterns of stress in English, he will gain that explicit knowledge. (Though as Gangosa notes in his/her answer, you can speak English just fine without it.)
One additional point: As EmmaXL states in her answer: "Pinyin is to assist students to learn Chinese." More specifically on the mainland, explicit knowledge of pinyin helps students' Chinese move closer to standard Putonghua. With such major differences between dialects of Chinese, this explicit instruction is necessary to get everybody speaking (mostly) the same language.
Native speakers explicitly learn about 4 tones in school (mainland China).
Schools test Pinyin, tones are included as they are a part of Pinyin, but as students move to higher year levels, Pinyin are no longer tested because Pinyin is to assist students to learn Chinese.
There is no oral test for Chinese in mainland China so far.
As a native speaker, I had been speaking Chinese with tones ever since I could speak at all, and I could speak both Mandarin and my local dialet, both with tones. My parents perfer to speak Mandarin and my grand parents speak the local dialect only. I found that there were some "subtle" differeces between their Chinese (My local dialect has 4 tones, too (but different from Mandarin), and some characters are pronounced slightly differently. But the differences are quite systematic.), but as far as I can remember, I had no problem speaking Chinese in either "style", depending on who I spoke to. That was way before I went to kindergarten.
It surprised me, however, when I learned English that I found English does not have tones.
I learned Mandarin as a foreign learner and had to memorize the four tones, although they came pretty naturally to me after some point. However, I'm for most purposes a native Cantonese speaker, and I never "formally" learned the six tones. (I did not even realize that there were six until I saw an illustration, and I still don't "consciously" know the rules for tone sandhi.)
My Chinese language education might have been unorthodox (I picked up Chinese from family, which probably is the case for many in the diaspora as well), but I don't recall native Cantonese speaker relatives who went through a more standard education intensively learning about the different tones of Cantonese.
I'm not sure of the extent to which this maps to native Mandarin speakers learning Mandarin in school (in places where Chinese is used officially), particularly since there could be some regional variation. But at the very least, it's reasonable to assume that the four tones will come naturally to a child in a family that speaks Mandarin.
You're right, in standard mandarin there are 4/5 tones (一聲,ˊ,ˇ,ˋ,˙) depending on how you want to call it. Kids pick them up naturally by listening to adults and watching cartoon. The hardest ones to master are the 2nd(ˊ) and 3rd(ˇ).
At what age do children master their use of tones? Around elementary school 3rd grade, because the ㄅㄆㄇ (bopomo) are not shown in the text books at 4th grade.
How can you test for the tones? It can only be tested using a written test. If you buy elementary school blank writing papers, they have an extra section for kids to write the pronunciation. Regular writing papers though, will not have that extra section.
link to pictures of children's writing http://pchomekids.pixnet.net/blog/post/30513011-%E3%80%8A%E8%A6%AA%E5%AD%90%E7%AA%A9%E3%80%8B%E3%80%90%E5%AD%B8%E6%A0%A1%E5%A5%BD%E5%A5%BD%E7%8E%A9%E3%80%91%E5%B0%8F%E4%B8%80%E6%96%B0%E7%94%9F%E5%AD%B8%E5%AF%AB%E5%AD%97
Interestingly, children tend to use ㄅㄆㄇ (pronunciation) more than characters. If they don't know how to write a character, they will use its ㄅㄆㄇ. Even more interesting, is how they teach Chinese to adults in America. No basics, only character memorization!
Just on a side note: English is a stress timed language with heavy doses of schwa to regulate the stress. Most speakers of English a) do not know this and b) never learn this, but they speak like this anyway.
You can find a lot of videos about this on youtube.