elenavivequi
15 years agoNew Contributor
JUnit: Calling a function from another file
Hi All,
I'm running TestComplete 8 and I'm testing using Script tests, rather than Keyword tests. I'm using JScript as my language and am testing a .NET website. My goal is to create a test that can work across browsers. I've followed the Cross-Browser script example here and it works successfully for running the example web test provided by TestComplete. However, I want to replace the example web test with my own web test and the way I can think to achieve this is to use the example file and replace the function that creates and runs the web test with a function call to my own web test in another file.
Specifically:
Using the example project XBrowserScript (links you to a ZIP file FYI), I'd like to use the "JUunit1_NM" script, but modify it by replacing the function 'function DoWebTest(browser)' with a function call to my own web test in another script (.pjs) file. Then I'll run it from the main() function and it should make my test cross-browser compatible.
What I need help with:
I'm not sure how to write a function call to a function in another web file using JScript. I know that my function in the separate file will need to pass a variable, too, but I'm not sure which variable either.
Please let me know if you can help and let me know what other information you need.
Thanks!!
I'm running TestComplete 8 and I'm testing using Script tests, rather than Keyword tests. I'm using JScript as my language and am testing a .NET website. My goal is to create a test that can work across browsers. I've followed the Cross-Browser script example here and it works successfully for running the example web test provided by TestComplete. However, I want to replace the example web test with my own web test and the way I can think to achieve this is to use the example file and replace the function that creates and runs the web test with a function call to my own web test in another file.
Specifically:
Using the example project XBrowserScript (links you to a ZIP file FYI), I'd like to use the "JUunit1_NM" script, but modify it by replacing the function 'function DoWebTest(browser)' with a function call to my own web test in another script (.pjs) file. Then I'll run it from the main() function and it should make my test cross-browser compatible.
What I need help with:
I'm not sure how to write a function call to a function in another web file using JScript. I know that my function in the separate file will need to pass a variable, too, but I'm not sure which variable either.
Please let me know if you can help and let me know what other information you need.
Thanks!!