Rats and pigeons in specially designed cages (Skinner boxes).
When a rat activated a level (or a pigeon pecked a disc) it was rewarded with a food pellet.
A desirable consequence led to behaviour being repeated.
If pressing a level meant an animal avoided an electric shock, the behaviour would also be repeated.