Software testing is done manually from the day the software development started. But manual testing has shortcoming that many times became the reason of software failure. So, automated testing comes into picture and Unified Modeling Language (UML) a tool helps to automate the testing process. Two different UML diagrams, Activity and Sequence used to automate the testing process. These diagrams are converted into graphs using algorithms and finally combined to form System graph. This system graph is then traverse to generate the test case and as both diagram consider the whole system for analysis and consider all the cases. The final test cases generated are optimized also.