PortalKit: update execute logic to add test feature and make the whole functionality more flexible