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

This will be 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.

For example, assume the following is your manual test case. It is a simple logging on to 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’ dialog 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 statements in your automation script to wait until the desire 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:

  1. Data entry – Data entry steps are where you are entering some information as an input to your AUT.
  2. 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.
  3. Combination – as the name implies, this is 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 the 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 it 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 the 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 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 a visibility into the test like 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 mails, 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 hard code 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 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

Let us 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 hard coded into the script. Although not advisable, it’s a start.

Step 5: Change of AUT step. Step 5 includes clicking on 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 in 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 this software testing course. If you are interested in this course check the upcoming batch schedule here.

Recommended reading


#1 Anish Pillai

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

#2 Kanif

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

#3 Dattaprasad

Very helpful post. Thank You

#4 Dhanya

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 Amita

Nice article

#6 Manivannan

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

#7 Prakash

Helpful Post.
Thanks to the whole team

#8 jcockerel

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 Adarsh

Nicely Explained….Well done team

#10 fariha

can u mail me selenium n qtp study materials

#11 Sachin

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 Swati

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

#13 Swati

@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 Gaurav K

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 Ria

Swati, That was good reading and accurate.

#16 priti

nice post

#17 Varun

Nice Post, worth reading..

#18 anon

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

#19 Punarjit

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 Shraddha

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


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 Divya

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

#23 sam

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 akimai

its up to the mark

#25 akimai

nice post

#26 lohith chandra

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 Momin

Helped me knowing more about Automation test cases.

#28 nancy

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

#29 Stella

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 Suresh

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 Raj

Helpful post.
Thank you

Leave a Comment