If there is a clash between the interests of a child and the interests of an adult, the child comes first every time.
Being a father isn't just a matter of biology. If you've accepted a child as your own, and they have accepted you as their father, you are their father, with a father's responsibilities.
Life's rough sometimes, you just live with it. "Be a mensch", as the saying goes.
As for the scenario Wolfgang gave, it's not just that the test is "surreptitious", it involves a man who is trusted as a father by the child taking advantage of that trust, in order to cause her harm. For someone to benefit from doing that would be grotesque.