Given that the database, as the canonical repository of data, is the most important part of many applications, why is it that we don't write database unit tests? This talk promotes the practice of implementing tests to directly test the schema, storage, and functionality of databases.
Unit testing patterns for concurrent codeDror Helper
Getting started with unit testing is not hard, the only problem is that most programs are more than a simple calculator with two parameters and a returns value that is easy to verify.
Writing unit tests for multi-threaded code is harder still.
Over the years I discovered useful patterns that helped me to test multi-threaded and asynchronous code and enabled the creation of deterministic, simple and robust unit tests.
Come learn how to test code that uses concurrency and parallelism – so that the excuses of not writing unit tests for such code would become as obsolete as a single core processors.
Given that the database, as the canonical repository of data, is the most important part of many applications, why is it that we don't write database unit tests? This talk promotes the practice of implementing tests to directly test the schema, storage, and functionality of databases.
Unit testing patterns for concurrent codeDror Helper
Getting started with unit testing is not hard, the only problem is that most programs are more than a simple calculator with two parameters and a returns value that is easy to verify.
Writing unit tests for multi-threaded code is harder still.
Over the years I discovered useful patterns that helped me to test multi-threaded and asynchronous code and enabled the creation of deterministic, simple and robust unit tests.
Come learn how to test code that uses concurrency and parallelism – so that the excuses of not writing unit tests for such code would become as obsolete as a single core processors.
BDD Testing and Automating from the trenches - Presented at Into The Box June...Gavin Pickin
In this session, we'll learn what TDD and BDD testing is in CFML and ColdFusion, using Testbox. We'll look at some of the myths surrounding testing, and how to get started with testing, and how it can make you more efficient, improve code quality, code confidence, and how automation can make your life as a developer more pleasant than what you face currently, living in the trenches
(automatic) Testing: from business to university and backDavid Rodenas
This talk cares about the fundamentals of testing, a little bit history of how the professional community developed what we currently know as testing, but also about why I should care about testing? why is it important to do a test? What is important to test? What is not important to test? How to do testing?
There some examples in plnker just to see each step, and many surprises.
This talk also compares what people learned in the Computer Sciences and Engineering degrees and what people does in testing. It gives some tips to catch up with current state of art and gives some points to start changing syllabus to make better engineers.
This talk is good for beginners, teachers, bosses, but also for seasoned techies that just want to light up some of the ideas that they might have been hatching.
Spoiler alert: testing will save you development time and make you a good professional.
A talk about unit testing for iOS apps. Part rambling introduction to test driven development, part examples of certain types of tests for iOS, and a brief mention of writing your tests using Kiwi.
The Spock unit testing framework is on the verge of a 1.0 release and has already proven itself to be the next generation thinking on how to test Java production code. One of the many ever present challenges to testing code is the ability to Mock classes which has simplified by Spock from a very early release. Recently added to Spock is the notion of Stubs and Spies. This sessions is designed to demonstrate proper unit testing technique showing off these new features along with a number of advanced Spock features.
Developer Tests - Things to Know (Vilnius JUG)vilniusjug
There are many great talks that discuss challenges developers face when writing software tests. In this talk let's look at test design problems that may seem to be simple but yet fundamentally important and often misunderstood even by experienced programmers.
Productos Químicos de Alta Calidad
Actividad a la que se dedica la empresa
Nuestra empresa se dedica a la producción y distribución de productos de limpieza a través de concentrados químico obtenidos como materia prima para obtener el producto final.
Misión
Producir y distribuir productos químicos comoblanqueadores, ceras emulsionadas, ambientadores, jabones líquidos, antibacterianos, desinfectantes, limpia vidrios y de belleza. Utilizando tecnología de vanguardia para satisfacer a los clientes con nuestros productos. Enfocándonos en la importancia que tiene nuestra comercialización de productos
Visión
Ser una empresa líder a nivel nacional en la producción y distribución productos químicos como blanqueadores, ceras emulsionadas, ambientadores, jabones líquidos, antibacterianos, desinfectantes, limpia vidrios y de belleza. Buscando satisfacer a los clientes con una gama de productos de óptima calidad. Comprometiéndonos con nuestro trabajo y el crecimiento personal dando un enfoque a la importancia que tiene nuestro personal
This presentation accompanied the live webinar "Moving the Needle with Social Media" presented on June 23, 2010 by Jason Falls of the Social Media Explorer and Ryan Deutsch of StrongMail.
The following is the description from the webinar, which is now archived here: http://www.strongmail.com/resources/webevents/webinars.php
Engagement is only the first step in social media marketing. You eventually need to move from conversations to conversions – because engagement alone doesn't ring the cash register. Unless you are able to drive measurable, bottom-line benefits from social media, your organization's social media efforts are ultimately doomed to fail.
In this on-demand webinar, social media marketing pioneer Jason Falls will show you how to drive your customers to act, convert and purchase without violating their trust. Learn proven strategies for leveraging popular social networks like Twitter and Facebook to increase sales, newsletter subscriptions and other key business objectives. Plus, get insight from detailed case studies and an extensive Q&A session.
Key things you will learn:
• How to set clear goals and measurable objectives for social media
• Effective strategies based on your consumer's social needs
• Tactics for motivating customers to act, convert and purchase
• Case studies showcasing how to drive revenue and customer satisfaction
• Tools for managing and measuring social media campaigns
BDD Testing and Automating from the trenches - Presented at Into The Box June...Gavin Pickin
In this session, we'll learn what TDD and BDD testing is in CFML and ColdFusion, using Testbox. We'll look at some of the myths surrounding testing, and how to get started with testing, and how it can make you more efficient, improve code quality, code confidence, and how automation can make your life as a developer more pleasant than what you face currently, living in the trenches
(automatic) Testing: from business to university and backDavid Rodenas
This talk cares about the fundamentals of testing, a little bit history of how the professional community developed what we currently know as testing, but also about why I should care about testing? why is it important to do a test? What is important to test? What is not important to test? How to do testing?
There some examples in plnker just to see each step, and many surprises.
This talk also compares what people learned in the Computer Sciences and Engineering degrees and what people does in testing. It gives some tips to catch up with current state of art and gives some points to start changing syllabus to make better engineers.
This talk is good for beginners, teachers, bosses, but also for seasoned techies that just want to light up some of the ideas that they might have been hatching.
Spoiler alert: testing will save you development time and make you a good professional.
A talk about unit testing for iOS apps. Part rambling introduction to test driven development, part examples of certain types of tests for iOS, and a brief mention of writing your tests using Kiwi.
The Spock unit testing framework is on the verge of a 1.0 release and has already proven itself to be the next generation thinking on how to test Java production code. One of the many ever present challenges to testing code is the ability to Mock classes which has simplified by Spock from a very early release. Recently added to Spock is the notion of Stubs and Spies. This sessions is designed to demonstrate proper unit testing technique showing off these new features along with a number of advanced Spock features.
Developer Tests - Things to Know (Vilnius JUG)vilniusjug
There are many great talks that discuss challenges developers face when writing software tests. In this talk let's look at test design problems that may seem to be simple but yet fundamentally important and often misunderstood even by experienced programmers.
Productos Químicos de Alta Calidad
Actividad a la que se dedica la empresa
Nuestra empresa se dedica a la producción y distribución de productos de limpieza a través de concentrados químico obtenidos como materia prima para obtener el producto final.
Misión
Producir y distribuir productos químicos comoblanqueadores, ceras emulsionadas, ambientadores, jabones líquidos, antibacterianos, desinfectantes, limpia vidrios y de belleza. Utilizando tecnología de vanguardia para satisfacer a los clientes con nuestros productos. Enfocándonos en la importancia que tiene nuestra comercialización de productos
Visión
Ser una empresa líder a nivel nacional en la producción y distribución productos químicos como blanqueadores, ceras emulsionadas, ambientadores, jabones líquidos, antibacterianos, desinfectantes, limpia vidrios y de belleza. Buscando satisfacer a los clientes con una gama de productos de óptima calidad. Comprometiéndonos con nuestro trabajo y el crecimiento personal dando un enfoque a la importancia que tiene nuestro personal
This presentation accompanied the live webinar "Moving the Needle with Social Media" presented on June 23, 2010 by Jason Falls of the Social Media Explorer and Ryan Deutsch of StrongMail.
The following is the description from the webinar, which is now archived here: http://www.strongmail.com/resources/webevents/webinars.php
Engagement is only the first step in social media marketing. You eventually need to move from conversations to conversions – because engagement alone doesn't ring the cash register. Unless you are able to drive measurable, bottom-line benefits from social media, your organization's social media efforts are ultimately doomed to fail.
In this on-demand webinar, social media marketing pioneer Jason Falls will show you how to drive your customers to act, convert and purchase without violating their trust. Learn proven strategies for leveraging popular social networks like Twitter and Facebook to increase sales, newsletter subscriptions and other key business objectives. Plus, get insight from detailed case studies and an extensive Q&A session.
Key things you will learn:
• How to set clear goals and measurable objectives for social media
• Effective strategies based on your consumer's social needs
• Tactics for motivating customers to act, convert and purchase
• Case studies showcasing how to drive revenue and customer satisfaction
• Tools for managing and measuring social media campaigns
Slides zum Vortrag https://entwicklertag.de/karlsruhe/2016/token-statt-cookies
Im Zeitalter von Microservices und Applikationen, die sich aus vielen verteilten Komponenten zusammensetzen und CSRF und CORS Aspekte abdecken müssen sind Session-Cookies nicht mehr praktikabel.
Token versprechen die heilvolle Alternative zu sein und mit JWT (JSON Web Token) liegt der Entwurf für einen Standard vor, der die Verwendung von Tokens innerhalb einer Applikationslandschaft vereinfachen soll.
Der Talk zeigt, ob Tokens ihr versprechen halten und Webapplikationen auch ohne Kekse ein Genuss bleiben.
Data Defeats Truman – SXSW Panelpicker PitchKyle J. Britt
What secrets do billions of emails reveal? Our presidential candidates are telling us everything we need to know about their campaign – and what kind of president they may be – 20 million times a day.
85 Gnarly Local SEO Tips for Auto DealersGreg Gifford
Presented as a DealerOn Webinar on August 27, 2015.
If you're an auto dealer, you don't want to miss these incredible slides - I share 85 tips about Local SEO. Local SEO is different from traditional SEO, and since Google treats car dealers as local businesses, it's incredibly important that they include Local SEO in their marketing plans.
Learn how Local SEO is different, and which signals matter most for local rankings. I even walk through exactly how to optimize each signal, so your dealership will know how to push out the best local relevancy signals possible.
If you use an SEO provider, I'll show you several easy ways to spot the shady vendors who don't really do anything to help you. If you do your own SEO, you'll learn exactly what to do to boost your local visibility.
Sticking with the "85 tips" theme, this deck is filled to the brim with movie references from the 1980s... In fact, I've included 186 movie references!
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017Ortus Solutions, Corp
Testbox is a tool we all should be using to test our ColdFusion Applications which was created and is maintained by Ortus Solutions, the people that brought you ColdBox. We will have Gavin from Ortus in house on this day to go over some testbox examples, talk about its importance, and answer any questions you have.
SO --- if you have and high level questions for Gavin, reply to this post (or hit me up) so I can get the questions to Gavin a head of time just in case he needs to consult others at Ortus.
Gavin Pickin is a proud ColdFusion developer, starting with ColdFusion in the late 90s. Now working with Ortus Solutions, a leading force in CFML Development frameworks and tools, Gavin gets to work on a lot of great projects, for a big variety of clients. At Ortus Solutions, a big focus is on free and open source tools, on open source Fridays, Gavin spend most of his open source time working on ContentBox Content Management System.
Want to know the case for Test-Driven Development? Want to know style tips and gotchas for Testing and TDD? Let Alex Chaffee, former Mad Scientist at Pivotal Labs, tell you everything you didn't know you didn't know about testing.
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.
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.
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! Die Zuhörer sollen einen Überblick über die Funktionsweise und die Einsatzbereiche von Jest bekommen. Sie lernen, wie sie mit Jest im Werkzeugkoffer für die Tests ihres Frontend-Projekts gut gerüstet sind.
Building unit tests correctly with visual studio 2013Dror Helper
Unit testing is now considered a mainstream practice, but that does not mean it is as common, pervasive or as well understood as it could or should be. Many programmers struggle with the quality of their tests and with the focus of their code. In this session we’ll learn how to write good unit testing code.
This presentation deals with a complex approach to application testing in back end and front end parts, tests writing and common mistakes. It also includes a short overview of libraries and frameworks for creation of tests, as well as practical examples of code.
Presentation by Pavlo Iuriichuk, Lead Software Engineer, GlobalLogic, Kyiv), delivered at an open techtalk on December 11, 2014.
More details - http://globallogic.com.ua/report-web-testing-techtalk-2014
In software engineering, the right architecture is essential for robust, scalable platforms. Wix has undergone a pivotal shift from event sourcing to a CRUD-based model for its microservices. This talk will chart the course of this pivotal journey.
Event sourcing, which records state changes as immutable events, provided robust auditing and "time travel" debugging for Wix Stores' microservices. Despite its benefits, the complexity it introduced in state management slowed development. Wix responded by adopting a simpler, unified CRUD model. This talk will explore the challenges of event sourcing and the advantages of Wix's new "CRUD on steroids" approach, which streamlines API integration and domain event management while preserving data integrity and system resilience.
Participants will gain valuable insights into Wix's strategies for ensuring atomicity in database updates and event production, as well as caching, materialization, and performance optimization techniques within a distributed system.
Join us to discover how Wix has mastered the art of balancing simplicity and extensibility, and learn how the re-adoption of the modest CRUD has turbocharged their development velocity, resilience, and scalability in a high-growth environment.
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
Enterprise Resource Planning System includes various modules that reduce any business's workload. Additionally, it organizes the workflows, which drives towards enhancing productivity. Here are a detailed explanation of the ERP modules. Going through the points will help you understand how the software is changing the work dynamics.
To know more details here: https://blogs.nyggs.com/nyggs/enterprise-resource-planning-erp-system-modules/
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfJay Das
With the advent of artificial intelligence or AI tools, project management processes are undergoing a transformative shift. By using tools like ChatGPT, and Bard organizations can empower their leaders and managers to plan, execute, and monitor projects more effectively.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
5. What is a unit?
● Smallest bit of code you can test?
● Talking to the actual resource may be OK if it’s stable and fast
● Classic versus mockist styles (Martin Fowler)
● Solitary versus sociable tests (Jay Fields)
● White box versus black box testing
● What’s important is the contract
http://martinfowler.com/bliki/UnitTest.html
8. You don’t know unit testing until you’ve unit tested
There’s a first time for every developer. Some are more lucky than others because
they ramp up in an environment that already embraces unit testing.
“But can already write flawless code when I’m in the zone.”
True. Because you’re actually running unit tests, without realizing, in your mind
when you’re in the zone.
Try taking a 3 week break and see what happens to those ephemeral unit tests.
Turn those tests into unit test code so that they’re repeatable and unforgettable.
10. Good unit tests
● Are functionally correct. They don’t just exercise code for the sake of
exercising code.
● Don’t depend on subsequent tests -- every test runs in its own clean
environment, failure of a test doesn’t bring the entire test suite down
● Run fast. You need to be able to run all of your tests as quickly and as
frequently as possible. Otherwise, they lose value.
● Are actually run. Automatically. So that you don’t forget to run them.
● Add new unit tests for newly discovered [and fixed] issues.
12. Good code
● Good code is more unit testable
● It all comes down to good architecture and design
● Planning for unit tests facilitates good code
● Good encapsulation: interfaces with small surfaces, well-defined contracts,
non-leaky abstractions
● Keep interdependencies low
14. Why and what are you unit testing?
● Misguided reasons: processes, meeting performance numbers
● Testing just for testing: glue code that doesn’t have any logic, ineffective tests
that don’t actually test the functionality
● Testing legacy code that is actually un-unit-testable
Be pragmatic. Don’t waste effort. Sometimes unit testing is not the answer (try
end-to-end instead).
16. Benefits of unit testing
Benefits beyond finding bugs:
● Better code
● Safety net for refactoring
● Documentation of functionality (especially when in BDD style)
● Prevents code from becoming an untestable entangled mass
18. Be test-ready on day one
● Even if you’re not planning to add test yet
● Even if there’s no code worth testing yet
● Prime your environment for future unit tests
● Especially, CI environment setup can be time consuming
● You never know when that moment will come when you have some critical
code that needs unit testing
Do this. Please.
19. Sidenote: At a bare minimum...
Even you have no time or energy to write unit tests as you go, prepare a manual
test plan, and someone in your team execute them (manually) prior to releases.
Bonus: share the effort as a team.
Basic smoke tests, checking for end-to-end sanity and regression.
Do this. Please.
30. Test correctness
● Should not be just exercising code
● Should be functionally correct
● Subject to peer review?
I don’t know of any solutions to ensure test correctness.
35. Timeout test
test/testTimeout.js:
it('should call the callback after the delay', (done) => {
const start = Date.now();
timeout.set(() => {
const elapsed = Date.now() - start;
expect(elapsed).to.equal(100);
done();
}, 100);
});
36. Run
npm test
timeout
.set()
when called with a callback and a delay
1) should call the callback after the delay
Uncaught AssertionError: expected 105 to equal 100
+ expected - actual
-105
+100
38. Write deterministic tests that run fast
● Don’t rely on chance
● A less than 100% pass rate is not acceptable
● Don’t waste time with arbitrary delays
● Use the right tools for the [right] job
41. Use a spy and a fake timer
test/testTimeout.js:
const sinon = require('sinon');
describe('timeout', () => {
let clock = null;
beforeEach(() => {
clock = sinon.useFakeTimers();
});
afterEach(() => {
clock.restore();
});
42. Use a spy and a fake timer (continued)
describe('.set()', () => {
describe('when called with a callback and a delay', () => {
it('should call the callback after the delay', () => {
const callback = sinon.spy();
timeout.set(callback, 100);
clock.tick(100);
expect(callback).to.have.been.called;
});
});
});
43. Run
npm test -- --grep timeout
timeout
.set()
when called with a callback and a delay
✓ should call the callback after the delay
100% pass rate.
58. When account not found
db.query.withArgs('account', { id: -1 }).rejects(
new Error('Account not found')
);
return accountService.findById(-1)
.catch((error) => {
expect(error).to.deep.equal(
new Error('Account not found')
);
});
60. Run
npm test -- --grep account
AccountService
.findById()
when called for an existing account
✓ should return a promise resolved with the account
when called for a non-existent account
✓ should return a promise rejected with an error
61. Need the positive case to fail the test
return accountService.findById(-1)
.catch((error) => {
expect(error).to.deep.equal(
new Error('Account not found')
);
})
.then(() => {
throw new Error('Should not have been resolved');
});
62. Run
npm test -- --grep account
AccountService
.findById()
when called for an existing account
✓ should return a promise resolved with the account
when called for a non-existent account
1) should return a promise rejected with an error
66. Updated negative test
return expect(accountService.findById(-1))
.to.eventually.be.rejectedWith(Error, 'Account not found');
67. Run
npm test -- --grep account
AccountService
.findById()
when called for an existing account
✓ should return a promise resolved with the account
when called for a non-existent account
1) should return a promise rejected with an error
AssertionError:
expected promise to be rejected with 'Error'
but it was fulfilled with { id: -1, name: 'Negative One' }