«Objective-C Runtime в примерах» — Алексей Сторожев, e-Legione-Legion
Цель доклада — вдохновить разработчиков на более глубокое изучение возможностей Objective-C Runtime, показать способы исследования системы, воодушевить аудиторию на эксперименты.
В докладе показаны несколько примеров использования Objective-C Runtime для решения нетипичных задач. Первый пример - реализация простого KVO своими руками тремя способами. Вторым примером показана полезность исследования приватных классов. Рассказано, как во время работы программы получить информацию о протянутых IBOutlet и IBAction в xib и storyboard. В каждом примере присутствуют особенности реализации, на которых сделан акцент и показаны варианты решения или обхода.
Evidence is a new, framework-agnostic unit testing library which I developed out of necessity and frustration with the existing offering. Although it's heavily inspired by it's Ruby, Python and Java couterparts, Evidence is packed with niceness targeted at the specificities of the JavaScript language and its different environments. Hopefully this introduction to Evidence will give you the motivation, tools and knowledge to start unit testing your JavaScript code if you are not doing so already.
«Objective-C Runtime в примерах» — Алексей Сторожев, e-Legione-Legion
Цель доклада — вдохновить разработчиков на более глубокое изучение возможностей Objective-C Runtime, показать способы исследования системы, воодушевить аудиторию на эксперименты.
В докладе показаны несколько примеров использования Objective-C Runtime для решения нетипичных задач. Первый пример - реализация простого KVO своими руками тремя способами. Вторым примером показана полезность исследования приватных классов. Рассказано, как во время работы программы получить информацию о протянутых IBOutlet и IBAction в xib и storyboard. В каждом примере присутствуют особенности реализации, на которых сделан акцент и показаны варианты решения или обхода.
Evidence is a new, framework-agnostic unit testing library which I developed out of necessity and frustration with the existing offering. Although it's heavily inspired by it's Ruby, Python and Java couterparts, Evidence is packed with niceness targeted at the specificities of the JavaScript language and its different environments. Hopefully this introduction to Evidence will give you the motivation, tools and knowledge to start unit testing your JavaScript code if you are not doing so already.
JavaFX 8 est disponible depuis mars 2014 et apporte son lot de nouveautés. Gradle est en version 2 depuis juillet 2014. Deux technologies plus que prometteuses: JavaFX donne un coup de jeune au développement d’applications desktop en Java en apportant un navigateur web intégré, le support des WebSockets, de la 3D, et bien d’autres. Gradle est l’outil de d’automatisation de build à la mode, apportant de superbes possibilités par rapport rapport à maven, outil vieillissant, grâce à l’engouement de la communauté vis à vis de cet outil mais aussi par le fait de la technologie utilisée en son sein: groovy. Venez découvrir comment il est possible de réaliser rapidement une application à la mode en JavaFX avec un outil à la mode également. Bref venez à une session trendy.
Mobile Fest 2018. Александр Корин. БолеутоляющееMobileFest2018
Наш код - это наша боль. Как бы крут он не был, как бы хорошо не был написан, возвращаясь к нему через год мы ощущаем стыд за то, что мы натворили. За несколько лет сей стыд перерастает в боль за бессмыссленно потраченное время жизни. Мы обсудим болеутоляющие, данные нам возможностями Swift и моим больным воображением
Towards Reusable Components With Aspects [ICSE 2008]Kevin Hoffman
Does obliviousness increase overall modularity? This presents the results of an empirical study that focuses on the tradeoffs between obliviousness and modularity. The results may surprise you!
Class 12 ip project on wwe management system
sql databases available
netbeans file available
made in year 2018-19
unique topic
easy java coding used
made in netbeans version 8.1
ready to print
В своей презентации “С++ 11 usage experience: Move semantic”, Дмитрий Гурин, bp GlobalLogic, рассказывает о части нововведений нового стандарта C++, особенностях работы с объектами rvalue и lvalue, а также особенностями использования функций std::move и std::forward. В конце доклада — полезные советы по оптимизации кода с применением возможностей нового стандарта С++.
Напомним, Embedded Kyiv TechTalk состоялся 14 декабря 2013 года.
29Oct14 - Productive Ageing - Dr Ros Altmann ILC- UK
This Robert Butler Memorial Lecture, held on Wednesday 29th October 2014, was part of the ILC Global Alliance visit to the UK.
Robert Butler, founder of ILC US, was a passionate believer in the importance of health and productive ageing and we were honoured that Dr Ros Altmann, government’s Business Champion for Older Workers agreed to give the Lecture.
JavaFX 8 est disponible depuis mars 2014 et apporte son lot de nouveautés. Gradle est en version 2 depuis juillet 2014. Deux technologies plus que prometteuses: JavaFX donne un coup de jeune au développement d’applications desktop en Java en apportant un navigateur web intégré, le support des WebSockets, de la 3D, et bien d’autres. Gradle est l’outil de d’automatisation de build à la mode, apportant de superbes possibilités par rapport rapport à maven, outil vieillissant, grâce à l’engouement de la communauté vis à vis de cet outil mais aussi par le fait de la technologie utilisée en son sein: groovy. Venez découvrir comment il est possible de réaliser rapidement une application à la mode en JavaFX avec un outil à la mode également. Bref venez à une session trendy.
Mobile Fest 2018. Александр Корин. БолеутоляющееMobileFest2018
Наш код - это наша боль. Как бы крут он не был, как бы хорошо не был написан, возвращаясь к нему через год мы ощущаем стыд за то, что мы натворили. За несколько лет сей стыд перерастает в боль за бессмыссленно потраченное время жизни. Мы обсудим болеутоляющие, данные нам возможностями Swift и моим больным воображением
Towards Reusable Components With Aspects [ICSE 2008]Kevin Hoffman
Does obliviousness increase overall modularity? This presents the results of an empirical study that focuses on the tradeoffs between obliviousness and modularity. The results may surprise you!
Class 12 ip project on wwe management system
sql databases available
netbeans file available
made in year 2018-19
unique topic
easy java coding used
made in netbeans version 8.1
ready to print
В своей презентации “С++ 11 usage experience: Move semantic”, Дмитрий Гурин, bp GlobalLogic, рассказывает о части нововведений нового стандарта C++, особенностях работы с объектами rvalue и lvalue, а также особенностями использования функций std::move и std::forward. В конце доклада — полезные советы по оптимизации кода с применением возможностей нового стандарта С++.
Напомним, Embedded Kyiv TechTalk состоялся 14 декабря 2013 года.
29Oct14 - Productive Ageing - Dr Ros Altmann ILC- UK
This Robert Butler Memorial Lecture, held on Wednesday 29th October 2014, was part of the ILC Global Alliance visit to the UK.
Robert Butler, founder of ILC US, was a passionate believer in the importance of health and productive ageing and we were honoured that Dr Ros Altmann, government’s Business Champion for Older Workers agreed to give the Lecture.
Are we ready to make the UK the best country to grow old in?
One year ago, the House of Lords Committee on Public Services and Demographic Change produced a hard-hitting report which argued that the Government and society was “woefully underprepared” for a rapidly ageing population.
On the first anniversary of the ‘Ready for Ageing?’ report, we are in the unenviable position that sees the United Kingdom ranked unlucky number 13 in a global index of the best countries in the world to grow old in. The principal recommendations in the ‘Ready for Ageing?’ report have not yet been properly addressed or acted on.
In his October 2013 speech on ‘The Forgotten Million’, Secretary of State for Health, Jeremy Hunt MP, set down a challenge that the UK should in fact aspire to be best country to grow old in, but the question remains: why are our public services so poorly prepared for major demographic change, and what as a society can we do to ensure future generations of older people thrive in later life?
Lord Filkin, Chair of the Committee on Public Services and Demographic Change, hosted a House of Lords breakfast debate looking forward to 2030, a date by which there will be 50% more people aged 65 and over in England and a doubling in the numbers of people aged 85 and over. As a society, we need to prepare for the next 15 years right now and certainly in the next Parliament.
At this event, Independent Age and ILC-UK, supported by members of the Ready for Ageing Alliance, launched 2030 Vision: Making the UK the best country to grow old in, which will look to the long term and consider what politicians and policy makers need to now, both in preparation for next year’s General Election, and between 2015 and 2020, to prepare for the long term opportunities and challenges ahead.
During the debate, we invited contributions on the economic and societal implications of population ageing and the major policy decisions all the main parties face to ready the UK and its public services for dramatic population ageing.
It’s clear that our political, social and cultural approach towards old age today is already hopelessly out of date, so this event will provide Parliamentarians and stakeholders from across civil society with an opportunity to mark the first anniversary of the House of Lords’ Committee report on demographic change and look ahead, so as a society we can seize the opportunities presented by an ageing population.
Just a sample of one of our customizable newsletter programs that we license on an area exclusive basis to printers. You brand, print and distribute. Our content will set you apart from your competition.
Abstract for International Conference on Small BusinessJane Leonard
Does Twitter likely to spark effectual thinking in entrepreneurs. Are online interactions really capable of helping entrepreneurs use effectual thinking. What is the role of networks and week or strong ties
Many older people have equity tied up in their homes that could be used to provide them with a greater income in later life and improve their standard of living. Traditionally, the ways to unlock the equity in people’s homes have been through downsizing, equity release lifetime loans or home reversion plans. However, not everyone is in a position to downsize, there are pros and cons to each approach, and all have associated costs.
The Equity Bank would provide a new way for people to unlock the equity in their home. It would be a state agency which provides people with a low cost fixed lifetime income in exchange for a fixed share of the equity in their home. The Equity Bank would take a charge on the person’s home and recover the value of the equity from the person’s estate after their death.
The event was chaired by Baroness Sally Greengross, Chief Executive of the ILC-UK. Nick Kirwan, Director of the ILC-UK Care Funding Advice Network, opened the discussion. Professor Les Mayhew of Cass Business School and co-author of the paper 'The UK Equity Bank - Towards income security in old age' then presented the concept, after which Paul Burstow MP responded. There was then time for questions and a general discussion.
Testing, Performance Analysis, and jQuery 1.4jeresig
This is the talk that I gave at JSConf.eu 2009, then modified slightly and given again at the December Bayjax meetup (the parts on jQuery and HTML 5 in IE were added).
A presentation on JUnit Pioneer given at Fortitude Technologies on Mar. 4, 2021. JUnit Pioneer is an extension library for JUnit 5 (Jupiter).
Sample code on GitHub at:
https://github.com/sleberknight/junit-pioneering-presentation-code
JUnit Pioneer home page:
https://junit-pioneer.org
Slides from my Confitura 2012 presentation. The issues discussed during the talk will be described in my new (free!) ebook - see https://github.com/tomekkaczanowski/bad-tests-good-tests
If you don’t test it, how do you know it works? Over the past few years, we have been compelled to write unit and integration tests for our applications--code that validates code--and it is these tests that change a one-off tool into a well-architected, robust, business-ready application. Yet, every new framework requires a new testing framework, so in this session, we will discuss testing frameworks for node.js. You will walk away with a solid understanding of how to write tests against your node.js applications and modules, leading to confidence that your work is business-ready.
A lot of people using PHPunit for testing their source code. While I was observing my team
I recognized most of them are only using the standard assertions like 'assertEquals()' or 'assertTrue()' and are complaining about how hard it is to test the code even when the tests are written first. This talk is about all the stuff not used on a daily basis. It shows you some nice features of PHPUnit and how to use them for your benefit.
Production.javapublic class Production { Declaring instance.pdfsooryasalini
Production.java
public class Production {
//Declaring instance variables
private String title;
private String director;
private String writer;
//Parameterized constructor
public Production(String title, String director, String writer) {
super();
this.title = title;
this.director = director;
this.writer = writer;
}
//Setters and getters.
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDirector() {
return director;
}
public void setDirector(String director) {
this.director = director;
}
public String getWriter() {
return writer;
}
public void setWriter(String writer) {
this.writer = writer;
}
//display() method which displays the Instance variable values
public void display()
{
System.out.println(\"Title: \" + this.title);
System.out.println(\"Director: \" + this.director);
System.out.println(\"Writer: \" + this.writer);
}
//toString() method is used to display the contents of an object
@Override
public String toString() {
return \"Title :\" + title + \"\ Director :\" + director
+ \"\ Writer :\" + writer;
}
}
___________________________________________
Film.java
public class Film extends Production{
//Declaring instance variables
private int boxOfficeGross;
//Parameterized constructor
public Film(String title, String director, String writer, int boxOfficeGross) {
super(title, director, writer);
this.boxOfficeGross = boxOfficeGross;
}
//Setters and getters.
public int getBoxOfficeGross() {
return boxOfficeGross;
}
public void setBoxOfficeGross(int boxOfficeGross) {
this.boxOfficeGross = boxOfficeGross;
}
//display() method which displays the Instance variable values
public void display()
{
System.out.println(\"BoxOfiiceGross: \" + this.boxOfficeGross);
}
//toString() method is used to display the contents of an object
@Override
public String toString() {
return super.toString()+\"\ BoxOfficeGross :\" + boxOfficeGross+\"\ \";
}
}
_______________________________________________
Play.java
public class Play extends Production {
//Declaring instance variables
private int performances;
//Parameterized constructor
public Play(String title, String director, String writer, int performances) {
super(title, director, writer);
this.performances = performances;
}
//Setters and getters.
public int getPerformances() {
return performances;
}
public void setPerformances(int performances) {
this.performances = performances;
}
//display() method which displays the Instance variable values
public void display()
{
System.out.println(\"Performances: \" + this.performances);
}
//toString() method is used to display the contents of an object
@Override
public String toString() {
return super.toString()+\"\ Performances :\" + performances+\"\ \";
}
}
_______________________________________________
Musical.java
public class BobsTerribleTests
{
public static void main(String[] args)
{
//Creating an Film Object by passing parameters
Film titanic = new Film(\"Titanic\", \"James Cameron\", \"James Cameron\.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
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
5. YUI Test features:
Rapid creation of test cases through simple syntax.
Advanced failure detection for methods that throw errors.
Grouping of related test cases using test suites.
Mock objects for writing tests without external dependencies.
Asynchronous tests for testing events and Ajax communication.
DOM Event simulation in all A-grade browsers (through Event).
6. 引入测试框架
YUITest Standalone Library
<script src="http://192.168.194.159/test/yuitest/yuitest.js"></script>
YUI Test for YUI 3.x
<script src="http://192.168.194.159/test/yui/build/yui/yui.js"></script>
// Create a new YUI instance and populate it with the required modules.
YUI().use('test', function (Y) {
// Test is available and ready for use. Add implementation
// code here.
});
7. Using Test Cases
YUITest Standalone Library
var testCase = new YUITest.TestCase({
name: "TestCase Name",
//traditional test names
testSomething : function () {
//...
},
testSomethingElse : function () {
//...
}
});
var testCase = new YUITest.TestCase({
name: "TestCase Name",
//friendly test names
"Something should happen here" : function () {
//...
},
"Something else should happen here" : function () {
//...
}
});
8. Using Test Cases
YUI Test for YUI 3.x
var testCase = new Y.Test.Case({
name: "TestCase Name",
//traditional test names
testSomething : function () {
//...
},
testSomethingElse : function () {
//...
}
});
var testCase = new Y.Test.Case({
name: "TestCase Name",
//friendly test names
"Something should happen here" : function () {
//...
},
"Something else should happen here" : function () {
//...
}
});
9. setUp() and tearDown()
var testCase = new YUITest.TestCase({
name: "TestCase Name",
//---------------------------------------------
// Setup and tear down
//---------------------------------------------
setUp : function () {
this.data = { name : "Nicholas", age : 28 };
},
tearDown : function () {
delete this.data;
},
//---------------------------------------------
// Tests
//---------------------------------------------
testName: function () {
YUITest.Assert.areEqual("Nicholas", this.data.name, "Name should be 'Nicholas'");
},
testAge: function () {
YUITest.Assert.areEqual(28, this.data.age, "Age should be 28");
}
});
10. init() and destroy()
var testCase = new YUITest.TestCase({
name: "TestCase Name",
//---------------------------------------------
// init and destroy
//---------------------------------------------
init : function () {
this.data = { name : "Nicholas", age : 28 };
},
destroy : function () {
delete this.data;
},
//---------------------------------------------
// Tests
//---------------------------------------------
testName: function () {
YUITest.Assert.areEqual("Nicholas", this.data.name, "Name should be 'Nicholas'");
},
testAge: function () {
YUITest.Assert.areEqual(28, this.data.age, "Age should be 28");
}
});
11. Ignoring Tests
var testCase = new YUITest.TestCase({
name: "TestCase Name",
//---------------------------------------------
// Special instructions
//---------------------------------------------
_should: {
ignore: {
testName: true //ignore this test
}
},
//---------------------------------------------
// Tests
//---------------------------------------------
testName: function () {
YUITest.Assert.areEqual("Nicholas", this.data.name, "Name should be 'Nicholas'");
},
testAge: function () {
YUITest.Assert.areEqual(28, this.data.age, "Age should be 28");
}
});
12. Intentional Errors
testGenericError : function() {
YUITest.Assert.throwsError(Error, function() {
throw new Error("Generic error");
});
},
testStringError : function() {
YUITest.Assert.throwsError("I'm a specific error message.", function() {
throw new Error("I'm a specific error message.");
});
},
testObjectError : function() {
YUITest.Assert.throwsError(new TypeError("Number expected."), function() {
throw new TypeError("Number expected.");
});
},
13. Assertions
Equality Assertions Sameness Assertions Forced Failures
areEqual() areNotSame() fail()
areNotEqual() areSame()
Special Value Assertions Data Type Assertions
isFalse() isArray()
isTrue() isBoolean()
isNaN() isFunction()
isNotNaN() isNumber()
isNull() isObject()
isNotNull() isString()
isUndefined() isTypeOf()
isNotUndefined()
17. Mock Objects
//code being tested
function logToServer(message, xhr){
xhr.open("get", "/log.php?msg=" + encodeURIComponent(message), true);
xhr.send(null);
}
//test case for testing the above function
var testCase = new YUITest.TestCase({
name: "logToServer Tests",
testPassingDataToXhr : function () {
var mockXhr = YUITest.Mock();
//I expect the open() method to be called with the given arguments
YUITest.Mock.expect(mockXhr, {
method: "open",
args: ["get", "/log.php?msg=hi", true]
});
//I expect the send() method to be called with the given arguments
YUITest.Mock.expect(mockXhr, {
method: "send",
args: [null]
});
//now call the function
logToServer("hi", mockXhr);
//verify the expectations were met
YUITest.Mock.verify(mockXhr);
}
});
18. Special Argument Values
YUITest.Mock.Value.Any - any value is valid regardless of type.
YUITest.Mock.Value.String - any string value is valid.
YUITest.Mock.Value.Number - any number value is valid.
YUITest.Mock.Value.Boolean - any Boolean value is valid.
YUITest.Mock.Value.Object - any non-null object value is valid.
YUITest.Mock.Value.Function - any function value is valid.
YUITest.Mock.expect(mockXhr, {
method: "open",
args: [YUITest.Mock.Value.String, "/log.php?msg=hi“, YUITest.Mock.Value.Boolean]
});
19. Property Expectations
var testCase = new YUITest.TestCase({
name : "TestCase Name",
testMock : function() {
var mockMyObject = YUITest.Mock();
YUITest.Mock.expect(mockMyObject,{
method: "add",
args: [1,2],
returns: 3,
property: "status",
value: 404
});
var result = mockMyObject.add(1,2);
mockMyObject.status = 100;
Assert.areEqual(3,result,"1 + 2 = 3");
YUITest.Mock.verify(mockMyObject);
}
});
20. Asynchronous Tests
var testCase = new YUITest.TestCase({
name: "TestCase Name",
setUp : function () {
this.data = { name : "Nicholas", age : 29 };
},
tearDown : function () {
delete this.data;
},
testAsync: function () {
YUITest.Assert.areEqual("Nicholas", this.data.name, "Name should be 'Nicholas'");
//wait 1000 milliseconds and then run this function
this.wait(function(){
YUITest.Assert.areEqual(29, this.data.age, "Age should be 29");
}, 1000);
}
});
21. Asynchronous Tests
var testCase = new YUITest.TestCase({
name: "TestCase Name",
testAnimation : function (){
//animate width to 400px
var myAnim = new Y.Anim({
node: '#testDiv',
to: {width: 400},
duration: 3});
var test = this;
//assign oncomplete handler
myAnim.on("end", function(){
//tell the TestRunner to resume
test.resume(function(){
YUITest.Assert.areEqual(myAnim.get("node").get("offsetWidth"), 400, "Width of the
DIV should be 400.");
});
});
//start the animation
myAnim.run();
//wait until something happens
this.wait(3000);
}
});
22. Test Suites
//create the test suite
var suite = new YUITest.TestSuite("TestSuite Name");
//add test cases
suite.add(new YUITest.TestCase({
//...
}));
suite.add(new YUITest.TestCase({
//...
}));
//add the second suite to the first
suite.add(anotherSuite);
//create a test suite
var suite = new YUITest.TestSuite({
name : "TestSuite Name",
setUp : function () {
//test-suite-level setup
},
tearDown: function () {
//test-suite-level teardown
}
});
23. Context Data
var testSuite = new YUITest.TestSuite({
name: "Test Suite Name",
setUp: function(data){
data.topLevel = 1;}
});
testSuite.add(new YUITest.TestCase({
name: "First Test Case",
init: function(data){
data.foo = "bar";},
testValueOfFoo : function (data) {
YUITest.Assert.areEqual("bar", data.foo); //from init
},
testValueOfTopLevel: function(data){
YUITest.Assert.areEqual(1, data.topLevel); //from test suite
}
});
testSuite.add(new YUITest.TestCase({
name: "Second Test Case",
testValueOfFoo : function (data) {
YUITest.Assert.areEqual("bar", data.foo); //from init in First Test Case
},
testValueOfTopLevel: function(data){
YUITest.Assert.areEqual(1, data.topLevel); //from test suite
}
});
24. Running Tests
//add the test cases and suites
YUITest.TestRunner.add(testCase);
YUITest.TestRunner.add(testSuite);
//run all tests
YUITest.TestRunner.run();
YUITest.TestRunner.clear();
25. TestRunner Events
Test-Level Events
YUITest.TestRunner.TEST_PASS_EVENT - occurs when the test passes.
YUITest.TestRunner.TEST_FAIL_EVENT - occurs when the test fails.
YUITest.TestRunner.TEST_IGNORE_EVENT - occurs when a test is ignored.
For each of these events, the event data object has three properties:
type - indicates the type of event that occurred.
testCase - the test case that is currently being run.
testName - the name of the test that was just executed or ignored.
26. TestRunner Events
TestCase-Level Events
YUITest.TestRunner.TEST_CASE_BEGIN_EVENT
occurs when the test case is next to be executed but before the first test
is run.
YUITest.TestRunner.TEST_CASE_COMPLETE_EVENT
occurs when all tests in the test case have been executed or ignored.
For these two events, the event data object has three properties:
type - indicates the type of event that occurred.
testCase - the test case that is currently being run.
27. TestRunner Events
TestSuite-Level Events
YUITest.TestRunner.TEST_SUITE_BEGIN_EVENT
occurs when the test suite is next to be executed but before the first
test is run.
YUITest.TestRunner.TEST_SUITE_COMPLETE_EVENT
occurs when all tests in all test cases in the test suite have been
executed or ignored.
For these two events, the event data object has three properties:
type - indicates the type of event that occurred.
testSuite - the test suite that is currently being run.
28. TestRunner Events
TestRunner-Level Events
YUITest.TestRunner.BEGIN_EVENT
occurs when testing is about to begin but before any tests are run.
YUITest.TestRunner.COMPLETE_EVENT
occurs when all tests in all test cases and test suites have been executed or ignored.
Subscribing to Events
function handleTestFail(data){
alert("Test named '" + data.testName + "' failed with message: '" +
data.error.message + "'.");
}
var TestRunner = YUITest.TestRunner;
TestRunner.subscribe(TestRunner.TEST_FAIL_EVENT, handleTestFail);
TestRunner.run();
29. Viewing Results
YUI({ logInclude: { TestRunner: true } }).use("console", function(Y){
//tests go here
//initialize the console
var yconsole = new Y.Console({
newestOnTop: false
});
yconsole.render('#log');
//run the tests
YUITest.TestRunner.run();
});
31. Viewing Results
YUI({ useBrowserConsole: true }).use("test", function(Y){
//tests go here
//get object of results
var resultsObject = YUITest.TestRunner.getResult();
//get XML results
var resultsXML = YUITest.TestRunner.getResult(YUITest.TestFormat.XML);
});
YUITest.TestFormat.XML - YUI Test XML (default)
YUITest.TestFormat.JSON - JSON
YUITest.TestFormat.JUnitXML - JUnit XML
YUITest.TestFormat.TAP - TAP
33. Test Reporting
var reporter = new
YUITest.Reporter("http://www.yourserver.com/path/to/target",
YUITest.TestFormat.JSON);
reporter.report(results);
results - the serialized results object.
useragent - the user-agent string of the browser.
timestamp - the date and time that the report was sent.
reporter.addField("color", "blue");
reporter.addField("message", "Hello world!");
34. Yeti: YUI’s Easy Testing Interface
Yeti is a command-line tool for launching JavaScript unit tests in a
browser and reporting the results without leaving your terminal. Yeti is
designed to work with existing unmodified YUI-based tests.
Yeti is designed to help you run tests before you commit. It
compliments existing CI tools like Selenium and Hudson which run tests
post-commit. Yeti is not a replacement for those tools.