So there are two main problems:
- people who are planning to do harm when they enter
- those who might latter become radicalized (changed to want to do
The second set is very hard to detect because you essentially are trying to predict the future thoughts of a person, which has never been done reliably.
You would like to test for both, so you must ask questions that will work even if the subject lies and probe for unconscious mind sets that might lead to radicalization. A very important point is with either it is very likely to get false positives.
If the test is clearly a test then people can lie about their intentions and people who don't yet intend to do harm will pass right through.
Here are three factors that might help:
The first and best option is a test that is not obviously a test,
or appears to be a test about something else. A friend from the old
country that you happen to meet that talks about his beliefs. A test
of the local language that subtly probes word associations. This
lets you ask about a persons mind set without having to deal with
Second would be length, get a test that goes over a long time to
ware down liars and get as much information about the subject as
Third you can also focus on unconscious or hard to manipulate
signals (heart rate sweat breathing pattern) the problem with all
of these is they only detect stress which could result from worrying
about not being allowed in(normal) or worrying about being
caught(what you are trying to detect)
As Ethan Chapman pointed out, since the second type could include people already in the country at the time the test is implemented, for completeness the test would have to be run on all residents of the country. This significantly raises the cost.