Get help with testing, discuss unit testing strategies etc.


Post by claudia_ »

Hi,

I've written some tests for a Sencha Extjs app (Extjs version 6.5.3 and I'm using Siesta 4.4.4).

I need to load an external javascript file which contains some functions I need inside my tests.

I've already added an external js file inside the 'preload' option of my harness file but I cannot execute the functions defined in those external js (e.g. I get 'function not defined method').

Can you explain which is the best practice about loading external js files for having custom functions to use inside Siesta tests ?

Any hint is appreciated.
Regards,

Claudia

Post by mats »

Could you please upload a ZIP file showing your test setup?

Post by claudia_ »

Attached the ZIP file showing my test setup.
Attachments
Setup.zip
(1.24 KiB) Downloaded 266 times

Post by nickolay »

I've already added an external js file inside the 'preload' option of my harness file but I cannot execute the functions defined in those external js (e.g. I get 'function not defined method').
Are there any 404 errors? How exactly you call those external functions (your setup does not seem to contain any tests). See also https://www.bryntum.com/docs/siesta/#!/ ... test_class

Post by claudia_ »

Attached new setup zip with one test file inlcuded plus the js call to the external js resource.
Besides I have no 404 code about the loaded resources on my console network panel..
I simply call the function as normal function call.
Attachments
BasicSetup.zip
Setup with one test file
(1.48 KiB) Downloaded 271 times

Post by nickolay »

Weird, this definetely should work. If you comment the call to external function - does the check about Ext pass? What if you switch it to explicit global assignment:
myTestSetup = function (){

Post by claudia_ »

If I comment the call to external function the check about Ext does pass.

After using explicit global assignment on my external js file, the function call does execute correctly.

So this has solved my issue
thanks

Post Reply