How will I know the power [dissipation] of resistor when buying resistors?
You can only predict the resistance of a resistor, when you know its physical properties (dimension, material it is made of, etc). Then you could apply equations for electrical resistivity to determine the resistance.  

But, then, if you know the physical properties, you can also predict its power rating using equations for heat capacity or thermal capacity.

You can easily measure the resistance of a resistor using a multimeter.
To determine the power rating, manufacturers test at which power dissipation the resistor becomes too hot. They measure the temperature and power dissipation using a "multimeter" (probably a more sophisticated)
$$ P_{dissipated} = \frac{ V_{\text{across resistor}}^2 }{ R } $$
or
$$ P_{dissipated} = I_{\text{through resistor}}^2 \cdot R $$

and note the power dissipation.
Next, they likely go for safe and rate the resistor at a lower power (e.g. 95% of the measured power dissipation), but you don't know the choosen margin.
So, there is no way the measure the power rating.