Firefly Algorithm is applied to optimize the ordering of test cases for software testing. Test cases are represented as fireflies, with their similarity distance calculated using string metrics determining the firefly brightness. The Firefly Algorithm prioritizes test cases by moving brighter fireflies, representing more dissimilar test cases, to the front of the test sequence. Experiments on benchmark programs show the Firefly Algorithm approach achieves better or equal average percentage of faults detected and time performance compared to existing works.