Daniel Davis is a software developer with 8 years of experience who now focuses on Python development and DevOps. He discusses his journey learning about unit testing and how mocking strategies can make testing easier. Mocking eliminates dependencies, allows testing of methods without return values, and helps test error handling. Various Python mocking libraries are presented. Examples show how to use mocking to test a matching algorithm in a dating app and to test a JSON reader class. The key benefits of mocking are that it simplifies unit tests by handling dependencies and verifying method behavior.
This presentation walks the reader through implementing a simple web application and its tests using Python, Flask, and the Pytest testing framework. Emphasis is placed on following the process of test-driven development (TDD) in creating the application.
This presentation walks the reader through implementing a simple web application and its tests using Python, Flask, and the Pytest testing framework. Emphasis is placed on following the process of test-driven development (TDD) in creating the application.
Cypress-vs-Playwright: Let the Code SpeakApplitools
Hear what the code has to say in this epic matchup between test automation frameworks—Cypress vs. Playwright—and see who will be crowned the winner in this webinar by Applitools
See the session materials at https://applitools.info/pmv
Rather than compile lists of feature comparisons, this matchup is a battle of the code where Cypress Ambassador Filip Hric and Automation Panda Andrew Knight implement small coding challenges in JavaScript using Cypress and Playwright, respectively. They then compare and contrast their solutions, and the audience chooses the winner.
See comparisons of Cypress and Playwright in:
API requests
Inline frames
Alerts
Page Objects...and more!
From the audience:
"This was great. Loved the playful banter."
"Event was really well done..fair play to all involved"
"Very Useful and Interesting Session"
A talk I gave at the Golang TO Meetup. Highlighting the beautiful powers of Go with respect to concurrency, and writing concurrent programs using it.
Code at: github.com/jsimnz/concurrency-talk
No drama here - E2E-testing django with playwrightMastacheata1
Presentation given at the 30th Django Meetup Cologne on April 19th 2022.
The presentation shows a few of the key benefits of Playwright and how to use it with Django/Python in General.
The presentation was held at and sponsored by my employer Ambient Innovation GmbH
[PyCon2016]To mock or not to mock, that is the questionsAna Balica
Mocking is a very powerful testing concept that has some dangerous pitfalls. There are obvious use cases where mocks are an absolute requirement to be able to test a part of the app. Nevertheless sometimes apparently useful mocks can yield erroneous test results. This talk goes into deeper detail on the trade-off of using mocks in testing.
Cypress-vs-Playwright: Let the Code SpeakApplitools
Hear what the code has to say in this epic matchup between test automation frameworks—Cypress vs. Playwright—and see who will be crowned the winner in this webinar by Applitools
See the session materials at https://applitools.info/pmv
Rather than compile lists of feature comparisons, this matchup is a battle of the code where Cypress Ambassador Filip Hric and Automation Panda Andrew Knight implement small coding challenges in JavaScript using Cypress and Playwright, respectively. They then compare and contrast their solutions, and the audience chooses the winner.
See comparisons of Cypress and Playwright in:
API requests
Inline frames
Alerts
Page Objects...and more!
From the audience:
"This was great. Loved the playful banter."
"Event was really well done..fair play to all involved"
"Very Useful and Interesting Session"
A talk I gave at the Golang TO Meetup. Highlighting the beautiful powers of Go with respect to concurrency, and writing concurrent programs using it.
Code at: github.com/jsimnz/concurrency-talk
No drama here - E2E-testing django with playwrightMastacheata1
Presentation given at the 30th Django Meetup Cologne on April 19th 2022.
The presentation shows a few of the key benefits of Playwright and how to use it with Django/Python in General.
The presentation was held at and sponsored by my employer Ambient Innovation GmbH
[PyCon2016]To mock or not to mock, that is the questionsAna Balica
Mocking is a very powerful testing concept that has some dangerous pitfalls. There are obvious use cases where mocks are an absolute requirement to be able to test a part of the app. Nevertheless sometimes apparently useful mocks can yield erroneous test results. This talk goes into deeper detail on the trade-off of using mocks in testing.
Написание юнит-тестов большинству представляется занятием скучным и до некоторой степени бесполезным. Мое мнение — это всё оттого, что сама "классическая" схема юнит-тестов подразумевает непродуктивное написание унылого линейного кода.
В докладе я расскажу о том, как с помощью pytest начать писать тесты, которые приятно читать и поддерживать, почему setUp и tearDown — это прошлый век, как с помощью правильной организации fixtures ускорить исполнение тестов, а также какие ещё уловки могут помочь вам в вашей нелегкой борьбе с рутиной.
This presentation demonstrates general guidelines how to create good test cases using Robot Framework. Both good practices and anti-patterns are presented.
The presentation is hosted on GitHub where you can find the original in ODP format: https://github.com/robotframework/DosDontsSlides
Robot Framework is a generic keyword-driven test automation framework for acceptance level testing and acceptance test-driven development (ATDD). It has an easy-to-use tabular syntax for creating test cases and its testing capabilities can be extended by test libraries implemented either with Python or Java. Users can also create new keywords from existing ones using the same simple syntax that is used for creating test cases.
Old presentation was updated on 1st of September, 2014. Content stayed mostly the same but examples were enhanced. Copyrights and some links were also updated a bit later. The presentation is nowadays hosted on GitHub where you can find the original in ODP format: https://github.com/robotframework/IntroSlides
Unit testing is an important part of development, but does not always get the attention it deserves. In this session we will discuss how to write truly automated unit tests that run without any manual setup or special configuration, as well as producing Python code coverage reports within OPNFV Jenkins to ensure that the important paths are being tested. Additional topics include how to have code coverage part of the Gerrit review cycle to ensure compliance. Use of Python nosetest, mock and Coberatura code coverage will be discussed.
PuppetConf 2016: How Not to Freak Out When You Start Writing Puppet Modules f...Puppet
Here are the slides from Glenn Sarti's PuppetConf 2016 presentation called How Not to Freak Out When You Start Writing Puppet Modules for Windows. Watch the videos at https://www.youtube.com/playlist?list=PLV86BgbREluVjwwt-9UL8u2Uy8xnzpIqa
We spend so much time focusing on conventional programming. Everyone focuses on standards, code clarity, testing, and what gems to use. Let's chat about what's done before your fingers hit the keys. Let's talk about brainstorming, requirements, stakeholders, mock-ups, and writing solid user stories and acceptance tests with Cucumber. Every project has a story - how will your next one end?
Agile Software Development in practice: Experience, Tips and Tools from the T...Valerie Puffet-Michel
In the Division of Student Affairs at the University of Connecticut, the Applications Development team has been developing and delivering custom software using agile methods for over four years. In this session, we'll share our experiences and give you a behind the scenes look at how agile software development really works by walking you through how we translate the unique business needs of our clients into deployed software.
Don't get blamed for your choices - Techorama 2019Hannes Lowette
As developers, we make choices all the time: architecture, frameworks, libraries, cloud providers, etc. And if you’ve been around for a while, you probably ended up regretting at least some of your choices.
In this session, we'll explore the typical pitfalls of making development choices and how to avoid them. By the end of this session, you will be armed to take any decision they will throw at you.
Now, if only there was a way to prove to your peers and superiors that you acquired this skill...
Well, there is! RAD Certification! I'll end my talk by telling you about this awesome certification program!
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)ssusercaf6c1
Have you heard of TDD? Are you interested or familiar with this practice but have never been able to understand it?
Join this session to see the benefits of Test-Driven Development (TDD), understand how it works and its benefits. In a more detailed approach, we will see this way of developing software, where our code is always built guided by tests.
We will go over some history about TDD, which is the main process we must follow when we work with this mechanic and the rules that surround it. We will also list the main advantages and disadvantages that most developers who practice TDD find and whether the arguments in favour add up to more than those that subtract. Finally, we will review some good habits and practices when applying TDD and see how to do it step by step with an example of a "live" coding session with Java.
At the end of the session, I hope that you will have a wider understanding of what TDD is, what advantages it brings, why it is interesting to master it and also that you will take with you some tricks and good practices to be able to apply them in your day-to-day life when writing code
---
Presentation shared at Trójmiasto Java User Group
Public group 17th of May '23
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)Nacho Cougil
Have you heard of TDD? Are you interested or familiar with this practice but have never been able to understand it?
Join this session to see the benefits of Test-Driven Development (TDD), understand how it works and its benefits. In a more detailed approach, we will see this way of developing software, where our code is always built guided by tests.
We will go over some history about TDD, which is the main process we must follow when we work with this mechanic and the rules that surround it. We will also list the main advantages and disadvantages that most developers who practice TDD find and whether the arguments in favour add up to more than those that subtract. Finally, we will review some good habits and practices when applying TDD and see how to do it step by step with an example of a "live" coding session with Java.
At the end of the session, I hope that you will have a wider understanding of what TDD is, what advantages it brings, why it is interesting to master it and also that you will take with you some tricks and good practices to be able to apply them in your day-to-day life when writing code
---
Presentation shared at Trójmiasto Java User Group (17th May '23)
Have you heard of TDD? Are you interested or familiar with this practice but have never been able to understand it?
Join this session to see the benefits of Test-Driven Development (TDD), understand how it works and its benefits. In a more detailed approach, we will see this way of developing software, where our code is always built guided by tests.
We will go over some history about TDD, which is the main process we must follow when we work with this mechanic and the rules that surround it. We will also list the main advantages and disadvantages that most developers who practice TDD find and whether the arguments in favour add up to more than those that subtract. Finally, we will review some good habits and practices when applying TDD and see how to do it step by step with an example of a "live" coding session with Java.
At the end of the session, I hope that you will have a wider understanding of what TDD is, what advantages it brings, why it is interesting to master it and also that you will take with you some tricks and good practices to be able to apply them in your day-to-day life when writing code
===
Presentation (revisited & updated) shared at JDD 2022:
https://jdd.org.pl/lecture_2022/#id=78434
Quickly and Effectively Testing Legacy c++ Code with Approval Tests mu cppClare Macrae
Presented at MUC++, 6 August 2020
Links from this talk are at: https://github.com/claremacrae/talks/blob/main/Quickly_and_Effectively_Testing_Legacy_C++_Code_with_Approval_Tests.md#top
Abstract:
You've inherited some legacy code: it's valuable, but it doesn't have tests, and it wasn't designed to be testable, so you need to start refactoring. But you can't refactor safely until the code has tests, and you can't add tests without refactoring! How can you ever break out of this loop?
Whether Legacy code for you means "old code", "code without tests", or "code you wish to redesign for new features or unit-tests", this talk will enable you to become productive and work safely, quickly.
The simplicity, convenience, ease-of-use, power and flexibility of Llewellyn Falco's "Approval Tests" approach has long been proven in a dozen programming languages. And now all this is now available to C++ developers too!
Clare will present a small but surprisingly effective C++11 library for applying "Approval Tests" to cross-platform C++ code - for both legacy and green-field systems, and with a range of testing frameworks.
She will demonstrate its use in some real-world situations, including how to quickly lock down the behaviour of legacy code. She will show how to quickly achieve good test coverage, even for very large sets of inputs.
Attendees will discover some quick, practical techniques to use for common challenges that can be applied very easily using Approval Tests.
Join this session to see the benefits of Test-Driven Development (TDD), and understand how it works and its benefits. In a more detailed approach, we will see this way of developing software, where our code is always built guided by tests. We will go over some history about TDD and list the main advantages and disadvantages that most developers who practice it find and whether the arguments in favour add up to more than those that subtract. Finally, we will review some good habits and practices when applying TDD by seeing how to do it step by step with an example of a "live" coding session with Java. At the end of the session, you will have a wider understanding of TDD and why it's interesting to master it. Also, you will take with you some tricks and good practices to be able to apply them in your day-to-day life when writing code.
---
Presentation shared at Bucharest Tech Week '23
Алексей Ященко и Ярослав Волощук "False simplicity of front-end applications"Fwdays
It’s easy to underestimate a front-end project's complexity, which leads to shallow and thus incorrect implementation. Attempts to fix this problem result in uncontrolled complexity growth and undefined behavior in corner cases.
We'll discuss ways of revealing the inherent complexity of a problem and dealing with it both on theoretical and practical levels.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Let's dive deeper into the world of ODC! Ricardo Alves (OutSystems) will join us to tell all about the new Data Fabric. After that, Sezen de Bruijn (OutSystems) will get into the details on how to best design a sturdy architecture within ODC.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
4. Really though, who are you?
• Came from Java world
• Python developer for 2 years
• DevOps
– Lots of work with automation and quality
• Passionate about quality!
– Doesn’t happen overnight…
6. • Became a Certified Scrum Developer
(CSD) about 2 years ago
• Finally learned about craftsmanship and
writing better tests
– Basically black magic
• Learned in Java…
I want to be a better developer
7. • Switching to Python was jarring
• Kept wondering about writing unit tests
• Dealing with complicated frameworks like
Django
Finding Python
7
8. • Asked colleagues
– Many had the same questions
• Decided to learn…
• Wanted to share with the community
Unit testing? Mocks?
8
11. • “They’re good when the problem is easy”
– A rabbit hole of testing
• “I spend too much time writing lots of code
to test, so I give up”
• “There’s just some stuff you can’t unit test”
Great Unit Testing Myths
13. What Are Mocks?
13
Test Double
Dummy
Object
Test Stub Test Spy
Mock
Object
Fake
Object
Commonly referred to as “Mocks”
14. • Stubs
– Provide a canned response to method calls
• Spy
– Real objects that behave like normal except
when a specific condition is met
• Mocks
– Verifies behavior (calls) to a method
What Are Mocks?
14
16. • Eliminates dependencies in the CUT
(class under test)
– Isolated Unit Tests
Problems Mocks Solve
16
foo(x) bar(x)
17. • Tests methods that have no return value
Problems Mocks Solve
17
How do we know that bar(x) has been called?
18. • Tests error handling
Problems Mocks Solve
18
How do we generate this exception???
19. • Eliminate dependency on database calls
– Speed up testing!
• Reduce test complexity
– Don’t have to write complex logic to handle
behavior of methods not under test
• Don’t have to wait to implement other
methods
Other Reasons Mocks Are Important
19
21. • Mock (MagicMock)
– Most robust, popular
– Built-in as of Python 3.3!
• flexmock
– Based on Ruby’s flexmock
• mox
– Similar to Java’s EasyMock
• Mocker
• dingus
– “record then assert” mocking library
• fudge
– Similar to Mockito
• MiniMock
– Simple mocking with DocTest
What Are The Python Options?
21
24. • Create a method to return a new, random
victim candidate
– Must not show the same person
– Must not show someone the user has already
“swiped” on
Problem: “Docker” dating app
25. Easy enough…
25
“Surely no one could
have seen EVERYONE
in the database!!!”
- The Intern
get_next_person() get_random_person()
42. • Use patching / mocks to bring certainty to
method calls
• Eliminates dependencies on other code
– Even unfinished code!!!
• Lots of ways to do it, pick your favorite
Recap: What did we learn?
42
45. • When a user swipes right…
• If the other user “likes” them:
– Send them both a message with contact info
• If the other user “dislikes” them:
– Let the user down gently…
• If the other user hasn’t evaluated yet:
– Display the “give it time” message
Problem: “Docker” matches
61. • open() returns a File object
• open(filename).read()
• So we really need to mock File.read()
– But it’s an instance!!! Oh no!
What? Why Not???
61
Have you tried solving it with Mocks???
67. • Mocking makes writing unit tests simpler
– Eliminates dependencies
– Verifies behavior
– Tests error handling
• You just need some practice!
Remember This!