GUI testing is an area of growing importance, facing a number of severe challenges. A few methods have been proposed for GUI testing. However it is still not clear how to define GUI test cases and how many actions should be comprised of a GUI test case. In this paper we propose an approach that defines GUI test cases as a sequence of primitive GUI actions and treats GUI test suites as an inner hierarchy of formal language. This is not only theoretically solid but also practically convenient. The dimension of a GUI test suite and the order of a GUI test case can be defined uniquely. A convenient procedure is available that generates higher-order test cases from lower-order test cases. Three testing experiments with a real-world Internet browser reveal that second-order test cases may significantly outperform first-order test cases in GUI testing and should be generated to perform particular GUI functions. In addition, the number of actions applied during testing should be used to replace the number of tests performed during testing to evaluate the effectiveness of GUI testing processes. This paper provides a potential link between formal language theory and GUI testing.