I am working on a UI framework which needs the methods and the page objects to be called dynamically in a sequence based on the input. Let me explain
All the pages extend a Base Abstract class and the methods extend another base class. I have annotations to identify classes and the methods. I build a list of all the available pages and list of all available methods. Now based on the input, I invoke the method on an instance of that class using reflections. Also there are inbuilt functions which need to be invoked for certain inputs. I also need to set the transition page for the previous page(i.e. what page will be loaded after this action)
I am using BDD for the input i.e.
Given user logsin
And performs some actions
Then the following page is displayed
Currently, I read those input arguments, check the map and get the class / methods to be invoked or call the inbuilt methods. I have a switch case for various actions and pages.
I am looking for a design to implement the same without using switch else. A good design pattern which would fit in is what I would be looking at.
Aucun commentaire:
Enregistrer un commentaire