refactor to share logic between testrails and work