API:UnitCastingTime

Parameter

 * unit
 * String - the UnitID (e.g. "target", "party1", "raid1", etc..)

Returns

 * name
 * String - the localized name of the buff currently casted
 * maxValue
 * float - the total duration for casting the spell.
 * currValue
 * float - the current time already spent for casting.

Check if Target is casting
If for some reason you want to check, if the target is casting, you can try to compare the name of the spell to nil: