Genetics can be a factor. When there is an excess of Calories some people store more fat than others, and when there is a deficit of Calories some people burn more fat than others. However, for the vast majority of people, it is the quality and quantity of the foods they eat that determine their weight and risk of weight-related disease.
It is interesting to note that rates of obesity have been increasing much faster than they possibly could through genetics alone.
While there is not a test you can take yet, you may learn something from looking at your family. But if your elders are overweight, you should be as concerned with the eating habits they have passed on to you as you are with their genes.
If you are overweight and suspect that genetics may be a factor, you have a choice. You can accept it as your destiny and do nothing, or you can consider that you have that much greater reason to learn to eat well and exercise.