trial and error
US /ˈtraɪəl ənd ˈer.ər/
UK /ˈtraɪəl ənd ˈer.ər/

1.
the process of experimenting with various methods of doing something until one finds the most successful
:
•
Learning to ride a bike is often a process of trial and error.
•
We found the best solution through a lot of trial and error.