How was the heritability of IQ tested?
I don't really know what you mean by "abandoned children".  Adopted children?  Children in the wild?  Have you read the Wikipedia article on the subject?  If you want to know how it was studied, just take a look at the references, it's pretty straightforward.

Heritability simply means how much variation in a trait is due to genetics, which is usually easiest to test in monozygotic twins.  Here's a good example where they did just that - they compared identical (monozygotic) and fraternal (dizygotic) twins raised apart or separately, finding:


  General cognitive ability yielded a heritability estimate of about .80 in two assessments 3 years apart as part of the Swedish Adoption/Twin Study of Aging. This is one of the highest heritabilities reported for a behavioral trait. Across the two ages, average heritabilities are about .60 for verbal tests, .50 for spatial and speed-of-processing tests, and .40 for memory tests. For general cognitive ability, the phenotypic stability across the 3 years is .92 and stable genetic factors account for nearly 90% this stability.


Here's another example doing basically the same thing.  The rest of the enWiki article gives a good breakdown of all the various factors involved in making this such a complex issue, as well as what was studied.