Last updated: Oct 04, 2020 15:38
You may have many projects or teams that use Quantum and wish to separate the Core (maven dependencies, utilities classes, and so on), which should be shared by many projects and teams, from the actual test code (locators, pages, scenarios, tests, configurations, as so on). Keeping the core and the test code separate helps create a global library that is easier to maintain. It also helps manage Maven dependency versions when upgrades occur to the Quantum Project. This library can then be inherited by any other projects down the line. This article refers to the "library" project as the Parent and the actual "test code" project as the Child.
Configuring the separate projects is quite simple. It mainly means chopping up the
pom.xml file with the appropriate references. For the Parent, the file will contain all properties, dependencies, and repository items from the
pom.xml found at Project Quantum, as shown in the following code snippet.
For the Child project, the file will contain a subset of properties, all build items, and finally a reference to the
pom.xml information we supplied in the Parent. In this case, the Parent's name is listed as:
The child project would look like the following example.
Now that we have divided up the project, the structure of the Parent project is really dependent on your needs. You could have many utility or reusable classes, or you may not have any if you just wish to easily version Maven using this method.
The Child project will look just like any other standard Quantum Framework.
To utilize the Parent project in the Child, you must compile and install the project into your local Maven repository. To do this, you simply perform a Maven install on the project, or from the command line mvn install.
If running from CI, you would want to run the Parent first and then the child, in a cascading fashion, so that you perform a fresh install of the Parent before the Child is executed. This ensures that any changes are picked up at runtime.
Lastly, you may opt to update the Parent artifact version between updates. In this case, you would then be required to update every child project with the new version number to pick up the changes. This may be desired in many cases. However, for easier management, you could also leave the version number the same between updates if the updates are small and non-consequential to test cases that may already be written in the Child projects.
For an example of each project, see: