2

Closed

Load html fixtures

description

Hi!

Via reference I am able to load .js files, and all is good.

However, I would also like to load html fixtures using jasmine-jquerys loadFixture() (or readFixture)

If i try to reference the html file chutzpah tries to load it in as a .js file (<script src=test.html>)

I've seen some examples of people using it, but I've not been able to do it myself.

Is it possible to load html fixtures?
Closed Dec 3, 2013 at 4:50 AM by mmanela
These issues are old, are fixed or the user has no responded. Please file a new issue if you still have a problem.

comments

AndersMi wrote Jun 5, 2013 at 5:11 PM

I've been trying the same in the last few days and this is what I came up with:

Testing with QUnit, I write my tests in a tests.js file, without an .html test harness, and then use JQuery to load into a div the content of a file placed in the same folder as tests.js. The results are:
  • it works if I run the tests from the console: the html gets loaded into the div and I can manipulate it and test the results;
  • if I run the tests from Visual Studio by clicking on the test bullet beside each test function, the tests (all of them) will run in my default browser but the html won't be loaded;
  • if I run the tests from Visual Studio's context menu, right clicking on the tests folder or on the tests.js file, no test is run - the console will tell me 0 test run, 0 passed and 0 failed.
In the first case, the html has to be stored in a file with an extension different from .htm or .html as otherwise Chutzpah will try to load that file as well as a test file.

I don't know how much I'm doing wrong and how much is just inconsistent behaviour from Chutzpah. At the moment I'll start my tests from console, it's enough though not as nice as it could have been...

trondkla wrote Jun 6, 2013 at 8:53 AM

Thank you for commenting :)
I will try this approach soon (early next week) and get back!

trondkla wrote Jun 10, 2013 at 7:41 AM

I haven't been able to run it through the "Unit test session" with fixtures, but by right clicking the test file and choosing "Run tests" the fixtures are loaded

mmanela wrote Jun 19, 2013 at 8:07 PM

It is possible to load HTML fixtures. I have previously made fixes to help enable this scenario (see this thread https://chutzpah.codeplex.com/discussions/359690).

However, if you are running into issues please attach a zip containing a repro of what you are trying to so I can play with it and figure out what change you might need to make or if I need to make a fix for Chutzpah.

trondkla wrote Jun 20, 2013 at 8:29 AM

I got it to work through the console, but not through the "Unit test session", so it's nice enough :)

mmanela wrote Jun 20, 2013 at 5:26 PM

Unit test session? I think that is the resharper dialog which is not related at all to Chutzpah.