Having a strong vocabulary allows you to communicate well with others and to succeed on standardized tests. Teachers teach vocabulary to students in their first language as well as to students who learn a foreign language. Methods of assessing vocabulary differ depending on your aim in testing the vocab knowledge.

If the aim is simply to determine whether a person knows a word, the best way to assess vocabulary is to ask them the definition of the word. This means that if a teacher assigns students a list of vocabulary words to learn, the easiest way to assess whether a student has mastered these new vocab words is to give them a closed book test in which they must provide the definitions.
However, this type of formal test is an incomplete method of assessing vocabulary. First, it is incomplete because it is artifical. It is rare for a person to encounter a word in an isolated setting and be asked to define it. The true value of knowing a word is to be able to use it; and knowledge of a word is often easiest to obtain if the word is used in context. Therefore, the best methods of truly assessing whether a student has mastered vocabulary is to see whether a student can use it properly in context, or recognize and discern the definition in context.
Assessing vocabulary is difficult because the true measure of a persons vocabulary isn't just whether they have memorized a list of words, but is instead how many total words they know overall.
Reading First Ohio also points out that additional problems arise in assessing vocabulary because "it is difficult to pin down what is meant by knowing a word." This website, which explains both how students should learn vocabulary and how students should assess vocabulary, explains some of the commonly accepted mechanisms used to assess vocabulary in schools. These mechanisms include:
Some of these mechanisms are better than others. In general, the best assessment is one that gives you a true picture of the number of words a person knows, as well as an understanding of how developed the individual's abilities are to determine the meaning of the word from context clues.