A Re-Introduction to JavaScript (JS Tutorial) - JavaScript _ MDN
Javascript Unittesting with js-test-driver
-
Upload
westhoff -
Category
Technology
-
view
5.868 -
download
0
Transcript of Javascript Unittesting with js-test-driver
![Page 1: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/1.jpg)
Javascript Unittesting with js-test-driver
Jakob Westhoff <[email protected]>@jakobwesthoff
PHPBarcamp.atMay 2, 2010
http://westhoffswelt.de [email protected] slide: 1 / 31
![Page 2: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/2.jpg)
About Me
Jakob Westhoff
PHP developer for several years
Computer science student at the TU Dortmund
Co-Founder of the PHP Usergroup Dortmund
Active in different Open Source projects
http://westhoffswelt.de [email protected] slide: 2 / 31
![Page 3: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/3.jpg)
Who is actively using TDD/Unittesting?
Who uses unittesting?
Who uses TDD?
Who unittests javascript code?
http://westhoffswelt.de [email protected] slide: 3 / 31
![Page 4: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/4.jpg)
Who is actively using TDD/Unittesting?
Who uses unittesting?
Who uses TDD?
Who unittests javascript code?
http://westhoffswelt.de [email protected] slide: 3 / 31
![Page 5: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/5.jpg)
Who is actively using TDD/Unittesting?
Who uses unittesting?
Who uses TDD?
Who unittests javascript code?
http://westhoffswelt.de [email protected] slide: 3 / 31
![Page 6: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/6.jpg)
Goals of this session
1 Getting to know js-test-driver
2 Unittesting javascript
Synchronous testsAsynchronous tests
3 Run these tests
From within a terminalFrom within Eclipse
4 Create javascript code coverage reports
http://westhoffswelt.de [email protected] slide: 4 / 31
![Page 7: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/7.jpg)
Goals of this session
1 Getting to know js-test-driver
2 Unittesting javascript
Synchronous testsAsynchronous tests
3 Run these tests
From within a terminalFrom within Eclipse
4 Create javascript code coverage reports
http://westhoffswelt.de [email protected] slide: 4 / 31
![Page 8: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/8.jpg)
Goals of this session
1 Getting to know js-test-driver
2 Unittesting javascript
Synchronous testsAsynchronous tests
3 Run these tests
From within a terminalFrom within Eclipse
4 Create javascript code coverage reports
http://westhoffswelt.de [email protected] slide: 4 / 31
![Page 9: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/9.jpg)
Goals of this session
1 Getting to know js-test-driver
2 Unittesting javascript
Synchronous testsAsynchronous tests
3 Run these tests
From within a terminalFrom within Eclipse
4 Create javascript code coverage reports
http://westhoffswelt.de [email protected] slide: 4 / 31
![Page 10: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/10.jpg)
Goals of this session
1 Getting to know js-test-driver
2 Unittesting javascript
Synchronous testsAsynchronous tests
3 Run these tests
From within a terminalFrom within Eclipse
4 Create javascript code coverage reports
http://westhoffswelt.de [email protected] slide: 4 / 31
![Page 11: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/11.jpg)
Goals of this session
1 Getting to know js-test-driver
2 Unittesting javascript
Synchronous testsAsynchronous tests
3 Run these tests
From within a terminalFrom within Eclipse
4 Create javascript code coverage reports
http://westhoffswelt.de [email protected] slide: 4 / 31
![Page 12: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/12.jpg)
Goals of this session
1 Getting to know js-test-driver
2 Unittesting javascript
Synchronous testsAsynchronous tests
3 Run these tests
From within a terminalFrom within Eclipse
4 Create javascript code coverage reports
http://westhoffswelt.de [email protected] slide: 4 / 31
![Page 13: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/13.jpg)
Goals of this session
1 Getting to know js-test-driver
2 Unittesting javascript
Synchronous testsAsynchronous tests
3 Run these tests
From within a terminalFrom within Eclipse
4 Create javascript code coverage reports
http://westhoffswelt.de [email protected] slide: 4 / 31
![Page 14: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/14.jpg)
What is js-test-driver
Javascript testrunner and framework
Client/Server approach
Server: js-test-driverClient: BrowserClient: Testrunner
Assertion framework
Mostly xUnit compatibleassertEqualsassertSameassertTrue...
http://westhoffswelt.de [email protected] slide: 5 / 31
![Page 15: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/15.jpg)
What is js-test-driver
Javascript testrunner and framework
Client/Server approach
Server: js-test-driverClient: BrowserClient: Testrunner
Assertion framework
Mostly xUnit compatibleassertEqualsassertSameassertTrue...
http://westhoffswelt.de [email protected] slide: 5 / 31
![Page 16: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/16.jpg)
What is js-test-driver
Javascript testrunner and framework
Client/Server approach
Server: js-test-driverClient: BrowserClient: Testrunner
Assertion framework
Mostly xUnit compatibleassertEqualsassertSameassertTrue...
http://westhoffswelt.de [email protected] slide: 5 / 31
![Page 17: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/17.jpg)
What is js-test-driver
Javascript testrunner and framework
Client/Server approach
Server: js-test-driverClient: BrowserClient: Testrunner
Assertion framework
Mostly xUnit compatibleassertEqualsassertSameassertTrue...
http://westhoffswelt.de [email protected] slide: 5 / 31
![Page 18: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/18.jpg)
What is js-test-driver
Javascript testrunner and framework
Client/Server approach
Server: js-test-driverClient: BrowserClient: Testrunner
Assertion framework
Mostly xUnit compatibleassertEqualsassertSameassertTrue...
http://westhoffswelt.de [email protected] slide: 5 / 31
![Page 19: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/19.jpg)
What is js-test-driver
Javascript testrunner and framework
Client/Server approach
Server: js-test-driverClient: BrowserClient: Testrunner
Assertion framework
Mostly xUnit compatibleassertEqualsassertSameassertTrue...
http://westhoffswelt.de [email protected] slide: 5 / 31
![Page 20: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/20.jpg)
What is js-test-driver
Javascript testrunner and framework
Client/Server approach
Server: js-test-driverClient: BrowserClient: Testrunner
Assertion framework
Mostly xUnit compatibleassertEqualsassertSameassertTrue...
http://westhoffswelt.de [email protected] slide: 5 / 31
![Page 21: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/21.jpg)
What is js-test-driver
Javascript testrunner and framework
Client/Server approach
Server: js-test-driverClient: BrowserClient: Testrunner
Assertion framework
Mostly xUnit compatibleassertEqualsassertSameassertTrue...
http://westhoffswelt.de [email protected] slide: 5 / 31
![Page 30: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/30.jpg)
Advantages of this design
Run from possibly any IDE
CommandlineEclipse
Parallel execution of tests in multiple browsers
Test execution on different machines with possibly differentoperating systems
Website DOM not used for any testrunner output
Browser independent code coverage reports (planned for afuture release)
http://westhoffswelt.de [email protected] slide: 7 / 31
![Page 31: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/31.jpg)
Advantages of this design
Run from possibly any IDE
CommandlineEclipse
Parallel execution of tests in multiple browsers
Test execution on different machines with possibly differentoperating systems
Website DOM not used for any testrunner output
Browser independent code coverage reports (planned for afuture release)
http://westhoffswelt.de [email protected] slide: 7 / 31
![Page 32: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/32.jpg)
Advantages of this design
Run from possibly any IDE
CommandlineEclipse
Parallel execution of tests in multiple browsers
Test execution on different machines with possibly differentoperating systems
Website DOM not used for any testrunner output
Browser independent code coverage reports (planned for afuture release)
http://westhoffswelt.de [email protected] slide: 7 / 31
![Page 33: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/33.jpg)
Advantages of this design
Run from possibly any IDE
CommandlineEclipse
Parallel execution of tests in multiple browsers
Test execution on different machines with possibly differentoperating systems
Website DOM not used for any testrunner output
Browser independent code coverage reports (planned for afuture release)
http://westhoffswelt.de [email protected] slide: 7 / 31
![Page 34: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/34.jpg)
Advantages of this design
Run from possibly any IDE
CommandlineEclipse
Parallel execution of tests in multiple browsers
Test execution on different machines with possibly differentoperating systems
Website DOM not used for any testrunner output
Browser independent code coverage reports (planned for afuture release)
http://westhoffswelt.de [email protected] slide: 7 / 31
![Page 35: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/35.jpg)
Advantages of this design
Run from possibly any IDE
CommandlineEclipse
Parallel execution of tests in multiple browsers
Test execution on different machines with possibly differentoperating systems
Website DOM not used for any testrunner output
Browser independent code coverage reports (planned for afuture release)
http://westhoffswelt.de [email protected] slide: 7 / 31
![Page 36: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/36.jpg)
Advantages of this design
Run from possibly any IDE
CommandlineEclipse
Parallel execution of tests in multiple browsers
Test execution on different machines with possibly differentoperating systems
Website DOM not used for any testrunner output
Browser independent code coverage reports (planned for afuture release)
http://westhoffswelt.de [email protected] slide: 7 / 31
![Page 38: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/38.jpg)
A simple example
Javascript application/function
Testcase
js-test-driver configuration file
http://westhoffswelt.de [email protected] slide: 8 / 31
![Page 39: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/39.jpg)
A simple example
Javascript application/function
Testcase
js-test-driver configuration file
http://westhoffswelt.de [email protected] slide: 8 / 31
![Page 40: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/40.jpg)
A simple example
Javascript application/function
Testcase
js-test-driver configuration file
http://westhoffswelt.de [email protected] slide: 8 / 31
![Page 41: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/41.jpg)
A simple example - Javascript
Really simple hello world function:
1 myApp = {} ;23 myApp . He l loWor ld = f u n c t i o n ( ) {} ;45 myApp . He l loWor ld . p r o t o t yp e . s a yHe l l o = f u n c t i o n ( ) {6 re tu rn ” He l l o World ! ” ;7 }
http://westhoffswelt.de [email protected] slide: 9 / 31
![Page 42: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/42.jpg)
A simple example - Testcase
Our first js-test-driver testcase:
1 He l l oWor ldTes t = TestCase ( ’ He l l oWor ld ’ ) ;23 He l l oWor ldTes t . p r o t o t yp e . setUp = f u n c t i o n ( ) {4 t h i s . h e l l o F i x t u r e = new myApp . He l loWor ld ( ) ;5 }67 He l l oWor ldTes t . p r o t o t yp e . t e s tOutpu t = f u n c t i o n ( ) {8 a s s e r t E q u a l s (9 ” He l l o World ! ” ,
10 t h i s . h e l l o F i x t u r e . s a yHe l l o ( )11 ) ;12 }
http://westhoffswelt.de [email protected] slide: 10 / 31
![Page 43: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/43.jpg)
Digression about test lifecycle
The js-test-driver test lifecycle follows the JUnit lifecycle
1 Instantiate new Testcase implementation
2 Execute the setUp() method
3 Execute the next testWhatever() method
4 Execute the tearDown() method
5 While tests left in testcase jump to Step 1
http://westhoffswelt.de [email protected] slide: 11 / 31
![Page 44: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/44.jpg)
Digression about test lifecycle
The js-test-driver test lifecycle follows the JUnit lifecycle
1 Instantiate new Testcase implementation
2 Execute the setUp() method
3 Execute the next testWhatever() method
4 Execute the tearDown() method
5 While tests left in testcase jump to Step 1
http://westhoffswelt.de [email protected] slide: 11 / 31
![Page 45: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/45.jpg)
Digression about test lifecycle
The js-test-driver test lifecycle follows the JUnit lifecycle
1 Instantiate new Testcase implementation
2 Execute the setUp() method
3 Execute the next testWhatever() method
4 Execute the tearDown() method
5 While tests left in testcase jump to Step 1
http://westhoffswelt.de [email protected] slide: 11 / 31
![Page 46: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/46.jpg)
Digression about test lifecycle
The js-test-driver test lifecycle follows the JUnit lifecycle
1 Instantiate new Testcase implementation
2 Execute the setUp() method
3 Execute the next testWhatever() method
4 Execute the tearDown() method
5 While tests left in testcase jump to Step 1
http://westhoffswelt.de [email protected] slide: 11 / 31
![Page 47: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/47.jpg)
Digression about test lifecycle
The js-test-driver test lifecycle follows the JUnit lifecycle
1 Instantiate new Testcase implementation
2 Execute the setUp() method
3 Execute the next testWhatever() method
4 Execute the tearDown() method
5 While tests left in testcase jump to Step 1
http://westhoffswelt.de [email protected] slide: 11 / 31
![Page 48: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/48.jpg)
Digression about test lifecycle
The js-test-driver test lifecycle follows the JUnit lifecycle
1 Instantiate new Testcase implementation
2 Execute the setUp() method
3 Execute the next testWhatever() method
4 Execute the tearDown() method
5 While tests left in testcase jump to Step 1
http://westhoffswelt.de [email protected] slide: 11 / 31
![Page 49: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/49.jpg)
A simple example - js-test-driver configuration
Every project needs a js-test-driver configuration file.
Written in YAMLCalled jsTestDriver.conf by default
js-test-driver configuration for our example:
1 s e r v e r : h t tp : // l o c a l h o s t :422423 l oad :4 − s r c / h e l l o w o r l d . j s5 − t e s t s / h e l l o w o r l d . j s
http://westhoffswelt.de [email protected] slide: 12 / 31
![Page 50: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/50.jpg)
A simple example - js-test-driver configuration
Every project needs a js-test-driver configuration file.
Written in YAMLCalled jsTestDriver.conf by default
js-test-driver configuration for our example:
1 s e r v e r : h t tp : // l o c a l h o s t :422423 l oad :4 − s r c / h e l l o w o r l d . j s5 − t e s t s / h e l l o w o r l d . j s
http://westhoffswelt.de [email protected] slide: 12 / 31
![Page 51: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/51.jpg)
A simple example - js-test-driver configuration
Every project needs a js-test-driver configuration file.
Written in YAMLCalled jsTestDriver.conf by default
js-test-driver configuration for our example:
1 s e r v e r : h t tp : // l o c a l h o s t :422423 l oad :4 − s r c / h e l l o w o r l d . j s5 − t e s t s / h e l l o w o r l d . j s
http://westhoffswelt.de [email protected] slide: 12 / 31
![Page 52: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/52.jpg)
A simple example - js-test-driver configuration
Every project needs a js-test-driver configuration file.
Written in YAMLCalled jsTestDriver.conf by default
js-test-driver configuration for our example:
1 s e r v e r : h t tp : // l o c a l h o s t :422423 l oad :4 − s r c / h e l l o w o r l d . j s5 − t e s t s / h e l l o w o r l d . j s
http://westhoffswelt.de [email protected] slide: 12 / 31
![Page 53: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/53.jpg)
Run js-test-driver - Server
Run the js-test-driver server
j a v a − j a r j s T e s tD r i v e r . j a r −−po r t 4224
Capture the all browsers
ht tp : // l o c a l h o s t :4224/ cap tu r e
Execute the testrunner
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s a l l
http://westhoffswelt.de [email protected] slide: 13 / 31
![Page 54: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/54.jpg)
Run js-test-driver - Browser
Run the js-test-driver server
j a v a − j a r j s T e s tD r i v e r . j a r −−po r t 4224
Capture the all browsers
ht tp : // l o c a l h o s t :4224/ cap tu r e
Execute the testrunner
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s a l l
http://westhoffswelt.de [email protected] slide: 13 / 31
![Page 55: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/55.jpg)
Run js-test-driver - Testrunner
Run the js-test-driver server
j a v a − j a r j s T e s tD r i v e r . j a r −−po r t 4224
Capture the all browsers
ht tp : // l o c a l h o s t :4224/ cap tu r e
Execute the testrunner
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s a l l
http://westhoffswelt.de [email protected] slide: 13 / 31
![Page 56: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/56.jpg)
A simple example - Live Demo
Hello World example
Live Demo!
http://westhoffswelt.de [email protected] slide: 14 / 31
![Page 57: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/57.jpg)
Eclipse testrunner
A testrunner plugin for Eclipse is available
Available through eclipse plugin manager
http://code.google.com/p/js-test-driver/wiki/UsingTheEclipsePlugin
http://westhoffswelt.de [email protected] slide: 15 / 31
![Page 58: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/58.jpg)
Eclipse testrunner
A testrunner plugin for Eclipse is available
Available through eclipse plugin manager
http://code.google.com/p/js-test-driver/wiki/UsingTheEclipsePlugin
http://westhoffswelt.de [email protected] slide: 15 / 31
![Page 59: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/59.jpg)
Eclipse testrunner
A testrunner plugin for Eclipse is available
Available through eclipse plugin manager
http://code.google.com/p/js-test-driver/wiki/UsingTheEclipsePlugin
http://westhoffswelt.de [email protected] slide: 15 / 31
![Page 61: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/61.jpg)
Test asynchronous implementations
Asynchronous timeouts
setTimeout, setInterval
Asynchronous callbacks
XMLHttpRequest, onReady
”[...] JS test driver does not support asynchronous test. This wasa conscious decision, as we want to make sure that the testsremain fast.”
– Misko Hevery on Google groups
http://westhoffswelt.de [email protected] slide: 16 / 31
![Page 62: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/62.jpg)
Test asynchronous implementations
Asynchronous timeouts
setTimeout, setInterval
Asynchronous callbacks
XMLHttpRequest, onReady
”[...] JS test driver does not support asynchronous test. This wasa conscious decision, as we want to make sure that the testsremain fast.”
– Misko Hevery on Google groups
http://westhoffswelt.de [email protected] slide: 16 / 31
![Page 63: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/63.jpg)
Test asynchronous implementations
Asynchronous timeouts
setTimeout, setInterval
Asynchronous callbacks
XMLHttpRequest, onReady
”[...] JS test driver does not support asynchronous test. This wasa conscious decision, as we want to make sure that the testsremain fast.”
– Misko Hevery on Google groups
http://westhoffswelt.de [email protected] slide: 16 / 31
![Page 64: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/64.jpg)
Asynchronous timeouts
window . setTimeout (f u n c t i o n ( ) { . . . } ,3000
) ;
Use jsUnitMockTimeout.jshttp://jsunit.net
Mocks setTimeout, setInterval, clearTimeout andclearInterval
Timeflow can be controlled manually in tests
http://westhoffswelt.de [email protected] slide: 17 / 31
![Page 65: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/65.jpg)
Asynchronous timeouts
window . setTimeout (f u n c t i o n ( ) { . . . } ,3000
) ;
Use jsUnitMockTimeout.jshttp://jsunit.net
Mocks setTimeout, setInterval, clearTimeout andclearInterval
Timeflow can be controlled manually in tests
http://westhoffswelt.de [email protected] slide: 17 / 31
![Page 66: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/66.jpg)
Asynchronous timeouts
window . setTimeout (f u n c t i o n ( ) { . . . } ,3000
) ;
Use jsUnitMockTimeout.jshttp://jsunit.net
Mocks setTimeout, setInterval, clearTimeout andclearInterval
Timeflow can be controlled manually in tests
http://westhoffswelt.de [email protected] slide: 17 / 31
![Page 67: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/67.jpg)
Asynchronous timeouts
window . setTimeout (f u n c t i o n ( ) { . . . } ,3000
) ;
Use jsUnitMockTimeout.jshttp://jsunit.net
Mocks setTimeout, setInterval, clearTimeout andclearInterval
Timeflow can be controlled manually in tests
http://westhoffswelt.de [email protected] slide: 17 / 31
![Page 68: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/68.jpg)
Asynchronous timeouts
window . setTimeout (f u n c t i o n ( ) { . . . } ,3000
) ;
Use jsUnitMockTimeout.jshttp://jsunit.net
Mocks setTimeout, setInterval, clearTimeout andclearInterval
Timeflow can be controlled manually in tests
http://westhoffswelt.de [email protected] slide: 17 / 31
![Page 69: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/69.jpg)
jsUnitMockTimeout example - Stopwatch
Simple stopwatch example:
1 Stopwatch . s t a r t = f u n c t i o n ( ) {2 Stopwatch . c l e a r ( ) ;3 Stopwatch . t ime r = s e t I n t e r v a l (4 Stopwatch . advance ,5 10006 ) ;7 }89 Stopwatch . advance = f u n c t i o n ( ) { . . . }
10 Stopwatch . s top = f u n c t i o n ( ) { . . . }11 Stopwatch . c l e a r = f u n c t i o n ( ) { . . . }12 Stopwatch . r e s u l t = f u n c t i o n ( ) { . . . }
http://westhoffswelt.de [email protected] slide: 18 / 31
![Page 70: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/70.jpg)
jsUnitMockTimeout example - Test
Test using jsUnitMockTimeout:
1 StopwatchTest . p r o t o t yp e . t e s tT im ing = f u n c t i o n ( ) {2 Clock . r e s e t ( ) ;3 Stopwatch . s t a r t ( ) ;4 a s s e r t E q u a l s (0 , Stopwatch . r e s u l t ( ) ) ;56 Clock . t i c k (5000) ;7 a s e r t E q u a l s (5 , Stopwatch . r e s u l t ( ) ) ;8 }
http://westhoffswelt.de [email protected] slide: 19 / 31
![Page 71: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/71.jpg)
Asynchronous callbacks
Generalized callback mocks do not exist
Mock the used function manually, calling the callbackimmediately
1 xhr . send = f u n c t i o n ( data ) {2 // C a l l onReady wi th a p p r o p r i a t e r e s u l t s
d i r e c t l y3 t h i s . onReady ( someData ) ;4 }
http://westhoffswelt.de [email protected] slide: 20 / 31
![Page 72: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/72.jpg)
Asynchronous callbacks
Generalized callback mocks do not exist
Mock the used function manually, calling the callbackimmediately
1 xhr . send = f u n c t i o n ( data ) {2 // C a l l onReady wi th a p p r o p r i a t e r e s u l t s
d i r e c t l y3 t h i s . onReady ( someData ) ;4 }
http://westhoffswelt.de [email protected] slide: 20 / 31
![Page 73: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/73.jpg)
Asynchronous callbacks
Generalized callback mocks do not exist
Mock the used function manually, calling the callbackimmediately
1 xhr . send = f u n c t i o n ( data ) {2 // C a l l onReady wi th a p p r o p r i a t e r e s u l t s
d i r e c t l y3 t h i s . onReady ( someData ) ;4 }
http://westhoffswelt.de [email protected] slide: 20 / 31
![Page 75: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/75.jpg)
Debugging
Use whatever javascript debugging technique you like!
Firebug (Firefox)Visual Studio (IE)Web Inspector (Safari)...
1 Run the test you want to debug:
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s He l l oWor ldTes t .t e s tOutpu t
2 Set breakpoints
3 Rerun the test using the command above.
http://westhoffswelt.de [email protected] slide: 21 / 31
![Page 76: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/76.jpg)
Debugging
Use whatever javascript debugging technique you like!
Firebug (Firefox)Visual Studio (IE)Web Inspector (Safari)...
1 Run the test you want to debug:
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s He l l oWor ldTes t .t e s tOutpu t
2 Set breakpoints
3 Rerun the test using the command above.
http://westhoffswelt.de [email protected] slide: 21 / 31
![Page 77: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/77.jpg)
Debugging
Use whatever javascript debugging technique you like!
Firebug (Firefox)Visual Studio (IE)Web Inspector (Safari)...
1 Run the test you want to debug:
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s He l l oWor ldTes t .t e s tOutpu t
2 Set breakpoints
3 Rerun the test using the command above.
http://westhoffswelt.de [email protected] slide: 21 / 31
![Page 78: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/78.jpg)
Debugging
Use whatever javascript debugging technique you like!
Firebug (Firefox)Visual Studio (IE)Web Inspector (Safari)...
1 Run the test you want to debug:
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s He l l oWor ldTes t .t e s tOutpu t
2 Set breakpoints
3 Rerun the test using the command above.
http://westhoffswelt.de [email protected] slide: 21 / 31
![Page 79: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/79.jpg)
Debugging
Use whatever javascript debugging technique you like!
Firebug (Firefox)Visual Studio (IE)Web Inspector (Safari)...
1 Run the test you want to debug:
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s He l l oWor ldTes t .t e s tOutpu t
2 Set breakpoints
3 Rerun the test using the command above.
http://westhoffswelt.de [email protected] slide: 21 / 31
![Page 80: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/80.jpg)
Debugging
Use whatever javascript debugging technique you like!
Firebug (Firefox)Visual Studio (IE)Web Inspector (Safari)...
1 Run the test you want to debug:
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s He l l oWor ldTes t .t e s tOutpu t
2 Set breakpoints
3 Rerun the test using the command above.
http://westhoffswelt.de [email protected] slide: 21 / 31
![Page 81: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/81.jpg)
Debugging - Using the console
A lot of javascript debuggers provide a console object
c on s o l e . l o g ( ” He l l o World ! ” ) ;
Redirect this output to js-test-driver
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s a l l −−cap tu r eCon so l e
Note: Does not work in Firefox
Use jstestdriver.console directly
j s t e s t d r i v e r . c o n s o l e . l o g ( ” He l l o World ! ” ) ;
http://westhoffswelt.de [email protected] slide: 22 / 31
![Page 82: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/82.jpg)
Debugging - Using the console
A lot of javascript debuggers provide a console object
c on s o l e . l o g ( ” He l l o World ! ” ) ;
Redirect this output to js-test-driver
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s a l l −−cap tu r eCon so l e
Note: Does not work in Firefox
Use jstestdriver.console directly
j s t e s t d r i v e r . c o n s o l e . l o g ( ” He l l o World ! ” ) ;
http://westhoffswelt.de [email protected] slide: 22 / 31
![Page 83: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/83.jpg)
Debugging - Using the console
A lot of javascript debuggers provide a console object
c on s o l e . l o g ( ” He l l o World ! ” ) ;
Redirect this output to js-test-driver
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s a l l −−cap tu r eCon so l e
Note: Does not work in Firefox
Use jstestdriver.console directly
j s t e s t d r i v e r . c o n s o l e . l o g ( ” He l l o World ! ” ) ;
http://westhoffswelt.de [email protected] slide: 22 / 31
![Page 84: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/84.jpg)
Debugging - Using the console
A lot of javascript debuggers provide a console object
c on s o l e . l o g ( ” He l l o World ! ” ) ;
Redirect this output to js-test-driver
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s a l l −−cap tu r eCon so l e
Note: Does not work in Firefox
Use jstestdriver.console directly
j s t e s t d r i v e r . c o n s o l e . l o g ( ” He l l o World ! ” ) ;
http://westhoffswelt.de [email protected] slide: 22 / 31
![Page 85: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/85.jpg)
Debugging - Using the console
A lot of javascript debuggers provide a console object
c on s o l e . l o g ( ” He l l o World ! ” ) ;
Redirect this output to js-test-driver
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s a l l −−cap tu r eCon so l e
Note: Does not work in Firefox
Use jstestdriver.console directly
j s t e s t d r i v e r . c o n s o l e . l o g ( ” He l l o World ! ” ) ;
http://westhoffswelt.de [email protected] slide: 22 / 31
![Page 86: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/86.jpg)
Debugging - Using the console
A lot of javascript debuggers provide a console object
c on s o l e . l o g ( ” He l l o World ! ” ) ;
Redirect this output to js-test-driver
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s t s a l l −−cap tu r eCon so l e
Note: Does not work in Firefox
Use jstestdriver.console directly
j s t e s t d r i v e r . c o n s o l e . l o g ( ” He l l o World ! ” ) ;
http://westhoffswelt.de [email protected] slide: 22 / 31
![Page 87: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/87.jpg)
Debugging - Live Demo
Debugging example
Live Demo!
http://westhoffswelt.de [email protected] slide: 23 / 31
![Page 89: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/89.jpg)
Test automation and continuous integration
--testOutput parameter generates JUnit XML compatibletest logs
One XML for every used browser
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s tOutpu t someD i r e c to r y−−t e s t s a l l
--browser parameter runs and captures browsersautomatically
j a v a − j a r j s T e s tD r i v e r . j a r −−browse r e x e cu tab l e1 ,e x e cu tab l e2 , . . . −−po r t 4224
http://westhoffswelt.de [email protected] slide: 24 / 31
![Page 90: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/90.jpg)
Test automation and continuous integration
--testOutput parameter generates JUnit XML compatibletest logs
One XML for every used browser
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s tOutpu t someD i r e c to r y−−t e s t s a l l
--browser parameter runs and captures browsersautomatically
j a v a − j a r j s T e s tD r i v e r . j a r −−browse r e x e cu tab l e1 ,e x e cu tab l e2 , . . . −−po r t 4224
http://westhoffswelt.de [email protected] slide: 24 / 31
![Page 91: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/91.jpg)
Test automation and continuous integration
--testOutput parameter generates JUnit XML compatibletest logs
One XML for every used browser
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s tOutpu t someD i r e c to r y−−t e s t s a l l
--browser parameter runs and captures browsersautomatically
j a v a − j a r j s T e s tD r i v e r . j a r −−browse r e x e cu tab l e1 ,e x e cu tab l e2 , . . . −−po r t 4224
http://westhoffswelt.de [email protected] slide: 24 / 31
![Page 92: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/92.jpg)
Test automation and continuous integration
--testOutput parameter generates JUnit XML compatibletest logs
One XML for every used browser
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s tOutpu t someD i r e c to r y−−t e s t s a l l
--browser parameter runs and captures browsersautomatically
j a v a − j a r j s T e s tD r i v e r . j a r −−browse r e x e cu tab l e1 ,e x e cu tab l e2 , . . . −−po r t 4224
http://westhoffswelt.de [email protected] slide: 24 / 31
![Page 93: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/93.jpg)
Test automation and continuous integration
--testOutput parameter generates JUnit XML compatibletest logs
One XML for every used browser
j a v a − j a r j s T e s tD r i v e r . j a r −−t e s tOutpu t someD i r e c to r y−−t e s t s a l l
--browser parameter runs and captures browsersautomatically
j a v a − j a r j s T e s tD r i v e r . j a r −−browse r e x e cu tab l e1 ,e x e cu tab l e2 , . . . −−po r t 4224
http://westhoffswelt.de [email protected] slide: 24 / 31
![Page 94: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/94.jpg)
Test automation and continuous integration
--port and --tests can be combined to automate serverstartup and testrun
j a v a − j a r j s T e s tD r i v e r . j a r −−browse r e x e cu tab l e1 ,e x e cu tab l e2 , . . . −−po r t 4224 −−t e s t s a l l
http://westhoffswelt.de [email protected] slide: 25 / 31
![Page 95: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/95.jpg)
Test automation and continuous integration
--port and --tests can be combined to automate serverstartup and testrun
j a v a − j a r j s T e s tD r i v e r . j a r −−browse r e x e cu tab l e1 ,e x e cu tab l e2 , . . . −−po r t 4224 −−t e s t s a l l
http://westhoffswelt.de [email protected] slide: 25 / 31
![Page 97: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/97.jpg)
Code coverage
Code coverage may be an indicator for untested code paths
js-test-driver plugin allows to create code coverage reports
Possible output formats
Textual output on terminalLCOV compatible info file
http://westhoffswelt.de [email protected] slide: 26 / 31
![Page 98: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/98.jpg)
Code coverage
Code coverage may be an indicator for untested code paths
js-test-driver plugin allows to create code coverage reports
Possible output formats
Textual output on terminalLCOV compatible info file
http://westhoffswelt.de [email protected] slide: 26 / 31
![Page 99: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/99.jpg)
Code coverage
Code coverage may be an indicator for untested code paths
js-test-driver plugin allows to create code coverage reports
Possible output formats
Textual output on terminalLCOV compatible info file
http://westhoffswelt.de [email protected] slide: 26 / 31
![Page 100: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/100.jpg)
Code coverage
Code coverage may be an indicator for untested code paths
js-test-driver plugin allows to create code coverage reports
Possible output formats
Textual output on terminalLCOV compatible info file
http://westhoffswelt.de [email protected] slide: 26 / 31
![Page 101: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/101.jpg)
Code coverage
Code coverage may be an indicator for untested code paths
js-test-driver plugin allows to create code coverage reports
Possible output formats
Textual output on terminalLCOV compatible info file
http://westhoffswelt.de [email protected] slide: 26 / 31
![Page 102: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/102.jpg)
Code coverage - Plugin
Download jar-file from js-test-driver homepage
Put the coverage.jar file into some folder relative to yourjs-text-driver.jar (eg. plugins/coverage.jar)
Add plugin to jsTestDriver.conf
1 p l u g i n :2 − name : ” cove rage ”3 j a r : ” p l u g i n s / cove r age . j a r ”4 module : ”com . goog l e . j s t e s t d r i v e r . cove r age .
CoverageModule ”
http://westhoffswelt.de [email protected] slide: 27 / 31
![Page 103: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/103.jpg)
Code coverage - Plugin
Download jar-file from js-test-driver homepage
Put the coverage.jar file into some folder relative to yourjs-text-driver.jar (eg. plugins/coverage.jar)
Add plugin to jsTestDriver.conf
1 p l u g i n :2 − name : ” cove rage ”3 j a r : ” p l u g i n s / cove r age . j a r ”4 module : ”com . goog l e . j s t e s t d r i v e r . cove r age .
CoverageModule ”
http://westhoffswelt.de [email protected] slide: 27 / 31
![Page 104: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/104.jpg)
Code coverage - Plugin
Download jar-file from js-test-driver homepage
Put the coverage.jar file into some folder relative to yourjs-text-driver.jar (eg. plugins/coverage.jar)
Add plugin to jsTestDriver.conf
1 p l u g i n :2 − name : ” cove rage ”3 j a r : ” p l u g i n s / cove r age . j a r ”4 module : ”com . goog l e . j s t e s t d r i v e r . cove r age .
CoverageModule ”
http://westhoffswelt.de [email protected] slide: 27 / 31
![Page 105: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/105.jpg)
Using LCOV to generate HTML reports
The --testOutput commandline parameter generates codecoverage reports in LCOV compatible info file format
Use genHtml from the LCOV package to generate nice HTMLresults:
http://ltp.sourceforge.net
http://westhoffswelt.de [email protected] slide: 28 / 31
![Page 106: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/106.jpg)
Using LCOV to generate HTML reports
The --testOutput commandline parameter generates codecoverage reports in LCOV compatible info file format
Use genHtml from the LCOV package to generate nice HTMLresults:
http://ltp.sourceforge.net
http://westhoffswelt.de [email protected] slide: 28 / 31
![Page 107: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/107.jpg)
Code coverage - Live Demo
Code coverage example
Live Demo!
http://westhoffswelt.de [email protected] slide: 29 / 31
![Page 108: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/108.jpg)
Thanks for listening
Questions, comments or annotations?
Slides: http://westhoffswelt.de/portfolio.htm
Contact: Jakob Westhoff <[email protected]>Twitter: @jakobwesthoff
Please leave comments and vote at: http://joind.in/1626
http://westhoffswelt.de [email protected] slide: 30 / 31
![Page 109: Javascript Unittesting with js-test-driver](https://reader034.fdocuments.in/reader034/viewer/2022052622/558fcac31a28ab02398b45f2/html5/thumbnails/109.jpg)
Sources
Breathe Icon Set:https://launchpad.net/breathe-icon-set, Licensedunder Creative Common Attribution-ShareAlike 3.0 License(http://creativecommons.org/licenses/by-sa/3.0)
http://westhoffswelt.de [email protected] slide: 31 / 31