-
Notifications
You must be signed in to change notification settings - Fork 0
TDD
UNDER CONSTRUCTION
This page describes a setup suited for TDD, using Eclipse JSDT and Chrome Development Tools for remote debugging.
-
Download Eclipse, for example the Eclipse IDE for JavaScript Web Developers
-
Install 'Eclipse EGit', from
http://download.eclipse.org/egit/updates -
Install all in 'Google Chrome Developer Tools', from
http://chromedevtools.googlecode.com/svn/update/dev/ -
Install 'JS Test Driver', from
http://js-test-driver.googlecode.com/svn/update/ -
Optional, install 'm2e - Maven integration for Eclipse', from
http://download.eclipse.org/technology/m2e/releases/. This requires the JDT feature.
Use Import wizard
- Import Project > Git > Projects from Git > URI
- git://github.com/frawa/TestCodeMirror2.git
- select only 'master' branch
- import as General project
An alternative is to use Maven:
- Import Project > Maven > Checkout Maven projects from SCM
- install m2e-egit connector, if missing
- git://github.com/frawa/TestCodeMirror2.git
In the Script Explorer, right click the new project and select 'Configure > Convert to JavaScript project'
In 'Window > Preferences', point 'JS Test Driver' to your browsers' executable files.
- Open the 'jsTestDriver' view, using 'Window > Show View ...' menu.
- Start the server
- Do not connect Chrome browser yet.
You will find several useful launch configurations in test/launch/ folder.
This will connect Chrome to the jsTestDriver server, ready for remote debugging. Basically, this launch configuration invokes chrome with these arguments
--remote-debugging-port=9222 --user-data-dir=remote-profile http://127.0.0.1:42442/capture
This one connects Eclipse to Chrome for debugging.
It has brings two important configuration peaces
- On the 'Remote' tab: Only short filenames are used
- On the 'Source' tab: A JavaScript Source Name Mapper. The TestCodeMirror2 project is added.
NOTE There is currently a bug in chromedevtools. It is fixed on trunk, but was not yet released. For now, you will have to run Eclipse with local build of the debugger, see HowToBuild for details.
This ones launches tests as configured by test/jsTestDriver.conf file.
You will use the 'Rerun last configuration' button during your TDD cycles.
We are all set up.
Open the Debug perspective and enable V8 breakpoint type, via 'Run > Breakpoint Types > Chrome/V8 breakpoints'.
For example, set a breakpoint on line 421 in file modelstest.js.
Launch jsTestDriver tests, via Run Configuration 'jsTestDriver', or the 'Run last configuration' button in the jsTestDriver View.
Enjoy debugging. See EclipseDebuggerFeatures for details.
Modified source files can be hot replaced in Chrome browser, using context menu 'V8 Debugging > Push Source Changes to VM'.
Instead of using chromedevtools Eclipse Debugger with hot code replacement, you might want to go with the debugger in your browser.
Read DebuggingWithJsTestDriver to get started.
In the description above simply skip all steps related to chromedevtools.