This material about efficient JavaScript unit testing is presented by Hazem Saleh in the Egyptian Java Developer Conference that was held in 09 March 2013.
This presentation describes the some of the major functionality of JUnit4 and TestNG .Each topic contains example so that a viewer can understand the usage and apply them in their code.
The presentation contains a definition and survey of the benefits of Unit Testing, and a little coding example to get the feeling of Unit Testing using JUnit, EasyMock and XMLUnit.
This presentation describes the some of the major functionality of JUnit4 and TestNG .Each topic contains example so that a viewer can understand the usage and apply them in their code.
The presentation contains a definition and survey of the benefits of Unit Testing, and a little coding example to get the feeling of Unit Testing using JUnit, EasyMock and XMLUnit.
Integrate the Microsoft Unit Testing Framework into your Visual Studio 2010 projects. Learn the fundamentals of the Microsoft.VisualStudio.TestTools.UnitTesting namespace. Explore the tools for running and debugging your unit tests. Discuss general best practices for writing unit tests. Examples will be presented in C#.
A short presentation slide deck I gave to interns we have this summer of 2019 on (unit) testing in software development. This is not a code-centric slide deck and just looking at the slides loses some context without being there in person, or having discussions, etc.
[AnDevCon 2016] Mutation Testing for AndroidHazem Saleh
Unit testing coverage is a great way to show us the amount of tested lines and branches of code, but is this really enough? The answer is "no" since unit testing coverage does not really fully measure the efficiency of the unit tests.
This is why there is a need for having techniques that show unit tests efficiency. Mutation testing is one of these powerful techniques. The main idea of mutation testing is to perform byte code modifications (mutations) to original Android app source code and then run app unit tests to check if they are strong enough to fail as a result of these mutations.
This session discusses mutation testing techniques, and demonstrates PIT as a powerful mutation testing tool for Android apps with demos.
Mockito vs JMockit, battle of the mocking frameworksEndranNL
(Original keynote slides can be found at https://github.com/Endran/PublicSlides)
For years the industry standard of mocking on the JVM has been Mockito. Mockito is a wonderful library that really speeds up your testing by allowing you to create mocks in a very simple way. That being said, it does have its drawbacks, for which different strategies need to be deployed to keep your code testable. The main drawbacks are statics and finals. Final classes cannot be mocked, nor final methods, and also static methods are a no-go. To work with these type of things we need to wrap it, and copy the signature in a non final, non static way.
I have a great adversity against statics, I've devoted an entire post about it, in short; It hides dependencies and brings so little convenience at the costs of its drawbacks. Finals on the other hand have purpose, it helps messaging the goal of a class or method. Java is one of the few languages where classes and methods are open/virtual by default and have to be closed/final by explicit action. In (for example) Kotlin, everything is final by default, if you do not want something to be final, you should use the open keyword.
No matter if you follow the principle of making things final, static or not, if you are using Mockito the decision has been made. This mocking framework demands that everything is non-final, demands that everything is designed to be extended, since it might need to be mocked away. We should be able to improve upon this, and by the name of this post, you should be able to guess which framework will save the day. JMockit will help us with our impediments, and will give some other nifty benefits as well!
Principles and patterns for test driven developmentStephen Fuqua
Developed to help introduce key topics in Test Driven Development, for new and veteran developers alike. Some examples are language-specific (C# / MSTest / Moq), but the principles apply to any object oriented language.
Unit Testing 101 presented at ESRI Developer Summit, March 24th, 2009. This talk reviews the key concepts of unit testing, the technologies used by DTSAgile in out development projects.
Visage is the successor to the JavaFX Script Language, a domain-specific language for writing UIs. It excels at rapid application design and can be used on any platform that supports Java.
In this session you will learn how to supercharge your Android development by using Visage to create declarative UIs. Visage Android exposes the full set of Android APIs, allows you to mix Java and Visage code in the same application, and generates code that deploys to and runs on Android mobile devices.
Integrate the Microsoft Unit Testing Framework into your Visual Studio 2010 projects. Learn the fundamentals of the Microsoft.VisualStudio.TestTools.UnitTesting namespace. Explore the tools for running and debugging your unit tests. Discuss general best practices for writing unit tests. Examples will be presented in C#.
A short presentation slide deck I gave to interns we have this summer of 2019 on (unit) testing in software development. This is not a code-centric slide deck and just looking at the slides loses some context without being there in person, or having discussions, etc.
[AnDevCon 2016] Mutation Testing for AndroidHazem Saleh
Unit testing coverage is a great way to show us the amount of tested lines and branches of code, but is this really enough? The answer is "no" since unit testing coverage does not really fully measure the efficiency of the unit tests.
This is why there is a need for having techniques that show unit tests efficiency. Mutation testing is one of these powerful techniques. The main idea of mutation testing is to perform byte code modifications (mutations) to original Android app source code and then run app unit tests to check if they are strong enough to fail as a result of these mutations.
This session discusses mutation testing techniques, and demonstrates PIT as a powerful mutation testing tool for Android apps with demos.
Mockito vs JMockit, battle of the mocking frameworksEndranNL
(Original keynote slides can be found at https://github.com/Endran/PublicSlides)
For years the industry standard of mocking on the JVM has been Mockito. Mockito is a wonderful library that really speeds up your testing by allowing you to create mocks in a very simple way. That being said, it does have its drawbacks, for which different strategies need to be deployed to keep your code testable. The main drawbacks are statics and finals. Final classes cannot be mocked, nor final methods, and also static methods are a no-go. To work with these type of things we need to wrap it, and copy the signature in a non final, non static way.
I have a great adversity against statics, I've devoted an entire post about it, in short; It hides dependencies and brings so little convenience at the costs of its drawbacks. Finals on the other hand have purpose, it helps messaging the goal of a class or method. Java is one of the few languages where classes and methods are open/virtual by default and have to be closed/final by explicit action. In (for example) Kotlin, everything is final by default, if you do not want something to be final, you should use the open keyword.
No matter if you follow the principle of making things final, static or not, if you are using Mockito the decision has been made. This mocking framework demands that everything is non-final, demands that everything is designed to be extended, since it might need to be mocked away. We should be able to improve upon this, and by the name of this post, you should be able to guess which framework will save the day. JMockit will help us with our impediments, and will give some other nifty benefits as well!
Principles and patterns for test driven developmentStephen Fuqua
Developed to help introduce key topics in Test Driven Development, for new and veteran developers alike. Some examples are language-specific (C# / MSTest / Moq), but the principles apply to any object oriented language.
Unit Testing 101 presented at ESRI Developer Summit, March 24th, 2009. This talk reviews the key concepts of unit testing, the technologies used by DTSAgile in out development projects.
Visage is the successor to the JavaFX Script Language, a domain-specific language for writing UIs. It excels at rapid application design and can be used on any platform that supports Java.
In this session you will learn how to supercharge your Android development by using Visage to create declarative UIs. Visage Android exposes the full set of Android APIs, allows you to mix Java and Visage code in the same application, and generates code that deploys to and runs on Android mobile devices.
DukeScript is a new way of writing JavaScript applications that lets you take advantage of a powerful binding model to connect to Java code running in a local JVM.
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.
[FullStack NYC 2019] Effective Unit Tests for JavaScriptHazem Saleh
Unit testing coverage is a great way to show us the amount of tested lines and branches of code, but is this really enough? The answer is "no" since unit testing coverage does not really fully measure the efficiency of the unit tests. This is why there is a need for using techniques that can improve unit tests efficiency. Mutation testing is one of these powerful techniques. The main idea of mutation testing is to automatically insert bugs (mutants) into production code and then run unit tests to check if they are strong enough to fail as a result of these mutations.
This session discusses mutation testing techniques and demonstrates Stryker as a powerful mutation testing tool for JavaScript applications.
Angular Unit testing
Introduction to Angular Unit testing
Angular Test Cases are automated tests written to check the functionality of an Angular application.
These tests are designed to ensure that the application is working as expected and that all components are functioning correctly.
Angular Test Cases provide a way to quickly and accurately verify that the application is working properly.
They can also be used to quickly identify any bugs or errors that may have been introduced during development.
Why do we use Angular test cases?
Using Angular test cases is important for ensuring the quality of your application's codebase.
Test cases help to detect bugs and errors in the code quickly, so that the development team can address them and fix them before they become bigger problems.
Test cases also help to make sure that new features are implemented correctly and that existing features continue to work as expected.
Finally, using test cases can help to reduce the risk of introducing new bugs into the codebase.
Unit Testing
Testing single unit of code in isolation from the rest of the code which tests behavior of a function or class
Unit testing with Jasmine and Karma for Angular Apps!
Jasmine
Jasmine is an open-source JavaScript testing framework.
JavaScript testing framework provides building blocks to write JavaScript unit test cases so each line of JavaScript statement is properly unit tested.
It is used to test any type of JavaScript application.
Jasmine is a BDD (Behavior Driven Development)
In BDD Test are written in Non-technical language so everyone can understand it easily.
BDD manly focus on the testing the behavior of code rather than implementation.
Writing test cases with Jasmine
Test cases in Jasmine are written using the ‘describe’ and ‘it’ functions. The ‘describe’ function is used to create a suite of tests, while the ‘it’ function is used to define the individual test cases.
To create a test case, first the ‘describe’ function is used to create a suite of tests and assign it a name. Then the ‘it’ function is used to define the individual test cases within the suite.
For each test case, you define the behavior you expect from the JavaScript application. You can also use assertions to test the output of the application.
Flow of Unit Test case
The Angular testing package includes two utilities called TestBed and async.
TestBed is the main Angular utility package.
The describe container contains different blocks (it, beforeEach, xit, etc.).beforeEach runs before any other block.
Karma
Karma is a testing automation tool created by the Angular JS team.
Karma is Open source tool.
Karma is a tool made on top of NodeJS to run JavaScript test cases. This is not a testing framework like Jasmine or Mocha or Chai etc.
It only allows us to run JavaScript test cases written using testing frameworks like Jasmine.
Karma allow us to execute the test cases on any browsers.
Test and Behaviour Driven Development (TDD/BDD)Lars Thorup
In this introduction to Test Driven Development (TDD) or Behaviour Driven Development (BDD) we give a high level description of what it is and why it is useful for developers. Then we go into some details on stubs and mocks, test data, UI testing, SQL testing, JavaScript testing, web services testing and how to start doing TDD/BDD on an existing code base.
Mockito 2.x Migration - Droidcon UK 2018Hazem Saleh
Mockito 2.x solves many problems that most of the Android developers were having in their tests in Mockito 1.x. But what if you are having today large tests written in Mockito 1.x and PowerMock, will it be an easy task to migrate?
Unfortunately, it is not a straightforward task since Mockito 2 is not fully compatible with the old behaviour of Mockito 1.x. Adding to this complexity, If you are having PowerMock in your old tests, then you will have to face another dimension of complexity since most of PowerMock’s versions are having integration issues with Mockito 2.x.
This session goes through the tips and tricks that you need to consider in order to migrate to and utilize Mockito 2.x. It has demos to show migrating Android app Mockito 1.x tests to Mockito 2.x.
Apache Cordova is a platform for building mobile apps using common Web technologies (HTML, CSS and JavaScript). Apache Cordova offers a set of APIs that allow the mobile app developers to utilize mobile native functions such as (Audio, Camera, Contacts …etc) using JavaScript. This session discusses and demonstrates the advanced aspects of Apache Cordova. Advanced aspects include extending Apache Cordova framework by creating custom plugins in order to access more device hardware features. Advanced aspects also include empowering Apache Cordova apps with Push notifications and Cloud services. Finally, this session demonstrates the power of automated JavaScript unit testing for producing quality Apache Cordova apps.
[Devoxx Morocco 2015] Apache Cordova In ActionHazem Saleh
Apache Cordova is a platform for building native mobile apps using common Web technologies (HTML, CSS and JavaScript). Apache Cordova offers a set of APIs that allow the mobile app developers to utilize mobile native functions such as (Audio, Camera, Contacts …etc) using JavaScript. jQuery mobile is one of the best mobile web application frameworks, which allows the web developers to develop neat mobile web applications. This session discusses why there is a need for Hybrid mobile development, the current challenges of mobile development, and how using Apache Cordova can help in overcoming many of these technical challenges. It also highlights the best practices of using Apache Cordova with jQuery mobile. Finally, it demonstrates a real Cordova mobile app for showing the audience the best practices of designing, developing, and deploying hybrid Android and iOS mobile apps.
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache CordovaHazem Saleh
Apache Cordova is a platform for building mobile applications using common Web technologies (HTML, CSS and JavaScript). Apache Cordova offers a set of APIs that allow the mobile application developers to access mobile native functions such as (Audio, Camera, File, Battery, Contacts ...) using JavaScript. Although there are many JavaScript mobile application frameworks, jQuery mobile is one of the best mobile web application frameworks which allows the web developers to develop neat mobile web apps. This session illustrates how to use Apache Cordova with the combination of jQuery mobile in order to design, develop, and deploy a complete hybrid Android (and iOS) app. The demo app utilizes the device native functions (Audio and Camera) using pure JavaScript.
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache CordovaHazem Saleh
Apache Cordova is a platform for building native mobile applications using common Web technologies (HTML, CSS and JavaScript). Apache Cordova offers a set of APIs that allow the mobile application developers to access mobile native functions such as (Audio, Camera, File, Battery, Contacts …etc) using JavaScript. Although there are many JavaScript mobile application frameworks, jQuery mobile is one of the best mobile web application frameworks which allows the web developers to develop web applications that are mobile friendly. This session illustrates how to use Apache Cordova with the combination of jQuery mobile in order to develop a native Android application and deploy on a real Android device. The demo application (“Memo” application) utilizes mobile native functions (Audio and Camera) using pure JavaScript.
Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014Hazem Saleh
Apache Cordova is a platform for building native mobile applications using common Web technologies (HTML, CSS and JavaScript). Apache Cordova offers a set of APIs that allow the mobile application developers to access mobile native functions such as (Audio, Camera, File, Battery, Contacts …etc) using JavaScript. Although there are many JavaScript mobile application frameworks, jQuery mobile is one of the best mobile web application frameworks which allows the web developers to develop web applications that are mobile friendly. This session illustrates how to use Apache Cordova with the combination of jQuery mobile in order to develop a native Android hybrid application and deploy on a real Android device. The demo application (“Memo” application) utilizes mobile native functions (Audio and Camera) using pure JavaScript.
Get the session recording from SoundCloud:
http://tinyurl.com/cordova2014
Integrating Mashups in web applications is not an easy job. Web developers need to write intensive JavaScript code and much duplicate feed parsing code in order to create an interactive Mashup web application.
Mashups4JSF is an open source library that aims at integrating Mashup services in JSF web applications. Using Mashups4JSF, JSF developers will be able to construct rich and customized Mashups using a set of custom JSF components. They will be able to export domain model data as mashup feeds. They will be able to create rich Google Maps declaratively and create custom Ajax actions powered by JSF 2.x architecture. This session discusses how to utilize this library in order to build interactive mashups in the JavaServer Faces applications.
This session was presented by Hazem Saleh in JavaOne Russia 2013.
This presentation goes through the most popular JavaScript tools on the different browsers (Internet Explorer, Firefox, Safari and Chrome). It goes through popular JavaScript debugging tools, JavaScript verification tool (JSLint), and finally JavaScript minification tools.
Executive Directors Chat Leveraging AI for Diversity, Equity, and InclusionTechSoup
Let’s explore the intersection of technology and equity in the final session of our DEI series. Discover how AI tools, like ChatGPT, can be used to support and enhance your nonprofit's DEI initiatives. Participants will gain insights into practical AI applications and get tips for leveraging technology to advance their DEI goals.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
Safalta Digital marketing institute in Noida, provide complete applications that encompass a huge range of virtual advertising and marketing additives, which includes search engine optimization, virtual communication advertising, pay-per-click on marketing, content material advertising, internet analytics, and greater. These university courses are designed for students who possess a comprehensive understanding of virtual marketing strategies and attributes.Safalta Digital Marketing Institute in Noida is a first choice for young individuals or students who are looking to start their careers in the field of digital advertising. The institute gives specialized courses designed and certification.
for beginners, providing thorough training in areas such as SEO, digital communication marketing, and PPC training in Noida. After finishing the program, students receive the certifications recognised by top different universitie, setting a strong foundation for a successful career in digital marketing.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
2. Developers Life without Unit testing.
What is unit testing? and why?
Current Complexities in testing JavaScript code.
Requirements of a good JavaScript unit testing tool.
O
U What is JsTestDriver.
T JsTestDriver Architecture & Configuration
L
I JsTestDriver Eclipse plugin.
N Writing a JavaScript TestCase.
E JsTestDriver common constructs.
Writing asynchronous JavaScript TestCase.
JsTestDriver Compatibility
Generating reports from test cases.
4. Developers Life without Unit testing
Unmanaged number of new/regression defects especially when
the system complexity increases.
5. Developers Life without Unit testing
Low application quality.
Longer testing cycle.
fix test
test fix
fix test
test fix
fix test
test fix
fix test
6. Developers Life without Unit testing.
What is unit testing? and why?
Current Complexities in testing JavaScript code.
Requirements of a good JavaScript unit testing tool.
O
U What is JsTestDriver.
T JsTestDriver Architecture & Configuration
L
I JsTestDriver Eclipse plugin.
N Writing a JavaScript TestCase.
E JsTestDriver common constructs.
Writing asynchronous JavaScript TestCase.
JsTestDriver Compatibility
Generating reports from test cases.
7. What is unit testing and why?
A unit testing is a piece of code (usually a method) that
invokes another piece of code and later checks the correctness of
some assumptions
Unit testing helps in detecting BUGGY components in the early
stages of the project.
A test suite is a set of test cases, and a test case is a set of tests
which verifies the system components.
8. Good Unit Test Characteristics
Automated
Repeatable Fast
Easy to run. Incremental
Easy to understand
9. What is unit testing and why?
Integration is much simplified.
Defects are managed. Regression defects should not happen if the defect is
resolved by creating a new test case.
Test cases can be a good reference for system documentation.
Test cases can improve the system design and be the basis of code refactoring.
Application quality increases.
Testing cycle is reduced.
10. Developers Life without Unit testing.
What is unit testing? and why?
Current Complexities in testing JavaScript code.
Requirements of a good JavaScript unit testing tool.
O
U What is JsTestDriver.
T JsTestDriver Architecture & Configuration
L
I JsTestDriver Eclipse plugin.
N Writing a JavaScript TestCase.
E JsTestDriver common constructs.
Writing asynchronous JavaScript TestCase.
JsTestDriver Compatibility
Generating reports from test cases.
11. Current Complexities in testing JavaScript code
Slow
Requires a lot of time to test on all the browsers.
JavaScript code that runs on a specific browser does not necessarily
mean that it will work on other browsers.
Inflexible
Supporting a new browser means allocating a new budget for
testing the system again on this new browser and for the
new/regression defects fixes.
12. Developers Life without Unit testing.
What is unit testing? and why?
Current Complexities in testing JavaScript code.
Requirements of a good JavaScript unit testing tool.
O
U What is JsTestDriver.
T JsTestDriver Architecture & Configuration
L
I JsTestDriver Eclipse plugin.
N Writing a JavaScript TestCase.
E JsTestDriver common constructs.
Writing asynchronous JavaScript TestCase.
JsTestDriver Compatibility
Generating reports from test cases.
13. Good JavaScript Unit Testing Tool Requirements
JavaScript unit
testing tool
Can execute across all Fast Test case
the browsers over execution.
all the platforms.
Easy setup. Integration with IDEs.
Easy configuration. Integration with build
management tools.
14. Developers Life without Unit testing.
What is unit testing? and why?
Current Complexities in testing JavaScript code.
Requirements of a good JavaScript unit testing tool.
O
U What is JsTestDriver.
T JsTestDriver Architecture & Configuration
L
I JsTestDriver Eclipse plugin.
N Writing a JavaScript TestCase.
E JsTestDriver common constructs.
Writing asynchronous JavaScript TestCase.
JsTestDriver Compatibility
Generating reports from test cases.
15. What is JsTestDriver
One of the best Open source JavaScript testing tools.
Meets all of the previous requirements and more:
Supports all the browsers / all platforms. ✓
Easy setup and configuration. ✓
Fast Test case execution. ✓
Integration with IDEs and build management tools. ✓
16. Developers Life without Unit testing.
What is unit testing? and why?
Current Complexities in testing JavaScript code.
Requirements of a good JavaScript unit testing tool.
O
U What is JsTestDriver.
T JsTestDriver Architecture & Configuration
Configuration.
L
I JsTestDriver Eclipse plugin.
N Writing a JavaScript TestCase.
E JsTestDriver common constructs.
Writing asynchronous JavaScript TestCase.
JsTestDriver Compatibility
Generating reports from test cases.
19. JsTestDriver configuration
1 2 Download the jsTestDriver latest jars from
http://code.google.com/p/js-test-driver/downloads/list
20. JsTestDriver configuration
Create the jsTestDriver.conf file (under the JS folder)
1 2 3 with the following initial content:
server: http://localhost:9876
load:
- js-src/*.js
- js-test/*.js
21. JsTestDriver configuration
Start the server using the following command
1 2 3 4 line
java -jar JsTestDriver-1.3.2.jar
Optional parameters
[--port 9876]
[--browser
“{PATH}firefox.exe","{PATH}iexplore.exe","{P
ATH}Safari.exe"]
22. JsTestDriver configuration
Run the test cases using the following
1 2 3 4 5 command line
java -jar JsTestDriver-1.3.2.jar --tests all
.........
Total 9 tests (Passed: 9; Fails: 0; Errors: 0) (16.00 ms)
Firefox 9.0.1 Windows: Run 3 tests (Passed: 3; Fails: 0; Errors 0)
(3.00 ms)
Safari 534.52.7 Windows: Run 3 tests (Passed: 3; Fails: 0; Errors
0) (4.00 ms)
Microsoft Internet Explorer 7.0 Windows: Run 3 tests (Passed: 3;
Fails: 0; Errors 0) (16.00 ms)
23. Developers Life without Unit testing.
What is unit testing? and why?
Current Complexities in testing JavaScript code.
Requirements of a good JavaScript unit testing tool.
O
U What is JsTestDriver.
T JsTestDriver Architecture & Configuration
L
JsTestDriver Eclipse plugin.
I
N Writing a JavaScript TestCase.
E JsTestDriver common constructs.
Writing asynchronous JavaScript TestCase.
JsTestDriver Compatibility
Generating reports from test cases.
24. JsTestDriver Eclipse plugin
Instead of using command lines for starting the server and running the test
cases, you can directly use the jsTestDriver Eclipse plugin.
To install the JsTestDriver Eclipse plugin install the plugin from the following
URL : http://js-test-driver.googlecode.com/svn/update/
27. Developers Life without Unit testing.
What is unit testing? and why?
Current Complexities in testing JavaScript code.
Requirements of a good JavaScript unit testing tool.
O
U What is JsTestDriver.
T JsTestDriver Architecture & Configuration
L
I JsTestDriver Eclipse plugin.
N Writing a JavaScript TestCase.
E JsTestDriver common constructs.
Writing asynchronous JavaScript TestCase.
JsTestDriver Compatibility
Generating reports from test cases.
28. Writing a JavaScript TestCase
ApplicationUtilTest = TestCase("ApplicationUtilTest");
ApplicationUtilTest.prototype.setUp = function () {
/*:DOC += ...HTML fragment code goes here (single root) ...*/
};
ApplicationUtilTest.prototype.testMethod1 = function () {
… validate using the jsTestDriver constructs …
}
ApplicationUtilTest.prototype.testMethod2 = function () {
… validate using the jsTestDriver constructs …
}
...
29. Developers Life without Unit testing.
What is unit testing? and why?
Current Complexities in testing JavaScript code.
Requirements of a good JavaScript unit testing tool.
O
U What is JsTestDriver.
T JsTestDriver Architecture & Configuration
L
I JsTestDriver Eclipse plugin.
N Writing a JavaScript TestCase.
E JsTestDriver common constructs.
Writing asynchronous JavaScript TestCase.
JsTestDriver Compatibility
Generating reports from test cases.
32. Developers Life without Unit testing.
What is unit testing? and why?
Current Complexities in testing JavaScript code.
Requirements of a good JavaScript unit testing tool.
O
U What is JsTestDriver.
T JsTestDriver Architecture & Configuration
L
I JsTestDriver Eclipse plugin.
N Writing a JavaScript TestCase.
E JsTestDriver common constructs.
Writing asynchronous JavaScript TestCase.
JsTestDriver Compatibility
Generating reports from test cases.
33. Writing asynchronous JavaScript TestCase
AsyncTest = AsyncTestCase("AsynchronousTesting");
AsyncTest.prototype.setUp = function () {
/*:DOC += <!-- Initialization code -->*/
};
AsyncTest.prototype.testOperationOne = function(queue) {
queue.call('Step1', function(callbacks) {
var asyncObject = new AsyncObject ();
var successCallBack = callbacks.add(function(successData) {
// validate (successData) if possible ....
});
var failureCallBack = callbacks.addErrback('Error Message');
// call asynchronous API
asyncObject.operationOne(inputData,
successCallBack,
failureCallBack);
});
};
34. Writing asynchronous JavaScript TestCase
Every inline function provides a callbacks parameter for
testing the Ajax APIs. There are two types of
callbacks:
• Success callback: Represents the success path. It
MUST be called in order to pass the test.
• Error callback: Represents the error path. If it is
called, then the test fails.
The test runner does not move to the next queue until
the current queue executes all of its success callbacks. If
a specific success callback is not called for a specific
amount of time (30 seconds), the test fails.
36. Developers Life without Unit testing.
What is unit testing? and why?
Current Complexities in testing JavaScript code.
Requirements of a good JavaScript unit testing tool.
O
U What is JsTestDriver.
T JsTestDriver Architecture & Configuration
L
I JsTestDriver Eclipse plugin.
N Writing a JavaScript TestCase.
E JsTestDriver common constructs.
Writing asynchronous JavaScript TestCase.
JsTestDriver Compatibility
Generating reports from test cases.
37. JsTestDriver Compatibility
JsTestDriver is not only a JavaScript unit testing
framework BUT it is a test runner for many other
JavaScript unit testing frameworks.
JsTestDriver is compatibility with the following
JavaScript unit testing frameworks through adapters:
• Jasmine
• YUI Test
• QUnit
38. JsTestDriver Compatibility
In order to run the previous unit testing frameworks
on the top of the JSTD test runner. You need to
configure the framework adapter and source before
the test files as follows:
server: http://localhost:9876
load:
- jasmine/lib/jasmine-1.1.0/jasmine.js
- jasmine/lib/adapter/JasmineAdapter.js
- js-src/Basics.js
- js-test/BasicsSpec.js
40. Developers Life without Unit testing.
What is unit testing? and why?
Current Complexities in testing JavaScript code.
Requirements of a good JavaScript unit testing tool.
O
U What is JsTestDriver.
T JsTestDriver Architecture & Configuration
L
I JsTestDriver Eclipse plugin.
N Writing a JavaScript TestCase.
E JsTestDriver common constructs.
Writing asynchronous JavaScript TestCase.
JsTestDriver Compatibility
Generating reports from test cases.
41. Generating reports from test cases
JSTD can generate code coverage files.
Code coverage describes how much the source code is tested.
Coverage Criteria:
Function coverage
statement coverage
Branch
coverage
42. JsTestDriver
can generate code coverage
for your JavaScript code using the
code coverage plugin.
43. Generating reports from test cases
Configuring the plugin:
Download the Add the coverage plugin declaration Specify the --
“coverage.jar”. to the configuration file: testOutput
plugin: <<output_folder>>
flag in the test
- name: "coverage" running command.
jar: "plugins/coverage.jar"
module:
"com.google.jstestdriver.coverage.C
overageModule"
44. Generating reports from test cases
Unfortunately JsTestDriver does not generate HTML reports directly,
JsTestDriver generates the test coverage files in LCOV
and XML formats.
You can generate the HTML test reports using the
LCOV visualizer tool:
http://ltp.sourceforge.net/coverage/lcov.php
45. Generating reports from test cases
The JsTestDriver LCOV file name is usually:
<config filename>-coverage.dat (jsTestDriver.conf-
coverage.dat)
To generate the report from the LCOV file using the
LCOV visualizer tool:
genhtml jsTestDriver.conf-coverage.dat
47. Conclusion
Testing JavaScript code is important for increasing the
application quality and for speeding up fixing defects and
minimizing the number of regression defects.
Good JavaScript tool should be configurable, easy to use,
and working with all the browsers.
JsTestDriver is one of the most powerful JavaScript unit
testing tools that can be used for testing both synchronous
and asynchronous JavaScript code on all the browsers.
48. Question of the session (Free book copy)
<script>
(function() {
var x = 10,
y = 20,
z = x+++y;
alert(x); //?
alert(y); //?
alert(z); //?
})();
</script> http://www.amazon.com/dp/1782160620/
JavaScript Unit Testing Book