Home >Technology >JavaScript Qualitätssicherung

JavaScript Qualitätssicherung

Date post:27-May-2015
Category:
View:527 times
Download:0 times
Share this document with a friend
Transcript:
  • 1. Werkzeuge zur Qualittssicherung in JavaScriptTuesday 5 November 13

2. WER BIN ICH? SebastianSpringer https://github.com/sspringer82 @basti_springerTuesday 5 November 13 3. JAVASCRIPT?Tuesday 5 November 13 4. QUALITT?Tuesday 5 November 13 5. Unter Softwarequalitt versteht man die Gesamtheit der Merkmale und Merkmalswerte eines Softwareprodukts, die sich auf dessen Eignung beziehen, festgelegte oder vorausgesetzte Erfordernisse zu erfllen. (Balzert)Tuesday 5 November 13 6. DOKUMENTATION?Tuesday 5 November 13 7. README.MDTuesday 5 November 13 8. API DOCnpm install -g git://github.com/jsdoc3/jsdoc.gitTuesday 5 November 13 9. STATISCHE VS. DYNAMISCHE CODEANALYSETuesday 5 November 13 10. STATISCHE CODEANALYSETuesday 5 November 13 11. TOKENIZER?Tuesday 5 November 13 12. var answer = 6 * 7;Tuesday 5 November 13 13. {SYNTAX "type": "Program", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "answer" }, "init": { "type": "BinaryExpression", "operator": "*", "left": { "type": "Literal", "value": 6, "raw": "6" }, "right": { "type": "Literal", "value": 7, "raw": "7" } } } ], "kind": "var" } ]}Tuesday 5 November 13 14. TOKENS [ { "type": "Keyword", "value": "var" }, { "type": "Identifier", "value": "answer" }, { "type": "Punctuator", "value": "=" }, { "type": "Numeric", "value": "6" }, { "type": "Punctuator", "value": "*" }, { "type": "Numeric", "value": "7" }, { "type": "Punctuator", "value": ";" } ]Tuesday 5 November 13 15. VALIDATOR VS. LINTERTuesday 5 November 13 16. Tuesday 5 November 13 17. by Douglas CrockfordTuesday 5 November 13 18. by Douglas Crockford Warning: JSLint will hurt your feelingsTuesday 5 November 13 19. sudo npm install -g jslintTuesday 5 November 13 20. var Calculator = function () {}; Calculator.prototype.add = function(a, b) { if('number' !== typeof a ||'number' !== typeof b) throw new Error('Can add only numbers'); return a+b; }Tuesday 5 November 13 21. #1 Missing 'use strict' statement. var Calculator = function () {}; // Line 1, Pos 31 #2 Empty block. var Calculator = function () {}; // Line 1, Pos 30 #3 Expected exactly one space between 'function' and '('. Calculator.prototype.add = function(a, b) { // Line 3, Po #4 Missing 'use strict' statement. if('number' !== typeof a ||'number' !== typeof b) // Line #5 Expected exactly one space between 'if' and '('. if('number' !== typeof a ||'number' !== typeof b) // Line #6 Missing space between '||' and 'number'. if('number' !== typeof a ||'number' !== typeof b) // Line #7 Expected exactly one space between ')' and 'throw'. throw new Error('Can add only numbers'); // Line 6, Pos 9 #8 Expected '{' and instead saw 'throw'. throw new Error('Can add only numbers'); // Line 6, Pos 9 #9 Stopping. (54% scanned). // Line 6, Pos 9Tuesday 5 November 13 22. ESVALIDATEby http://esprima.org/Tuesday 5 November 13 23. sudo npm install -g esvalidateTuesday 5 November 13 24. return 42; // Return statement not inside a function function f() { 'use strict'; // No more octal var x = 042; // Duplicate property var y = { x: 1, x: 2 }; // With statement can't be used with (z) {} }Tuesday 5 November 13 25. validate.js:1: Illegal return statement validate.js:7: Octal literals are not allowed in strict mode. validate.js:10: Duplicate data property in object literal not allowed in strict mode validate.js:10: Strict mode code may not include a with statementTuesday 5 November 13 26. KOMPLEXITTTuesday 5 November 13 27. PLATOTuesday 5 November 13 28. Tuesday 5 November 13 29. LOC Maintainability Estimated Errors in Implementation Lint Errors Tuesday 5 November 13 30. Tuesday 5 November 13 31. https://sourceforge.net/projects/pmd/les/pmd/5.0.5/pmdbin-5.0.5.zip/downloadTuesday 5 November 13 32. run.sh pmd -d ./pmd -rulesets ecmascript-basicTuesday 5 November 13 33. pmd/example.js:3:! Avoid assignments in operands pmd/example.js:3:! Avoid using global variables pmd/example.js:3:! Use ===/!== to compare with true/false or NumbersTuesday 5 November 13 34. UnreachableCodeEqualComparisonInaccurateNumericLiteral AssignmentInOperand UseBaseWithParseInt ScopeForInVariable GlobalVariableAvoidTrailingComma ConsistentReturnTuesday 5 November 13 35. CPDTuesday 5 November 13 36. run.sh cpd --minimum-tokens 12 --files / path/to/src --language ecmascript -format xml > cpd.xmlTuesday 5 November 13 37. TESTSTuesday 5 November 13 38. FRAMEWORKSTuesday 5 November 13 39. Sinon.jsTuesday 5 November 13FRAMEWORKS 40. jsunit Sinon.jsTuesday 5 November 13FRAMEWORKS 41. jsunit Sinon.jsFRAMEWORKS dohTuesday 5 November 13 42. jsunit Sinon.jsFRAMEWORKS dohTuesday 5 November 13JS Test Driver 43. jsunit qunit Sinon.jsFRAMEWORKS dohTuesday 5 November 13JS Test Driver 44. jsunit qunit Sinon.js JasmineTuesday 5 November 13FRAMEWORKS dohJS Test Driver 45. jsunit qunit Sinon.js JasmineTuesday 5 November 13SiestaFRAMEWORKS dohJS Test Driver 46. Karma jsunit qunit Sinon.js JasmineTuesday 5 November 13SiestaFRAMEWORKS dohJS Test Driver 47. SERVERSIDE VS. CLIENTSIDETuesday 5 November 13 48. Tuesday 5 November 13 49. Tuesday 5 November 13 50. COVERAGETuesday 5 November 13 51. Tuesday 5 November 13 52. ENTWICKLUNGSUMGEBUNG (IDE)Tuesday 5 November 13 53. Tuesday 5 November 13 54. SERVERSIDEhttps://code.google.com/p/js-test-driver/ Tuesday 5 November 13 55. AUTOMATISIERUNGTuesday 5 November 13 56. Tuesday 5 November 13 57. JENKINS Tasks per Ant ausfhrenVisualisierung ber PluginsTuesday 5 November 13 58. FRAGEN?Tuesday 5 November 13 59. Kontakt Sebastian Springer sebastian.springer@mayflower.de Mayflower GmbH Mannhardtstr. 6 80538 Mnchen Deutschland @basti_springer https://github.com/sspringer82Tuesday 5 November 13

Embed Size (px)
Recommended