[BUG #7810] move code outside of testcase