Press escape and hover at the top left corner. You should see a bar under your name. Click on show profile to see current mastery progression.

To increase your mastery rank you have to level different kinds of warframes and weapons up to level 30. This means you SHOULD'NT EVER throw away an unmaxxed weapon.

Once that mastery bar is full and blinking, it'll prompt you to take your 2nd mastery test when you press escape again.

Level up stuff!

Once a piece of equipment you have reaches level 30, you stop getting EXP from it. So if you have a level 30 Warframe, a level 30 Primary weapon, a level 30 Secondary weapon, a level 30 Melee weapon and a level 30 Companion, you are no longer gaining EXP. You have to switch to some new weapons and start leveling them up as well.

If you hover over your icon in the top left corner, you'll see a white bar underneath the picture. That shows you how much more EXP you need to reach your next Mastery level. Once you have enough EXP, you will be prompted to perform a test. Succeed it and you will reach a new Mastery rank!

Level up your frames and weapons until you have enough affinity (xp) to take the mr test. Pass the test to up your mastery rank

An important note that hasn't been mentioned yet-- you only gain mastery XP for the first time you gain a given rank on each unique-named item. (With the exception of modular weapons, but you don't need to worry about those for quite a while and you'll know when they come up.) In other words, if you buy two Bratons, you only get mastery for one of them, but a Braton, MK-1 Braton, Braton Prime, and Braton Vandal will all give mastery. Similarly, if you get an item to rank 30 and then apply a forma to reset it to rank 0, you will gain no mastery for ranking it back up.

It’s complex, watch or read a beginners guide.