UI Testing Best Practices - An Expected JourneyOren Farhi
This slide focus on the good reasons for writing unit tests for testing ui.
Much like you're testing ui manually, you can have simple minimal code doing that for you.
For much of its existence, JavaScript has been slow. No one complained until developers created complex web applications with thousands of lines of JavaScript code. Although newer JavaScript engines have improved the situation, there’s still a lot to understand about what makes JavaScript slow and what you can do to speed up your code.
UI Testing Best Practices - An Expected JourneyOren Farhi
This slide focus on the good reasons for writing unit tests for testing ui.
Much like you're testing ui manually, you can have simple minimal code doing that for you.
For much of its existence, JavaScript has been slow. No one complained until developers created complex web applications with thousands of lines of JavaScript code. Although newer JavaScript engines have improved the situation, there’s still a lot to understand about what makes JavaScript slow and what you can do to speed up your code.
Efficient JavaScript Unit Testing, May 2012Hazem Saleh
One of the biggest challenges of many web applications is the support on the different browsers with different versions. JavaScript code that runs on Safari does not necessarily mean it will work on IE or Firefox or Google chrome. This challenge is inherited from the lack of testing the JavaScript code that lives in the presentation tier from day one. Without unit testing the JavaScript code, organization will pay much money for testing, re-testing, and re-testing web applications for just deciding upgrading or supporting new browsers. This presentation shows the solution of this problem.
Confused by testing terms and jargon? This talk walks through testing web applications, explaining the difference between unit testing and end to end testing. Several tools and concepts are also explored through a demo section.
Sample projects can be found at https://github.com/sethmcl/testing_web_applications.
Introductory overview of testing techniques for web application development. Explains where different testing methods fit in to the software development cycle.
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Codemotion
In this talk, I would like to speak about best practices for writing e2e tests with Protractor. The styleguide that I will introduce, is a joint initiative of mine and @andresdom from Google. Some of the subjects that will be covered include why e2e testing is important, what e2e tests should cover, naming conventions, selector strategies, page objects, helper objects and performance considerations. That and lots of smileys obviously, because we wanted to smiley all the things ...right? ¯\_(ツ)_/¯
Slides for the presentation I did for the Vancouver AngularJS meetup group.
http://www.meetup.com/vanangularJS/events/216391652/
The code is available on my github account.
https://github.com/aeisenberg/angular-app/tree/vanangular-protractor
(Notice the branch is not master.)
Mal ganz ehrlich: Testen im Frontend hat noch nie viel Spaß gemacht. In meinem Talk möchte ich mit Jest eine Testbibliothek vorstellen, die genau das ändern kann. Jest lässt sich ohne viel Konfiguration direkt einsetzen und bringt alles mit, was man von einer Testbibliothek erwartet (und noch mehr).
An vielen praktischen Beispielen möchte ich meine Lieblingsfeatures wie Snapshot-Tests, Mocking oder das tolle CLI erläutern und zeigen, dass Testen im Frontend durchaus Spaß machen kann. Eine Ausrede weniger, um auf das Testen im Frontend zu verzichten!
Vorkenntnisse:
Grundlegende JavaScript-Kenntnisse.
Lernziele:
Die Teilnehmer sollen einen Überblick über die Funktionsweise und die Einsatzbereiche von Jest bekommen. Sie lernen, wie sie für Tests in Frontend-Projekten mit Jest im Werkzeugkoffer gut gerüstet sind.
Automation Abstraction Layers: Page Objects and BeyondAlan Richardson
An overview of different approaches to Page Objects and Domain Objects for GUI Automation. Examples use WebDriver and Java.
Full source code is available to download, For more details see the associated blog post.
How do I write Testable Javascript so I can Test my CF API on Server and ClientGavin Pickin
Everyone who wasn't writing JavaScript, probably is now. Atwood's Law: any application that can be written in JavaScript, will eventually be written in JavaScript.
We build our CFCs and CF API to be consumed with AJAX, and like Server Side, we need to be able to test our CFC endpoints, and the Javascript that uses them. With Testbox and Jasmine both using BDD, your test code can almost be isomorphic.
Take your JavaScript spaghetti and make it unit testable. Test your API on Server and Client.
Session from GIDS 2014, showing how to do automated Web testing using a variety of JavaScript frameworks, including QUnit, Jasmine, Protractor, Selenium, and PhantomJS
Efficient JavaScript Unit Testing, May 2012Hazem Saleh
One of the biggest challenges of many web applications is the support on the different browsers with different versions. JavaScript code that runs on Safari does not necessarily mean it will work on IE or Firefox or Google chrome. This challenge is inherited from the lack of testing the JavaScript code that lives in the presentation tier from day one. Without unit testing the JavaScript code, organization will pay much money for testing, re-testing, and re-testing web applications for just deciding upgrading or supporting new browsers. This presentation shows the solution of this problem.
Confused by testing terms and jargon? This talk walks through testing web applications, explaining the difference between unit testing and end to end testing. Several tools and concepts are also explored through a demo section.
Sample projects can be found at https://github.com/sethmcl/testing_web_applications.
Introductory overview of testing techniques for web application development. Explains where different testing methods fit in to the software development cycle.
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Codemotion
In this talk, I would like to speak about best practices for writing e2e tests with Protractor. The styleguide that I will introduce, is a joint initiative of mine and @andresdom from Google. Some of the subjects that will be covered include why e2e testing is important, what e2e tests should cover, naming conventions, selector strategies, page objects, helper objects and performance considerations. That and lots of smileys obviously, because we wanted to smiley all the things ...right? ¯\_(ツ)_/¯
Slides for the presentation I did for the Vancouver AngularJS meetup group.
http://www.meetup.com/vanangularJS/events/216391652/
The code is available on my github account.
https://github.com/aeisenberg/angular-app/tree/vanangular-protractor
(Notice the branch is not master.)
Mal ganz ehrlich: Testen im Frontend hat noch nie viel Spaß gemacht. In meinem Talk möchte ich mit Jest eine Testbibliothek vorstellen, die genau das ändern kann. Jest lässt sich ohne viel Konfiguration direkt einsetzen und bringt alles mit, was man von einer Testbibliothek erwartet (und noch mehr).
An vielen praktischen Beispielen möchte ich meine Lieblingsfeatures wie Snapshot-Tests, Mocking oder das tolle CLI erläutern und zeigen, dass Testen im Frontend durchaus Spaß machen kann. Eine Ausrede weniger, um auf das Testen im Frontend zu verzichten!
Vorkenntnisse:
Grundlegende JavaScript-Kenntnisse.
Lernziele:
Die Teilnehmer sollen einen Überblick über die Funktionsweise und die Einsatzbereiche von Jest bekommen. Sie lernen, wie sie für Tests in Frontend-Projekten mit Jest im Werkzeugkoffer gut gerüstet sind.
Automation Abstraction Layers: Page Objects and BeyondAlan Richardson
An overview of different approaches to Page Objects and Domain Objects for GUI Automation. Examples use WebDriver and Java.
Full source code is available to download, For more details see the associated blog post.
How do I write Testable Javascript so I can Test my CF API on Server and ClientGavin Pickin
Everyone who wasn't writing JavaScript, probably is now. Atwood's Law: any application that can be written in JavaScript, will eventually be written in JavaScript.
We build our CFCs and CF API to be consumed with AJAX, and like Server Side, we need to be able to test our CFC endpoints, and the Javascript that uses them. With Testbox and Jasmine both using BDD, your test code can almost be isomorphic.
Take your JavaScript spaghetti and make it unit testable. Test your API on Server and Client.
Session from GIDS 2014, showing how to do automated Web testing using a variety of JavaScript frameworks, including QUnit, Jasmine, Protractor, Selenium, and PhantomJS
Mal ganz ehrlich: Testen im Frontend hat noch nie viel Spaß gemacht. In meinem Talk möchte ich mit Jest eine Testbibliothek vorstellen, die genau das ändern kann. Jest ist ohne viel Konfiguration direkt einsetzbar und bringt alles mit, was man von einer Testbibliothek erwartet (und noch mehr). An vielen praktischen Beispielen möchte ich meine Lieblingsfeatures wie z.B. Snapshot-Tests, Mocking oder das tolle CLI erläutern und zeigen, dass Testen im Frontend durchaus Spaß machen kann. Eine Ausrede weniger, um auf das Testen im Frontend zu verzichten!
Most projects in CF now involve creating some type of consumable CFC Endpoint or API Service... do you Unit test your API, do you use Integration Tests on your API? How many ways do you test your API? Not all tests are created equal.
Description
Most projects in CF now involve creating some type of consumable CFC Endpoint or API Service... do you Unit test your API, do you use Integration Tests on your API? How many ways do you test your API? Not all tests are created equal.
We build our CFCs and CF API to be consumed with CF Apps, Mobile Apps, Javascript apps and devices we haven’t even thought about yet. To be smart developers we need to be able to test our CFC endpoints, and the code that uses those endpoints.
We’ll learn how to test your API serverside with Testbox and Clientside with Jasmine.
With Testbox and Jasmine both using BDD, your test code can almost be isomorphic.
Attendees should have some exposure to CFCs as endpoints, or CF API creations, and consuming with other languages/devices, in this case, JavaScript.
## Attendees will learn
How to use Testbox to test your CFCs 2 different ways
Different types and ways to test JavaScript
Overview of client/server side testing tools
Building testing into your workflow
You are one of many that are not testing your APIs thoroughly
JavaScript has a well deserved reputation of be hard to write and debug. Put it on a mobile device and the problems increase exponentially. Mobile browsers lack all of the niceties that developers rely on to do testing and debugging including the most fundamental tool, the debugger. But it is possible to write quality JavaScript on a mobile device without relying on blind luck. In this talk I will show all of the tools and tricks that I learned in my 12 month development of the new KBB.com mobile site.
Testing mit Codeception: Full-stack testing PHP frameworkSusannSgorzaly
Codeception is a PHP testing framework for Behavior Driven Development, which covers all kinds of tests: unit tests, functional tests and acceptance tests. It is fast and simple in both usage and execution. This talk will give you a introduction to the software testing basics using codeception. It will also cover some stumbling blocks when writing tests, like:
- Test code stability against small changes
- Data stability
- Test structure
Last but not least I will give you a short outlook how to make your tests also understandable for product owners.
Most projects in CF now involve creating some type of consumable CFC Endpoint or API Service... do you Unit test your API, do you use Integration Tests on your API? How many ways do you test your API? Not all tests are created equal.
We build our CFCs and CF API to be consumed with CF Apps, Mobile Apps, Javascript apps and devices we haven’t even thought about yet. To be smart developers we need to be able to test our CFC endpoints, and the code that uses those endpoints.
We’ll learn how to test your API serverside with Testbox and Clientside with Jasmine.
With Testbox and Jasmine both using BDD, your test code can almost be isomorphic.
Attendees should have some exposure to CFCs as endpoints, or CF API creations, and consuming with other languages/devices, in this case, JavaScript.
Attendees will learn
How to use Testbox to test your CFCs 2 different ways
Different types and ways to test JavaScript
Overview of client/server side testing tools
Building testing into your workflow
You are one of many that are not testing your APIs thoroughly
Most projects in CF now involve creating some type of consumable CFC Endpoint or API Service... do you Unit test your API, do you use Integration Tests on your API? How many ways do you test your API? Not all tests are created equal.
We build our CFCs and CF API to be consumed with CF Apps, Mobile Apps, Javascript apps and devices we haven’t even thought about yet. To be smart developers we need to be able to test our CFC endpoints, and the code that uses those endpoints.
We’ll learn how to test your API serverside with Testbox and Clientside with Jasmine.
With Testbox and Jasmine both using BDD, your test code can almost be isomorphic.
Attendees should have some exposure to CFCs as endpoints, or CF API creations, and consuming with other languages/devices, in this case, JavaScript.
Attendees will learn
How to use Testbox to test your CFCs 2 different ways
Different types and ways to test JavaScript
Overview of client/server side testing tools
Building testing into your workflow
You are one of many that are not testing your APIs thoroughly
Mock what? What Mock?Learn What is Mocking, and how to use Mocking with ColdFusion testing, development, and continuous integration. Look at Mocking and Stubbing with a touch of Theory and a lot of Examples, including what you could test, and what you should test… and what you shouldn't test (but might be fun).
Intro to node.js - Ran Mizrahi (27/8/2014)Ran Mizrahi
Node.js is a platform built on Chrome V8 javascript runtime engine for building fast and scalable, non-blocking, real-time and network applications. In this session Ran will introduce node.js and how to develop large code bases using it. He'll cover the following aspects:
• What is node.js?
• Apache vs. Nginx performance (One thread per connection vs. event loop) and what it has to do with node.js.
• Why node was written in Javascript?
• Main tools and frameworks (Express, socket.io, mongoose etc.)
• TDD/BDD with node.js using mocha and Chai.
Ran Mizrahi, Founder of CoCycles, Passionate entrepreneur and software engineer who loves to continuously innovate and deliver meaningful products while having true fun with the right team.
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
In this slide, identify what to test and choose the best language for automation. Learn to write maintainable and reusable Selenium tests and add UI layout test as part of automation using Galen framework. This slide will also guide you in reporting structure by using external plugin's, an illustration covering cross browser testing (Running selenium grid with Docker) and explain Code repository (Git) and Jenkins CI tool.
Cover the advantages of test driven development, the reasons for pushing it all the way to the browser level, and then explore the options for testing JavaScript, look at some examples, and then integrate the tests into our existing development workflow.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
GridMate - End to end testing is a critical piece to ensure quality and avoid...ThomasParaiso2
End to end testing is a critical piece to ensure quality and avoid regressions. In this session, we share our journey building an E2E testing pipeline for GridMate components (LWC and Aura) using Cypress, JSForce, FakerJS…
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
Maruthi Prithivirajan, Head of ASEAN & IN Solution Architecture, Neo4j
Get an inside look at the latest Neo4j innovations that enable relationship-driven intelligence at scale. Learn more about the newest cloud integrations and product enhancements that make Neo4j an essential choice for developers building apps with interconnected data and generative AI.
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIVladimir Iglovikov, Ph.D.
Presented by Vladimir Iglovikov:
- https://www.linkedin.com/in/iglovikov/
- https://x.com/viglovikov
- https://www.instagram.com/ternaus/
This presentation delves into the journey of Albumentations.ai, a highly successful open-source library for data augmentation.
Created out of a necessity for superior performance in Kaggle competitions, Albumentations has grown to become a widely used tool among data scientists and machine learning practitioners.
This case study covers various aspects, including:
People: The contributors and community that have supported Albumentations.
Metrics: The success indicators such as downloads, daily active users, GitHub stars, and financial contributions.
Challenges: The hurdles in monetizing open-source projects and measuring user engagement.
Development Practices: Best practices for creating, maintaining, and scaling open-source libraries, including code hygiene, CI/CD, and fast iteration.
Community Building: Strategies for making adoption easy, iterating quickly, and fostering a vibrant, engaged community.
Marketing: Both online and offline marketing tactics, focusing on real, impactful interactions and collaborations.
Mental Health: Maintaining balance and not feeling pressured by user demands.
Key insights include the importance of automation, making the adoption process seamless, and leveraging offline interactions for marketing. The presentation also emphasizes the need for continuous small improvements and building a friendly, inclusive community that contributes to the project's growth.
Vladimir Iglovikov brings his extensive experience as a Kaggle Grandmaster, ex-Staff ML Engineer at Lyft, sharing valuable lessons and practical advice for anyone looking to enhance the adoption of their open-source projects.
Explore more about Albumentations and join the community at:
GitHub: https://github.com/albumentations-team/albumentations
Website: https://albumentations.ai/
LinkedIn: https://www.linkedin.com/company/100504475
Twitter: https://x.com/albumentations
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
How to Get CNIC Information System with Paksim Ga.pptxdanishmna97
Pakdata Cf is a groundbreaking system designed to streamline and facilitate access to CNIC information. This innovative platform leverages advanced technology to provide users with efficient and secure access to their CNIC details.
2. var me = {
name : ”Mats Bryntse”,
age : 35,
from : ”Helsingborg, Sweden”,
does : ”Runs Bryntum”,
site : ” www.bryntum.com”,
twitter : ”@bryntum”,
likes : ”Ext JS”
};
About me
6. • have a web application a frontend test suite?
• have frontend test suite as part of your CI proc.
• run your test suite in all major browsers?
• have zero or less frontend tests for your app.
How many of you...
7. Unit test JS, really?? But...
”... my code is bug free”
”...testing takes time away from
adding new features (+ new bugs)”
”...it’s QA’s job to test”
”... it’s boring and I’ll quit my job”
10. The backend
• Single controlled platform
• Simple to test and refactor
• Good IDEs and tools
C#
Java
PHP
11. The frontend
• Multiple platforms & versions
(Mac, Windows XP/Vista/7, Linux...)
• Multiple browser versions
• Hard to refactor
• JavaScript support in IDEs is
still !== awesome
12. Conclusion
• Developing frontend code is harder than
developing server code.
• Mainly due to lack of good tools
• Lots of uncertainty, x-browser issues
• IE6
13. As good JS dev tools are hard to find, we need to
make good use of existing tools and practices.
18. Efficient debugging
• We spend lots of time debugging frontend
code.
• Helpful to know which parts of an application
is well tested => less likely to have bugs.
19. Additional benefits of
testing
• Find bugs early
• Develop & refactor with confidence
• Tests serve as additional API documentation
• Helps you detect tightly coupled code
20. Code handover
• Test cases can be immensely useful when
handing over responsibility for a JS module
• Developer Bob quits his job. New guy gets
responsibility of his JS code.
• How will the new guy know what parts of the
codebase safe to change & refactor?
21. New guy studies codebase
/* I am not sure if we need this, but too scared to delete. */
// drunk, fix later
// TODO make this work
/**
* When I wrote this, only God and I understood what I was doing
* Now, God only knows
**/
scripts/core/application.js
23. Code handover
• Without test suite, new guy will be afraid to
make any major changes.
• Only minor cosmetic changes on the surface.
• System accumulates cruft over time.
• Sounds familiar?
24. So, how do I start..?
• Code and design for testability
• Choose the tools to help you
• Automation / CI / Coverage
25. Writing testable JS
• Keep your JavaScript in JS files
• Never put JavaScript in your HTML
page/tags
• Keep code organized in logical manageable
files. Decide on some max nbr of lines/file.
27. Writing testable JS
• Fat model, skinny view
• Don’t pollute your views with business logic
• Testing pure JS is a lot easier than testing
DOM-dependent JS
• Promotes reuse of your code
28. Writing testable JS
Ext.define('UserForm', {
extend: 'Ext.FormPanel',
width: 400,
height: 400,
model: new UserModel(),
// Returns true if User is valid
isValid: function (userModel) {
return userModel.name.length > 4 &&
userModel.password.length > 8;
}
});
Mixing view and business logic
29. Writing testable JS
Ext.define('UserModel', {
extend: 'Ext.data.Model',
name : “”,
password : “”,
// Returns array of User model objects
isValid : function () {
return this.name.length > 4 &&
this.password.length > 8;
}
});
Better:
30. Writing testable JS
Ext.define('UserForm', {
extend: 'Ext.FormPanel',
width: 400,
height: 400,
model: new UserModel(),
// Returns true if User is valid
isValid: function (userModel) {
return userModel.isValid();
}
});
No business logic in view
31. Avoid private code
• Avoid overuse of private functions in
closures
• If your code cannot be accessed it cannot
be tested
33. Choose your tools
• Last few years has brought numerous new
testing tools to the JavaScript world
• Quite hard to know which to choose,
evaluation needed
• Positive trend, lots of buzz around web testing
34. Unit Test Tools
• Jasmine
• Siesta
• Buster.js (beta) / Sinon.js
• DOH (Dojo Object Harness)
• Qunit (jQuery)
• JsUnit (abandoned?)
• YUI Test
• Google js-test
• Zombie (headless/Node)
35. Pure JS Test Tools
• More or less similar approach in most tools
• Define HTML/JS harness, and test suites is
composed by single JS test files.
• Some support/require setup/tearDown
• Others rely on iframes, slower though no
cleanup required
36. Jasmine
• Simple DOM-less testing
• BDD syntax
• Borrows “the best parts” of ScrewUnit,
JSSpec, JSpec, and RSpec.
37. Anatomy of a Jasmine test
describe('panda', function () {
it('is happy', function () {
expect(panda).toBe('happy');
});
});
Suite / Spec
Source
panda = 'happy'; // => PASS
39. Siesta
• Unit testing and functional DOM testing
• Simple TDD syntax
• Test any JS: Ext JS, jQuery, NodeJS etc.
• Automate using PhantomJS & Selenium.
• Extensible, easy to add own assertion
methods
40. Anatomy of a Siesta test
StartTest(function(t) {
t.diag('Testing jQuery...');
$('body').html('JQuery was here');
t.contentLike(document.body,
'JQuery was here',
'Found correct text in DOM');
});
test-jquery_01.js
42. Testing Ajax
• Try to avoid calling your actual server.
• Use either static JS files with mock data
(async, slower)
• Or Mock the entire Ajax call (sync, faster)
Sinon.js, Jasmine-ajax etc.
43. Testing Ajax w/ Jasmine
it("should make an AJAX request to the correct URL", function() {
spyOn($, "ajax");
getProduct(123);
expect($.ajax.mostRecentCall.args[0]["url"]).toEqual("/products/123");
});
function getProduct(id) {
$.ajax({
type: "GET",
url: "/products/" + id,
dataType: "json"
});
}
44. Functional testing
• Test larger piece of your app, or the
application as a whole.
• Simulate user interaction, click, type etc.
• Navigate between pages
46. Interacting with the DOM
Two main approaches of faking a user
• Synthetic events
• Native events (via Java Applet)
47. Synthetic events
+ Supported in all major browsers
+ Compatible with mobile
+ Don’t rely on native event queue
Tests can be run in parallell.
- Browsers don’t ”trust” synthetic events
- Enter key on a focused link
- Tab between input fields, etc...
- X-browser differences
DOM Events, Key events, key codes (http://unixpapa.com)
48. Native events
+ Java applets are supported in all desktop
browsers
+ As close to a ’real’ user as possible
- Won’t work on iOS, Android.
- No parallell tests since native event queue
is used.
49. ”Browser Drivers”
Opens real browser instances and ’drives’
them
Outputs commands and evaluates result
Can be quite slow
50. ”Browser Drivers”
Selenium
The most widely used functional testing tool. Firefox Recorder.
JsTestDriver
By Google. ”Remote JavaScript Console”. IntelliJ and Eclipse
Watir
Web Application Testing in Ruby. Also a .NET port, WatiN.
Sahi
By TytoSoftware. Has X-browser recorder.
51. Headless browsers
• “A web browser without a graphical user
interface”
• Command line interface
• Great for automating tests, integrating with
CI tools (Jenkins, Cruise Control…)
52. Headless browsers
+ Run tests on command line
+ Faster
+ Automation
+ Doesn’t require an actual browser
- Not 100% accurate, but close.
56. Continuous Integration
• Once you have decided on your testing
toolset, integrate it into your CI.
• Automatically run test suite on pre-commit
or post-commit
• Nightly build, full test suite execution,
reporting via email, or other CI systems.
59. Evaluating tools
• Some are geared towards specific server side
languages, Java/Ruby/C#
• Prototype and find what works best for you
• Make sure the tool you use integrates nicely
with your IDE and CI-environment