Reusing page object repository

Is it possible to package Katalon Page Objects repsitory source and reuse in another Katalon projects? OR is there any other way to reuse page repository in other projects?

Not sure if this will work but you could try - open the containing folder for object repository for your current project, copy all the folders for each object which you want, then past them in your new projects object repository containing folder. Not sure if it works like that but worth a try

1 Like

I believe what @hpulsford suggested — copy the folder tree and paste it to another project — will work at first.

But later you will find a big problem when you update the source Object Repository. You have to do copy & paste it to other projects repeatedly. This exercise tends to break. You will make mistakes.


@satishvarma1818

I suppose you have 2 or more Katalon projects which want to share a Object Repository. This implies that those projects are targeting a single URL (a Web Application). Possibly 2 or more people of your team wants to work for the Web app. They have created their own projects, but they realized that most of Test Objects in the Object Repository duplicate. So you are now wondering how to “Reuse page object repository”. Am I right?

I would rather recommend you to consider merging the projects into one, rather than doing copy&pasting the OR across multiple projects. The simpler, the better.

Please find that Test Cases, Test Suites, Test Objects — all of these resources can be structured in a tree of sub-folders. You can name your sub-folders as you like. Your team members would be able to design a folder tree where they can cooperate well without collisions.

Also you should consider putting the project into Git remote repository so that your team members (2 people,3, …, 10, or more) can share a single set of sources. See Shared object repository where I explained how Git enables your team to share a project safely.

3 Likes

@ kazurayam

Structuring would be fine, but in our case there are several different teams works on different projects, though some modules are common. Eg: Team one not required all the test cases and page repository of team two projects. Team one requires only the common module page repository.

@satishvarma1818

Copying a set of Test Objects from the Object Repository folder of the Project A into another Project B is fine. The Project B would work with the Test Objects copied from the Project A.

The only problem for you is how to avoid mistakes when you update the source Object Repository and copy them again into the dependent projects. You would want to automate the processing of exporting the Test Objects from A, and importing them into B.

Katalon Studio does not provide this feature of export/import resources (Test Objects, Test Cases, Test Suites, etc).


However you can invent your own solution. I have ever developed a similar automation. Please have a look at my project:

Let me describe what I have done for me. I have developed a Gradle plugin named visualtestinginks-gradle-plugin. This plugin enables me to create zip files which contains the resources (Test Cases, Test Suites, Test Listerners, Keywords and Test Objects) out of my VisualTestingInCatalonStudio. Exporting is done.

I would push them(vt-components-x.x.x.zip, vt-example-x.x.x.zip) up on to the Releases page on GitHub.

On the other hand, anyone can create his/her own Katalon Studio project, and he/sh makes a build.gradle file like this:

plugins {
  id "com.github.kazurayam.visualtestinginks" version "0.1.14"
}

vt.version = '1.10.5'

and he/sh executes the following command:

$ cde %yourKatalonStudioProjectDir%
$ gradle enableVisualTesting

Then Gradle magically download the zip files from the GitHub releases page, unzip them, locate the contents (which includes Test Objects) into the directory of his/her Katalon Studio project. Importing is done.


This solution is the simplest one that I could invent for implementing export/import resources of my VisualTestingInKatalonStudio project.

Does this look too complicated for you? I am afraid, it is complexed. But it was necessary. Keeping 2 or more projects synchronized with regard to the exported/imported Object Repository is such a complexed task that you would also need to invent a solution like visualtestinginks-gradle-plugin to meet your requirement.

You do not necessarily use Gradle and GitHub; though I find these tools are most convenient. You would be able to develop your own solution using any tool set you are familiar with (bash etc).

1 Like