Edward Thorndike is seen as the person who showed us “how to manage a trial and error experiment in a laboratory”. This video shows how an experiment like that took place:
For people who want to read more from Thorndike here is a great resource:
…This is fantastic – classic C19/20th psychology papers, online.