I have a scenario where I am trying to utilize a function defined in different js file(separate module)
I tried to implement below config in main file.
You are giving getAPI as the function that k6 needs to execute as the default function for scenario scenario1 - this is waht exec: "getAPI" means. But your main files importsgetAPI and never exports it, instead you call it in the default function, which won’t be used as you have defined that k6 should call getAPI.
You can fix this in two ways:
don’t specify exec and k6 will call default which in itself calls getAPI
(re)export getAPI with export {getAPI} from "./Compo...."
Hope this explanation is understandable as unfortunately it uses default a bit too much .
p.s. you are importing ComponenetPerf_GET.js but have named it (here) ComponentGET.js, hopefully this is a copy-paste error
Hey @mstoykov
Thanks for your quick help
1st option would not help me because I have to use multiple modules.
2nd option helped me resolved the issue.
After defining the export function as below I am able to execute the test.