1. A computerized apparatus comprising: a processor; an interface for obtaining a test template associated with a target computerized system, the test template comprises a template segment, the template segment comprising at least one instruction and at least one directive or control construct related to the at least one instruction; a test generator configured to generate a test associated with the template segment obtained by said interface, said test generator comprises: a state simulator configured to determine a state of the target computerized system associated with an execution of the test; a template instruction or segment selector configured to select a template instruction or segment from the test template based on the state of the target computerized system determined by said state simulator; and an instruction template segment generator configured to generate a multiplicity of instructions based on the state of the target computerized system and the template segment selected by said template instruction or segment selector, wherein the multiplicity of instructions behave differently in different activations of the instruction template segment generator due to the at least one directive or control construct, wherein the test generator further comprises an instruction verifier configured to verify that a previously generated instruction is in line with the current state of the target computerized system and with the template instruction or segment selected by said template instruction or segment selector.