The paper presents an approach to generate and optimize test sequences from the input UML activity diagram. For this, an algorithm is proposed called Unified Modelling Language for Test Sequence Generation (UMLTSG) that uses a search-based algorithm, named Test Sequence Prioritization using Ant Colony Optimization (TSP ACO) to generate and optimize test sequences. The algorithms overcome the existing limitations of handling complex decision-making activity such as conditional activity, fork activity, and join the activity. The optimization process helps to reduce the number of processing nodes that leads to minimizing the time and cost. The proposed approach experiments on a well-known application Railway Ticket Reservation System (RTRS). APFD metric measures the effectiveness of our approach and found that the prioritized order of test sequences achieved 20% higher APFD score. Apart from this, the authors have also experimented on six real life case studies and obtained an average of 52.16% reduction in redundant test paths.