Splitting out the Actionwords file


#1

I know I’ve seen that there is a way to do this in a video or documentation somewhere - but I can’t find it.

Our actionwords file is growing rapidly. We’d like to break it out into multiple files. How do we do that? We have a Cucumber Java framework if that matters.


#2

Hi,

Sorry for this late answer!

The solution to split the action words file will mainly be depending on the language you choose for automation.
With languages handling multi-inheritance or mixins (for example Ruby, Python PHP or Javascript), this is pretty straightforward. You will place the different methods in different mixins (organised, for example, based on the page object pattern or anything that suits the need of the team).
The screenshot below shows how we organised our action words here at Hiptest as an example:

The main action word class will then inherit/extend the different modules defined there.

With less “flexible” languages (such as Java or C# for the few I know of it) like your use case, that’s getting a bit trickier to split the action words file.

In that case, the best solution is to treat the action words class as a simple indirection layer to access the different classes where the real implementation is done (once again following for example the page object pattern).
With that solution, each action word would be a simple line method should as this one for example in Ruby:

One thing to note: this is currently a limitation in Hiptest but the team is working on changing the way action words are managed. And part of our work is to ensure a possibility to classify the action words directly inside Hiptet (and that should fix this classical issue of the big action words file).

Does this explanation give you more information about the way with which you can split your actionwords’file?

What the version of Java does you use? Our team’ll continue to search a easy and practical way to meet your need :slight_smile:

If you find a solution before us, thanks to share it with us!

Regards,
​Houda