Creating a common test case to logout of a application

Hi, I’m new to Katalon Studio and am working on a POC to see if this product is fit for purpose.

I have an application where the user logs in, does a search and clicks on a Search button to gets a list of results and then clicks on a result item to view details. Each page (search, list of results and view details) all contain a user profile menu that allows the user to logout. The logout objects e.g. link_logout is the same on each page - however it seems the Object Repository creates a separate folder for each page with the same link_logout object.

Is it possible to create one Logout test case that can be used to log out from one link_logout object from any page? It seems I need to create separate logout test cases for each page and I do not want to have to create duplicate test cases to logout depending on which page the user is currently on.

Thanks!

I think it is totally up to you how you set up your Object Repository. It sounds like you are using the Web Recorder to get the elements on the page. The Web Recorder is just a Helper to get you started. However, if you only want one object to represent them all, then as long as the xpath you use is the same for all the buttons for each page, go with the way you want. Maybe you can create a folder called, Common, or something like that and put “common” elements like your logout button in it. You can just use Drag and Drop to move your objects.

1 Like

As it should be… You should be raising an issue if it weren’t.

No no no. Object Repository is where the Test Objects, that are not created programmatically, are stored. These could be Test Objects that you create yourself, or like you’re probably doing, with the Recorder/Web Spy.

The latter would definitely, by default, create them for each page. It sounds like that’s the last thing you’d want…

Here’s what I would advise instead: create the Test Objects manually. This may require you to learn about things like HTML (you should already have working knowledge of that before you take on this web testing stuff :stuck_out_tongue: ) and … xpath :scream: Don’t worry: here’s a cheat sheet for learning xpath, it’s the same one that I refer back to from time to time!

But what about the Test Objects in the Object Repository that already exist?!

No worries, we can move them and create our own folders. In your case, I would do what @grylion54 said, and create some Shared repository folder, or something similar. Do that, with your shared Test Objects, delete all the other duplicates, and switch to using that shared repository for shared stuff like profile menus and log out buttons, across all your test cases.

Thank you @grylion54 and @mwarren04011990 - the object has the same xpath for the logout objects so I’ve used your suggestion to create a shared repository folder and is working as expected.

I was not using the Web Recorder to get the elements but the Object spy to grab the objects and then inserting them into the correct folders in the Object Repository - I was able to create a “common” folder and any object that is shared across multiple pages, I pop it in there.

I’ve previously used TestComplete which is quite similar with a Name Mapping repository for storing objects and their respective xpaths. Thanks for your help!

1 Like

So glad that we were able to help!

Please mark one of our responses as answer!