You specifically asked for the TestFactory managed item whose id is '5' (line 2 of your code). The error tells you that there is no such entity with this id.
Did you mean to get item 5? If yes, are you connected to the right project?
You can check the entity IDs using the Admin feature that lets you run SQL directly against the HPQC project database. Do a SELECT * FROM TEST and see whether there is a row whose id is 5.