Unfortunately, a good number of writers tend to overestimate how much leeway a testator has.
Noble titles, for instance, with their estates, may come with the rules built in about how the estate goes. Anne Boleyn, being made a marchioness, received a title that would descend to her male heirs of body, and how many whispers must have gone about, about how it did not specify legitimate male heirs of body. A handful of British titles can go to female heirs -- through its being explicitly included in the title, or added as a special favor (Queen Victoria's last official act was to raise a peer to the rank of Earl for his service in the Boer War, and because his only son had died in it, providing it could pass by the female line), or through its being ancient and created by writ, though there you get into the fun and games of "abeyance" (where all the daughters have equal right to it, and until all lines but one are extinct, it can't be called out abeyance). There is no way that a noble can leave his title to an illegitimate child, and quite possibly not the lands, either, owing to entails and the like.
Some countries have laws about disinheriting. The wife may be entitled to her dower regardless of what you do -- and it was often the first debt of the estate, so that everyone else had to go for scraps after her. Children may be entitled to equal shares, or some other division. Primogeniture or ultimogeniture may make you favoring another child moot.
And, of course, if it was bequested to you, there were often conditions.