Reuse Recorded Steps to Create Another Test Case

Hi Team,

As guided in the session i am trying to copy one of existing test case in new test case to avoid record same steps but while running it’s just launching browser and not performing further steps. Kindly help ere.

1 Like

Hi @deepikasain306,

Welcome to our community. Thank you for sharing your issue.

Can you please help provide us with video recording so that we can better support?

I often copy and paste the same first few steps of my Test Case because I open the browser to the same site. I copy and paste using the Script tab, maybe even using some other parts of another test case and Key Words in the one I’m creating. So you seem to be doing something otherwise.
Do you copy and paste to a new test case you created in the “Test Case” folder? Do you run your new TC from a new Test Suite? You seem to be doing something wrong, so as @Elly_Tran states, let’s see what you have (if possible) so we can see where you can improve.
If you have figured out what you were doing otherwise, mark your query as the solution and maybe a comment what you learned, so others can learn too.

Like maybe:
DateTimeFormatter reportFormat = DateTimeFormatter.ofPattern("yyyy-MMM-dd")
DateTimeFormatter screenFormat = DateTimeFormatter.ofPattern("MM/dd/yyyy")
DateTimeFormatter standardFormat = DateTimeFormatter.ofPattern("M/d/yyyy")

LocalDate localDate = LocalDate.now()

GlobalVariable.gReportDate = localDate.format(reportFormat);
GlobalVariable.gFormattedDate = localDate.format(standardFormat)
GlobalVariable.gScreenFormattedDate = localDate.format(screenFormat)

WebUI.openBrowser(GlobalVariable.gSiteURL)

// like it better when see all the items
WebUI.maximizeWindow()

// need to do this again after move to upgrade server OS
WebUI.navigateToUrl(GlobalVariable.gSiteURL)
WebUI.waitForPageLoad(10)

Perhaps, your test case source code is writen as such.

Please review your Test Case script in the “Script mode” and try to find out your problem.

Or, you can copy&paste the code of your test case here so that others can read it.

Do you know if your application uses “dynamic” references? Dynamic references means that your locators change every time your application is started. As an example, maybe it was:
id = menuitem_LargePurchase_67_Couches
and the next time the reference becomes:
id = menuitem_LargePurchase_4158_Couches

If this is the case, you should be getting messages that your “objects cannot be found”. You will have to change your references in order that the pathway is solid every time. Get back to us if this is the case. There is a way around dynamic references; I have them in my project2.