test case bug fixed and code reduction

Wrapped <input> inside <div> and generated <input> using a for loop