Get help with testing, discuss unit testing strategies etc.


Post by jayaprakasha »

Hello,

Tried option 1:
I am trying to load a JSON file and get my Test data from it. I have used xmlhttprequests for this.
But when i use a onreadystatechange condition to get my Json object my t.it or t.describe does not wait until the function is performed. It just gets terminated/throws object not defined error.

How do it ask my siesta code to wait until the onreadystatechange function is executed?

Since this didnt work i went for option 2:
I executed the xmlhttprequests in preload. Now i have my Json object with data but how do i pass this object to all my test cases to use them?? basically i how do i declare a global variable/object and use them in all test cases?

Post by nickolay »


Post by jayaprakasha »

Awesome! That works..so what would be the probable solution for option 2: how do i declare a global variable/object and use them in all test cases?(say in harness or preload file i declare and set a value for a variable and want to access it in all my test cases)

Post by nickolay »

You can specify it as a harness option in the `harness.configure()` call. Then you can access it as "t.harness.optionName"

Post Reply