It's a great thing that with Resharper 6 one can write qunit tests and run those with the integrated resharper test runner. However, I wonder if it is possible to set breakpoints in the tests and the code under test. The problem is, each time it opens the browser it uses a different randomized port number which means you can not just set breakpoints in the browser and rerun the tests by hitting F5. So I wonder, is it even possible somehow?
To add a regular breakpoint to a test step, right-click the step or action and select Break while executing step. For a transition, point to the transition, click the gear icon , and select Break when transition taken. A red icon indicates a regular breakpoint.
Ctrl+U R / Debug Unit Tests. Ctrl+U D on the toolbar. To run all tests in the session, click Run Current Session. Ctrl+U Y on the toolbar or alternatively, choose ReSharper | Unit Tests | Run Current Session from the main menu.
If you are using Firefox with the Firebug plugin, you can do this: add a debugger statement to your code where you want to break:
var x = 2;
debugger;
...
Set the Firebug option 'Active for all Web Pages' to true. In ReSharper options, Testing>JavaScript set Firefox as the browser to use (if it is not already your default).
Now Firebug debugger will break at the debugger statement.
PS I tried this with Chrome but couldn't get it to break. Anyone know how to do it?
Unfortunately, it is not possible at the moment - see this request. What I suggest you do right now if you need debugging is to use QUnit canonically - create an HTML page, drop your JS libs, tests and QUnit into them, and put in the QUnit HTML elements to display the results. This way, you'll be able to set breakpoints in JS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With