How to Translate Manual Test Cases into Automation Scripts? – A Step by Step Guide with Example

This will be the basic “how-to” article and is not any Automation tool-specific. Basically, what I am trying to do here is put the thought process that goes into creating an Automation test case into words. As always, I hope this will be useful to you all.

How To Design An Automation Test Case Or Script?

Automation always follows Manual Testing. Typically, one or more rounds of Manual Testing already would be performed on the AUT. This implies that Manual Test cases already exist and have been executed at least once.

_Translate Manual Test Cases into Automation Scripts

For Example, assume the following is your Manual Test case. It is simply logging on to the site. Now, this looks simple enough, isn’t it? How does this become an Automation Script? (click on image to enlarge)

Manual Test case

How To Translate This Manual Test Case Into An Automation Script?

Automation testing process

The following are the guidelines we are going to follow to achieve the translation into an Automation Script:

#1) State of the AUT: The column precondition is nothing but a particular state of the background to be set for a certain step to be executed. This is especially important in two scenarios:

  • To begin the test:  In this case, we need the browser available and launched. (The username and password availability will be dealt with in a little while).  Now, how to write the same thing in the automation world? Consider QTP. You have an option to either launch the browser using programmatic statements or you can use the ‘record and run setting’ dialogue to set the properties. Setting these properties correctly is very crucial. Often this is the reason why a particular piece of code will work in a machine and won’t work in the others.
  • To execute a certain step: For step2 to be performed we need step 1 to be done and complete. To do so manually, we can just wait until the step execution is done and the page gets loaded fully.  Use the sync or wait for statements in your automation script to wait until the desired state comes true.

Note:  When you are running the same code for multiple sets of data, you would want to make sure that you are returning the AUT to the state that it should be before the next iteration start.

#2) Test Steps

We can categorize the Manual Test steps into 3 categories:

  • Data entry: Data entry steps are where you are entering some information as an input to your AUT.
  • Change of AUT state steps: these steps are the ones that will cause a change to happen to your AUT. It might include going a new page, a certain field being visible, an edit box being editable, etc.
  • Combination: as the name implies, this is the combination of both of the above types. Take the case of a checkbox, when turned on will make a certain field active. In that case, you are entering the value “True” for the checkbox field and it also results in a state of your AUT.

In the above test case, only type 1 and 2 steps exist.

  • Type 1: test steps 2 & 3
  • Type 2: Test steps 1 & 4

The pre-requisite to creating an Automation Script using any tool is to spend some time analyzing the tool as well as AUT. Try to see how both of them interact with each other. For Example, QTP has 3 recording ways and each one works a different way.

If you know how it identifies objects, you would know which one to use and use them better.  If you have a web app where QTP can identify the objects easily, you can use the normal mode. If not you might have to use the analog or low-level methods.

Automation Steps:

  • Data entry steps are not very different in Automation and Manual methods. All you do is enter the data. The way you reference the field is different. Since it will be machine performing the steps, we just have to make sure we refer to the fields in the AUT in a way that the tool understands. That means you have to use its logical name as used in the code.
  • For Change of AUT /Combination steps in a manual scenario, you perform the action (clicking or checking or entering) and verifying the change at one go. But in an Automation scenario that is not possible. So we have to make sure we add steps for action and validation/verification.
  • Comments for readability.
  • Debugging statements – these are especially important in which you are creating and testing the test itself. Try to use message boxes frequently to output various values at various stages of test execution. This will give you visibility into the test as nothing else would.
  • Output statements – to write to results or any other external place like a notepad or excel sheet.

#3) Verification and Validation

Without Verification and Validation, the intent of testing is lost. Typically you will have to use a checkpoint (does not necessarily mean the inbuilt ones). So you will have to use a lot of conditional statements and also loop statements to build the logic.

An important thing to consider is- the attribute based on which you are basing your V&V should not be ambiguous. For Example, for successful login, look for the inbox page display not for the number of new emails, because that is not a constant value.

So you have to pick something that is true every time a set of operations happen – without fail.

#4) Test Data

The following are some of the questions that you might consider answering for your Test Data requirements:

  • Where to place it?
  • To hardcode or not?
  • Security concerns?
  • Reusability concerns?

When you look back at the manual test script, you will notice that having the test data, the username and password available is one of the preconditions to even begin the test.

#5) Results

For a Manual Test case, you can put the result of each step in the “Actual Result” column. An Automation tool’s result file contains the result of each step when executed.

Automation tools these days have very robust reporting features. However, you might still need to tailor the Test Results. So include the steps to write frequently to the result file so that you will know exactly what went on while the execution was happening.

If the tool you are using does not support writing to the result file it generates, it is a good idea to have at least an excel sheet or notepad associated with each test to put in comments about the execution status as you go.

#6) Post Operations

Once you are done with testing it need not be explicitly mentioned in your Manual test case to close the browser or close the AUT etc. As a tester, you would do it diligently. In the case of the Automation test case, you can include these steps in your script. Clean up – is what I call these activities. Kill all the connections you created. Close all the apps. Release the memory.

Using these guidelines I translate our Manual Test case into a QTP Test Script that uses VB Scripting. The following is the result: (click on image to enlarge)

Manual to automation testing

Walk Through Each Step

Step 1: Precondition. We are launching the IE with the URL programmatically.

Step 2 & 7: Sync statement. As we discussed above, these are important to making sure the AUT comes to the desired state before the next step execution follows.

Step 3 & 4: Data entry. All the data is hardcoded into the script. Although not advisable, it’s a start.

Step 5: Change of AUT step. Step 5 includes clicking on the Sign In button. You will not need a V&V when this statement gets executed. That is because there is a subsequent statement and if that can run; it means the one before it has been successful. But if you are extra diligent, you can include one here.

Step 6 & 8: Comments

Step 9 & 11: Conditional statement. V&V/Checkpoint. We are trying to see if the login has been successful by checking if there is an inbox link on the resulting page. If you note carefully, link with inner text, “inbox.*” is looked for. So irrespective of any number of new emails(which is variable) received, if you have an inbox link(which is always a constant) available, that means the checkpoint passed.

Step 10: Message box. For visibility

Step 12 & 13:  These are the cleanup activities. You are signing out from the account and closing the browser.


So, you see how easily an Automation script unfolds when you have a well-written Manual script and a set of basic guidelines to follow. Since this is not an article concerning frameworks, I stayed clear from functions, reusability factors, parameterization, etc. Test script being the fundamental building block, it is easy to improvise on a script when you have the basics right.

Are there any other factors you consider, another method you find easier or any guideline that you find hard to follow? Please let me know your feedback in the comments.

This post is written by STH team member Swati Seela. She is having more than 9 years of Manual and Automation testing experience of working with various MNCs. She is also our instructor for the Software Testing  QA Training course. If you are interested in this course to check the upcoming batch schedule here.

PREV Tutorial | NEXT Tutorial

Recommended Reading

37 thoughts on “How to Translate Manual Test Cases into Automation Scripts? – A Step by Step Guide with Example”

  1. Nice article.. Breaking up of step #2 into the 3 different parts made it very easy to understand..

  2. Good explanation, thanks for the post, Its really help to start thinking on how to start translating manual test case into automated script.

  3. Very helpful post. Thank You

  4. Thank you very much Swati Seela! This article will be really helpful for a beginner in automation testing. Looking ahead for your valuable articles in future!

  5. Nice article

  6. Nice Article, Helped me to rewind things which i have learned long back..

  7. Helpful Post.
    Thanks to the whole team

  8. after reading and studiing this. it makes me feel (1) realy excited about the upcoming course, because you made reading and studiing this concept of automated testing very simple. (2)lets me also know that swati and team know what and how to teach a course. Lets do it i am ready

  9. Nicely Explained….Well done team

  10. can u mail me selenium n qtp study materials

  11. Hi,
    Its really nice explanation.

    Regarding Automation Testing I have some questions in my mind..

    Lets say in the case above..
    What is need to write Auto test for the Gmail Home Page ?
    we can check this manually in best way..
    what are the advantages of Automation Testing over Manual ?
    can you explain with some effective examples.
    As i think if we have Number of inputs to Check like 1000 numbers, or Probabilities then only Automatic testing is preferable.
    Still we can see that Automation Testing is more popular than Manual …
    I think Automation Testing is Time Consuming
    as if we want to make Script for any lengthy Scenario we have to use plenty of Codes , all should be exact so that machine or tool should not perform any step wrong..
    So how the Automation is ruling in Testing Filed .

    Please let me know strengths of Automatic testing on manual..


  12. @Sachin: Thank you for posting such wonderful questions that I am sure are in many other

  13. @Sachin: Thank you for posting such wonderful questions that I am sure are in many other tester’s minds too.
    Here are the answers:
    1. you are right, you dont need to automate login for gmail. It is done for 2 reasons: one- it is simple enough for everyone to follow and understand, so i picked that. two – imagine if you are testing the compose mail functionality, you will still need to login and then test the compose mail. So it is the basic building block even if it is not a test on its own.
    2. Typically, when we are performing the same task repetitively or using tremendous amount of data we use automation.
    3. Automation is time consuming and costly too – so its not for small projects and as with anything else, we have to decide on the benefits vs the efforts and then make a decision on whether to use it or not.

    automation testing has immense potential. It is the closest thing to magic we have in our QA field so thats why it is gaining popularity.

    I hope I have answered your questions.

  14. @sachin
    Automation is used where you know each and everything and its a repetitive work.

    Let me Give you one example. “Lastpass” is a software which will keep all your password in a vault and whenver you login to, it will give you the option to autofill

    Is it not good that i need not to enter my password again and again when the system can remember it.

    Automation is not the replacement of manual and keep in mind its a one time investment. It should not be applied everywhere.
    But can be applied if the work is repetitive like Regression, Sanity, Smoke test.

  15. Swati, That was good reading and accurate.

  16. nice post

  17. Nice Post, worth reading..

  18. what can you say about people who says they do automation without doing manual testing…

  19. Hi Swati,
    I think it is also advisable to take into account, the else part is If statements.
    For Example:
    After msgbox “successful login”
    we can add:
    msgbox “Login Failed”
    Thanks for the useful article 🙂

  20. Can you plz suggest me any mobile application security testing tool?

  21. i am new into software testing..i know the manual testing method..i want to learn automation selenium software free??

    One query i am having is that ..the script you wrote for QTP..can the same script be used in selenium tool..

    Waiting for your reply as soon as possible..

  22. Thank u for this post,its realy very helpful.Can you add more examples of programs from manual to automated?.Thank you.

  23. Hi
    From past 2 years i have been working on manual testing need to start with Automation testing
    My question is :
    1) Wich tool is best to start by own for practicing (having little codding knowledge not so much in depth)
    2) what are the steps to follow in automation testing
    2.1) How to start ?
    2.2) How to Prepare ?
    2.3) How to Execute ?
    2.4) How to Track ?
    3) How to raise or track a bug when we are using automation testing

  24. its up to the mark

  25. nice post

  26. My question is :
    1) Wich tool is best to start by own for practicing (having little codding knowledge not so much in depth)
    2) what are the steps to follow in automation testing
    2.1) How to start ?
    2.2) How to Prepare ?
    2.3) How to Execute ?
    2.4) How to Track ?
    3) How to raise or track a bug when we are using automation testing

  27. Helped me knowing more about Automation test cases.

  28. Nice information about Automation Testing script thanks for sharing.. Automation online training

  29. Very good information about test Automation.Thank you very much for this information.This article makes it clear that is very easy to learn Automation.

  30. Hi i am new to the testing BU having good command over Java,C++ .But unfortunately had to work on manual testing, could u please suggest me where can i use my coding skills apart from automation testing.

  31. Helpful post.
    Thank you

  32. Hi!
    I just have a question – who is responsible in creating the manual script? (Manual Tester or Automated Tester)

  33. can i have the files to create automated testcases in excel

  34. Awsome post thanks

  35. Well written article! Easy to understand as it is described in sequential manner. Also describes how manual testing is essential thing before trancending towards automation. Thank you @Swati

  36. Thank you so much.

  37. Please do another example that is not login. Everyone only does login example.


Leave a Comment