It is a lot like the "cmp" instruction and is often found right before a conditional jump. The difference is the "cmp" instruction uses subtraction to compare them and set the flags while test uses a bitwise AND.
The most common usage of test is to see if a value is 0 or not:
test eax, eax; eax & eax == 0 only if eax == 0
jz .L1