Forum Discussion

john_qa's avatar
john_qa
Occasional Contributor
15 years ago

Getting units and routines in script

Hello,



Is there a way to obtain in a script, the list of units from the project, or the list of routines and their units?



I've searched the documentation and i haven't found anything regarding this.



What I'm trying to do, is to call routines in Main unit without previously knowing its name, so adding new routines in new units doesn't force me to change the Main unit in order to allow me to execute them. 





Thanks,

John



2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    As far as I am aware, no, there is no way of doing so.



    However, I would suggest that you can get away from having a "Main" unit that executes your code and, instead, utilize Test Items at the project level to execute new tests and routines.  Read up on the help topics for test items but you'll find that you'll be able to create a method and then access it directly via the test item in order to execute it when you run your project. 
  • john_qa's avatar
    john_qa
    Occasional Contributor
    Thank you very much for the advice.



    For me using TestItems is not an option, and I think I'll obtain the units by simply reading the files from Script folder and maybe reading their content and parse it to obtain the routines in the Main routine.



    Regards,

    John