Too much stuff inside the if, should be factored to a function like _runWebTest...