Upgrade to Pro — share decks privately, control downloads, hide ads and more …

前端自动化工具探索

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for w3cplus w3cplus
January 18, 2013

 前端自动化工具探索

前端自动化工具探索

Avatar for w3cplus

w3cplus

January 18, 2013
Tweet

More Decks by w3cplus

Other Decks in Technology

Transcript

  1. 前端自动化在国内的发展 • 百度 sh为主,fis平台 • http://www.flkit.org/ • 新浪微博 : •

    https://github.com/FlashSoft/weibo-packager • 淘宝ued ant-grunt.js(kissy Module compiler,seajs spm) • 人人网(css python) http://fed.renren.com/archives/1427
  2. 单元测试与自动化测试 • 什么叫js单元测试 function addThreeToNumber(el){ return el + 3; }

    (function testAddThreeToNumber() { var a = 5, valueExpected = 8; if (addThreeToNumber(a) === valueExpected) { console.log("Passed!"); } else { console.log("Failed!"); } } ()); 被测试函数 测试用例 断言
  3. 注意js的书写 分号 合并前的标识符 匿名函数包裹(露该漏的) (function (){ var tookit = {

    each:function(){}, insert:function(){}, toggleDisplay:function(){}, } return tookit })() 慎用全局变量
  4. 自动化工具实战之phantomjs phantomjs的wiki https://github.com/ariya/phantomjs/wiki api https://github.com/ariya/phantomjs/wiki/API-Reference#wiki-webpage-url 介绍。。来自网易 。。 PhantomJS便是这么一个为自动化而生的利器,它本质上是一个基于webkit内核 的无界面浏览器,并可使用JavaScript或CoffeeScript进行编程。由于没有界面, 它的使用就有点像curl,

    lynx之类的命令行式文本浏览器。但PhantomJS远不是文 本浏览器那么简单,由于它是基于webkit内核的,因此拥有的完善的Javascript解 析、页面渲染功能,你完全可用它来模拟一个现代浏览器在加载网页时所做的 各种事件。 安装程序 http://phantomjs.org/download.html