ALM How to Populate Expected Actual Results in Test Run’s History
Problem – How do I populate the QC Steps Details?
I’ll be honest: for a while, I had no idea how to populate the QC Step Details for the test results of a QTP test script.

I was stumped. I thought maybe there was a secret parameter for the QuickTest Pro reporter function that I was missing. I knew there must be a way to do it using QC/ALM’s OTA API, but I never got around to figuring out — until now.
FDA Reporting and ALM Back story
While working on a project for a medical device, one of the requirements was that test result be formatted in a way that would satisfy an FDA audit. Luckily, this was accomplished using OTA.
This is what I found out:
Quality Center’s OTA StepFactory to the Rescue
Turns out it’s pretty easy to add this info to a test run’s results history for the step details. All you need to do is tap into the OTA’s CurrentRun and StepFactory objects.
Once you have an instance of the StepFactory object, it’s then just a matter of adding your values to the ST_EXPECTED and ST_ACTUAL fields.
For example — the following code will populate all the fields in the QC/ALM test lab test run step details:
Set myCurentRun = QCUtil.CurrentRun
Set myStepFactory = myCurentRun.StepFactory
myStepFactory.AddItem("Joe Debug Test Step")
Set myStepList = myStepFactory.NewList("")
stepID = myStepList.Count
myStepList.Item(stepID).Field("ST_STATUS") = "PASSED"
myStepList.Item(stepID ).Field("ST_DESCRIPTION") = "This is a debug test step"
myStepList.Item(stepID).Field("ST_EXPECTED") = "Joe"
myStepList.Item(stepID ).Field("ST_ACTUAL") = "Joe"
myStepList.Post

Next, roll it up and make a reusable QTP function that can be used by all your scripts. Since I need to use this pretty often, I create a function that I could reuse. The function’s code is:
'-------------------------------------------------------------------------------
' @Function Name:reportFDA stepName,status,desc,expectedResult,actualResult
' @Documentation:Values to enter for possible FDA audit
'-------------------------------------------------------------------------------
Function reportFDA(stepName,status,desc,expectedResult,actualResult)
Set myCurentRun = QCUtil.CurrentRun
Set myStepFactory = myCurentRun.StepFactory
myStepFactory.AddItem(stepName)
Set myStepList = myStepFactory.NewList("")
nStepKey = myStepList.Count ' This sets step count
myStepList.Item(nStepKey).Field("ST_STATUS") = status
myStepList.Item(nStepKey).Field("ST_DESCRIPTION") = desc
myStepList.Item(nStepKey).Field("ST_EXPECTED") = expectedResult
myStepList.Item(nStepKey).Field("ST_ACTUAL") = actualResult
myStepList.Post
' Clean up.
Set myStepList = Nothing
Set myStepFactory = Nothing
Set myCurentRun = Nothing
End Function
'----------------------------------------------------------------
HEY, HEY, HEY! IT’S OTA!
That’s it! With some simple OTA I was able to get the results format I was looking for.
Joe Colantonio is the founder of TestGuild, an industry-leading platform for automation testing and software testing tools. With over 25 years of hands-on experience, he has worked with top enterprise companies, helped develop early test automation tools and frameworks, and runs the largest online automation testing conference, Automation Guild.
Joe is also the author of Automation Awesomeness: 260 Actionable Affirmations To Improve Your QA & Automation Testing Skills and the host of the TestGuild podcast, which he has released weekly since 2014, making it the longest-running podcast dedicated to automation testing. Over the years, he has interviewed top thought leaders in DevOps, AI-driven test automation, and software quality, shaping the conversation in the industry.
With a reach of over 400,000 across his YouTube channel, LinkedIn, email list, and other social channels, Joe’s insights impact thousands of testers and engineers worldwide.
He has worked with some of the top companies in software testing and automation, including Tricentis, Keysight, Applitools, and BrowserStack, as sponsors and partners, helping them connect with the right audience in the automation testing space.
Follow him on LinkedIn or check out more at TestGuild.com.
Related Posts
Mobile testing is the systematic process of evaluating mobile applications to ensure they function correctly, provide excellent user experience, and […]
Love it or hate it—Behavior Driven Development is still widely used. And unfortunately still miss-understood. You’ve probably heard a lot […]
ETL stands for Extraction, Transformation, and Load (ETL). How do you test it? This guide covers what you need to know to get started.
I originally wrote this post in 2012 but I still get email asking if it is still possible to use […]


