I have my code encapsulated in modules.How can I plug in my modules to be accessible from test case script?
In the file:
Thanks for reply.What you are suggested is code component.I’m looking for the way to include custom module globally for
reusing in different projects
I am not sure I understand what the difference would be. Using this does allow reuse of functions across projects.
Indeed reusing is possible,but sharing the files between different project is hard task to maintain.
I rather looking for something like standard node module,that can be available in such way:
Btw: this way i can use file system “fs” module for io operations.The “fs” module is integrated part of
Oxygen,and no needed to be installed separately.
I also tried to load myModule by absolute path: module loaded ,but
i cannot use Oxygen regular modules in my module as usual:like : http.get(“url”),web.open etc
Yeah you do have to modify a little of your thinking to work around. What I do is all projects share a common.js while each project has a projectcommon.js file. This allows me to put shared functions and project specific functions in an orderly fashion.
I have had to add this to use web inside the reused file. I imagine it is similar for what you are trying to do.
const web = ox.web;
This allows all the web.function to work properly. I imagine you are looking for something like this:
const http = ox.http;
I also use system variables to determine paths and project names. Hope this is helpful.
Adding a new module to Oxygen is easy, you just need to place your new module file in ox_modules folder and Oxygen should discover it automatically.
See Oxygen internal modules for inspiration and example here:
Please let me know what your follow-up questions may be.