The document discusses data-driven testing and the RSpock testing framework. Some key points:
- RSpock is a testing framework built on Minitest that aims to optimize the time to build a mental model of code and write tests.
- It transforms Minitest-style tests into a more declarative style using code blocks like Given, When, Then, Expect, and Where.
- This helps group related tests together and makes it easier to understand what each part of a test is doing.
- A case study showed the test density (tests per line of code) increased by 400% when converting tests to RSpock style, improving code coverage.
The document provides guidelines for testing Rails applications. It recommends that any code change should be driven by a failed test. Tests should be close to the code being tested and focus on functionality rather than specific code. It discusses testing models, associations, named scopes, validations, controllers, views, helpers, emails, user interactions, Ajax requests, external sites, Rake tasks, file uploads, legacy applications, and more. The goal is to have tests that result in high-quality code through a test-first approach.
The document discusses test-driven development (TDD) and behavior-driven development (BDD). It clarifies that TDD is a design activity, not just about testing, and explains the benefits of TDD such as reducing speculative code and improving quality. It then covers BDD concepts like outside-in development, interaction-based testing, and using mock objects. The document provides examples of testing frameworks like RSpec and practices for writing better tests and mocks.
Two Trains and Other Refactoring AnalogiesKevin London
The document discusses strategies for refactoring legacy code through analogies like cleaning a trash pile or squeezing toothpaste from a tube. It recommends adding tests, refactoring to improve design without changing behavior, and making incremental changes to facilitate switching programming languages or improving code over time. Refactoring pays dividends by preventing technical debt and building technical wealth through continuous improvement that makes future changes easier.
Test Driven Development (TDD) is a software development practice that involves writing a failing test first, then code to pass that test, and refactoring the code. Behavior Driven Development (BDD) builds on TDD and describes how the end user will interact with the software using scenarios and steps. BDD tools like Cucumber use regular expressions to match steps in scenarios to code.
Test Driven Development emphasises quick iterations for your code. You won't code faster, but perhaps you will be more accurate.
TDD has been around for a while and I have avoided it for most of my career. I decided for the month of October all code I write I will do TDD. The result was much more positive than I thought it would be and made me rethink how I code. This talk covers the testing pyramid, the importance of unit testing and the tools I use for testing React. As part of the talk I will work through a trivial example to demonstrate how to do TDD.
RSpec 101 provides an overview of RSpec and its main concepts:
1. describe() and it() are used to define example groups and examples (tests) within those groups. describe blocks can be nested and context() is an alias for describe().
2. before(), after(), around() hooks allow setting up and tearing down test environment/state. before(:each) runs before each example while before(:all) runs once for the group.
3. expect() is used to set expectations for what should happen rather than assertions for what will. Matchers like .equal(), .include() check expectations.
4. Helper methods, shared examples, and mocks can be used to DRY up
This document provides an overview of basic JavaScript concepts including variables, functions, conditional statements, loops and recursion. It includes code examples and assignments for each concept. The assignments demonstrate core JavaScript syntax and increase in complexity, covering if/else statements, switch cases, while/do-while/for loops, and recursive functions for calculating factorials and Fibonacci series. Later assignments involve more complex tasks like printing multiple patterns and combining different statements. The document serves as a learning guide for JavaScript fundamentals.
The document provides guidelines for testing Rails applications. It recommends that any code change should be driven by a failed test. Tests should be close to the code being tested and focus on functionality rather than specific code. It discusses testing models, associations, named scopes, validations, controllers, views, helpers, emails, user interactions, Ajax requests, external sites, Rake tasks, file uploads, legacy applications, and more. The goal is to have tests that result in high-quality code through a test-first approach.
The document discusses test-driven development (TDD) and behavior-driven development (BDD). It clarifies that TDD is a design activity, not just about testing, and explains the benefits of TDD such as reducing speculative code and improving quality. It then covers BDD concepts like outside-in development, interaction-based testing, and using mock objects. The document provides examples of testing frameworks like RSpec and practices for writing better tests and mocks.
Two Trains and Other Refactoring AnalogiesKevin London
The document discusses strategies for refactoring legacy code through analogies like cleaning a trash pile or squeezing toothpaste from a tube. It recommends adding tests, refactoring to improve design without changing behavior, and making incremental changes to facilitate switching programming languages or improving code over time. Refactoring pays dividends by preventing technical debt and building technical wealth through continuous improvement that makes future changes easier.
Test Driven Development (TDD) is a software development practice that involves writing a failing test first, then code to pass that test, and refactoring the code. Behavior Driven Development (BDD) builds on TDD and describes how the end user will interact with the software using scenarios and steps. BDD tools like Cucumber use regular expressions to match steps in scenarios to code.
Test Driven Development emphasises quick iterations for your code. You won't code faster, but perhaps you will be more accurate.
TDD has been around for a while and I have avoided it for most of my career. I decided for the month of October all code I write I will do TDD. The result was much more positive than I thought it would be and made me rethink how I code. This talk covers the testing pyramid, the importance of unit testing and the tools I use for testing React. As part of the talk I will work through a trivial example to demonstrate how to do TDD.
RSpec 101 provides an overview of RSpec and its main concepts:
1. describe() and it() are used to define example groups and examples (tests) within those groups. describe blocks can be nested and context() is an alias for describe().
2. before(), after(), around() hooks allow setting up and tearing down test environment/state. before(:each) runs before each example while before(:all) runs once for the group.
3. expect() is used to set expectations for what should happen rather than assertions for what will. Matchers like .equal(), .include() check expectations.
4. Helper methods, shared examples, and mocks can be used to DRY up
This document provides an overview of basic JavaScript concepts including variables, functions, conditional statements, loops and recursion. It includes code examples and assignments for each concept. The assignments demonstrate core JavaScript syntax and increase in complexity, covering if/else statements, switch cases, while/do-while/for loops, and recursive functions for calculating factorials and Fibonacci series. Later assignments involve more complex tasks like printing multiple patterns and combining different statements. The document serves as a learning guide for JavaScript fundamentals.
Getting Started with Test-Driven Development at Midwest PHP 2021Scott Keck-Warren
In this presentation, we discussed what Test-Driven Development(TDD) is, how to get started with TDD, work through an example, and discuss how to get started in your application.
So you've got testing religion, but the question now is, how do you test your database?
This tutorial introduces pgTAP, a comprehensive, easy-to-use test suite for PostgreSQL. We'll work from getting and installing pgTAP, to writing a simple test, to running the test and integrating it into your test environment. And then we really get into the fun stuff:
Testing scalar values
Testing error conditions and performance regressions
Testing database schemas, including tables, columns, constraints, indexes, triggers, etc.
Testing result sets
Testing procedures
Testing may sound like a dry topic, but my examples aren't! Come join the fun!
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.
Finding the Right Testing Tool for the JobCiaranMcNulty
Over the last decade the idea that we should test our applications has slowly made its way from a niche idea to the mainstream of PHP development. With many tools and approaches to testing now available it can be difficult to choose which ones to use.
In this talk we will explore the current landscape of PHP testing practices, look at the different tools and approaches available, and find out how we can decide which are best for our project, team, and context.
The document discusses software testing techniques like white box testing, black box testing, test-driven development (TDD), behavior-driven development (BDD) and the RSpec testing framework for Ruby. It provides instructions on installing and using RSpec to test controllers, models and views. Code coverage with Rcov is also briefly covered.
AngularJS Unit Testing w/Karma and Jasminefoxp2code
This document provides instructions for setting up Angular unit testing with Karma and Jasmine. It discusses initializing Karma and Jasmine via NPM, configuring Karma, adding Angular and Angular mocks via Bower, writing describe and it blocks for tests, and using matchers and mocks like $httpBackend. The live coding section at the end indicates the document will demonstrate these concepts in real tests.
This document provides an overview of various tools for testing AngularJS applications, including testing frameworks like Jasmine and Mocha, unit testing with Karma and ngMock, end-to-end testing with Protractor, and automating tasks with Grunt. It describes the purpose and basic usage of these tools, provides code examples, and lists additional resources for learning more.
PyCon Korea 2019 covered using pytest to test Python code. It discussed benefits of testing like identifying bugs early. It showed how to get started with pytest including running tests. Fixtures were demonstrated to provide common functionality for tests. Parameterization was explained to run tests with different data. Mocking was presented as a way to isolate parts of code using the pytest-mock plugin. Examples tested a calculator class through fixtures, parameterization and mocking.
TDD involves an iterative process of designing, testing, and implementing code. It begins with writing a test that fails, then implementing the minimum code to pass the test, and refactoring as needed. The document provides an example of using TDD to develop an "add" function in Perl, including writing tests using the Test::More library that validate different cases like number of arguments and argument types. It also briefly discusses testing libraries for other languages like Javascript's QUnit.
From typing the test to testing the typeWim Godden
PHP unit testing + new PHPUnit patch for type testing functionality
Seems bullet points are not working and some of the slides are not so clear because of Slideshare conversion.
Presentation given at phpBenelux meeting August 25, 2010
Test-Driven Development of AngularJS ApplicationsFITC
The document discusses test driven development for AngularJS applications. It outlines problems with traditional front-end development approaches like jQuery manipulation and lack of structure/modularity. The solution presented uses Node.js, NPM, Bower, Grunt, Jasmine and other tools to automate tasks, add structure and enable testing. Features of an example task tracking app are developed using a test-first approach with end-to-end and unit tests. The app is built incrementally by splitting development into small features and writing tests for each.
The document provides an overview of testing Apex code in Salesforce, including:
- Why unit testing is important for developing robust, error-free code that meets the minimum 75% test coverage requirement.
- How to write Apex test classes annotated with @isTest and define test methods using testMethod.
- Using Test.startTest() and Test.stopTest() to test governor limits.
- Examples of testing a trigger, visualforce controller, web services callouts, and external API callouts.
- Best practices for testing such as using System.assert(), achieving 100% coverage, and testing different user contexts with System.runAs().
The document discusses testing legacy Rails applications. It provides steps to get testing set up on a legacy Rails app, including creating a test database, running migrations, and getting Rake tasks to run tests. It emphasizes starting with one test at a time, finding and fixing bugs, and refactoring code. Examples are given of writing a model test based on application logs and fixing a failure by updating code. The document stresses treating methods as isolated boxes and only testing one thing at a time to incrementally add tests to a legacy codebase.
The document discusses strategies for testing AngularJS applications, including unit testing controllers and services, mocking dependencies like HTTP requests and services, and end-to-end testing. It provides examples of writing tests for controllers, services, directives, and end-to-end tests using Protractor. Key points covered are setting up tests, injecting dependencies, mocking, and making assertions to validate test behavior.
Yet another rehash of the same old TDD/BDD presentation.
This one was for the BT Adastral Park Software Craftsmanship Mini-Conference on 8 Sepctember 2009.
If you find yourself copying and pasting code from your build.gradle file every time you start a new project, then it's time you learn about Gradle Plugins. Come and learn what it takes to create a custom Gradle plugin for use in your Android/Java applications.
We're going to go over the following:
• Plugin Structure
• Key Components
• Testing
• Publishing
Walk away feeling empowered to create your own awesome plugins!
Example First / A Sane Test-Driven Approach to ProgrammingJonathan Acker
We all know we need automated tests for our code - they are our guardian angel against regression bugs. But what exactly is the point in writing a test in advance - how does this even make sense? The first thing to grasp is that, at this stage, these are not tests - but specifications, which force us to think about exactly what we want to do - in advance. In addition TDD/BDD provide a rigorous methodology, which can help to keep us sane whilst developing complex code in steady confident steps.
The document summarizes an advanced Perl training course covering new features in Perl 5.10 like defined-or operator, switch statement, smart matching and say(), as well as testing with modules like Test::MockObject, profiling with Devel::Cover, and benchmarking code with Benchmark.pm. The one-day course will quickly cover many Perl topics and point to additional online resources for further learning.
Test-driven development (TDD) is a software development process where developers first write automated tests that define desired improvements or new functions. They then write code to pass those tests and refactor the new code to acceptable standards. TDD involves writing unit tests, integration tests, and acceptance tests using tools like JUnit, FitNesse, and Cucumber. Practicing TDD can provide benefits like improved code quality, reduced bugs, and increased developer productivity.
Getting Started with Test-Driven Development at Midwest PHP 2021Scott Keck-Warren
In this presentation, we discussed what Test-Driven Development(TDD) is, how to get started with TDD, work through an example, and discuss how to get started in your application.
So you've got testing religion, but the question now is, how do you test your database?
This tutorial introduces pgTAP, a comprehensive, easy-to-use test suite for PostgreSQL. We'll work from getting and installing pgTAP, to writing a simple test, to running the test and integrating it into your test environment. And then we really get into the fun stuff:
Testing scalar values
Testing error conditions and performance regressions
Testing database schemas, including tables, columns, constraints, indexes, triggers, etc.
Testing result sets
Testing procedures
Testing may sound like a dry topic, but my examples aren't! Come join the fun!
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.
Finding the Right Testing Tool for the JobCiaranMcNulty
Over the last decade the idea that we should test our applications has slowly made its way from a niche idea to the mainstream of PHP development. With many tools and approaches to testing now available it can be difficult to choose which ones to use.
In this talk we will explore the current landscape of PHP testing practices, look at the different tools and approaches available, and find out how we can decide which are best for our project, team, and context.
The document discusses software testing techniques like white box testing, black box testing, test-driven development (TDD), behavior-driven development (BDD) and the RSpec testing framework for Ruby. It provides instructions on installing and using RSpec to test controllers, models and views. Code coverage with Rcov is also briefly covered.
AngularJS Unit Testing w/Karma and Jasminefoxp2code
This document provides instructions for setting up Angular unit testing with Karma and Jasmine. It discusses initializing Karma and Jasmine via NPM, configuring Karma, adding Angular and Angular mocks via Bower, writing describe and it blocks for tests, and using matchers and mocks like $httpBackend. The live coding section at the end indicates the document will demonstrate these concepts in real tests.
This document provides an overview of various tools for testing AngularJS applications, including testing frameworks like Jasmine and Mocha, unit testing with Karma and ngMock, end-to-end testing with Protractor, and automating tasks with Grunt. It describes the purpose and basic usage of these tools, provides code examples, and lists additional resources for learning more.
PyCon Korea 2019 covered using pytest to test Python code. It discussed benefits of testing like identifying bugs early. It showed how to get started with pytest including running tests. Fixtures were demonstrated to provide common functionality for tests. Parameterization was explained to run tests with different data. Mocking was presented as a way to isolate parts of code using the pytest-mock plugin. Examples tested a calculator class through fixtures, parameterization and mocking.
TDD involves an iterative process of designing, testing, and implementing code. It begins with writing a test that fails, then implementing the minimum code to pass the test, and refactoring as needed. The document provides an example of using TDD to develop an "add" function in Perl, including writing tests using the Test::More library that validate different cases like number of arguments and argument types. It also briefly discusses testing libraries for other languages like Javascript's QUnit.
From typing the test to testing the typeWim Godden
PHP unit testing + new PHPUnit patch for type testing functionality
Seems bullet points are not working and some of the slides are not so clear because of Slideshare conversion.
Presentation given at phpBenelux meeting August 25, 2010
Test-Driven Development of AngularJS ApplicationsFITC
The document discusses test driven development for AngularJS applications. It outlines problems with traditional front-end development approaches like jQuery manipulation and lack of structure/modularity. The solution presented uses Node.js, NPM, Bower, Grunt, Jasmine and other tools to automate tasks, add structure and enable testing. Features of an example task tracking app are developed using a test-first approach with end-to-end and unit tests. The app is built incrementally by splitting development into small features and writing tests for each.
The document provides an overview of testing Apex code in Salesforce, including:
- Why unit testing is important for developing robust, error-free code that meets the minimum 75% test coverage requirement.
- How to write Apex test classes annotated with @isTest and define test methods using testMethod.
- Using Test.startTest() and Test.stopTest() to test governor limits.
- Examples of testing a trigger, visualforce controller, web services callouts, and external API callouts.
- Best practices for testing such as using System.assert(), achieving 100% coverage, and testing different user contexts with System.runAs().
The document discusses testing legacy Rails applications. It provides steps to get testing set up on a legacy Rails app, including creating a test database, running migrations, and getting Rake tasks to run tests. It emphasizes starting with one test at a time, finding and fixing bugs, and refactoring code. Examples are given of writing a model test based on application logs and fixing a failure by updating code. The document stresses treating methods as isolated boxes and only testing one thing at a time to incrementally add tests to a legacy codebase.
The document discusses strategies for testing AngularJS applications, including unit testing controllers and services, mocking dependencies like HTTP requests and services, and end-to-end testing. It provides examples of writing tests for controllers, services, directives, and end-to-end tests using Protractor. Key points covered are setting up tests, injecting dependencies, mocking, and making assertions to validate test behavior.
Yet another rehash of the same old TDD/BDD presentation.
This one was for the BT Adastral Park Software Craftsmanship Mini-Conference on 8 Sepctember 2009.
If you find yourself copying and pasting code from your build.gradle file every time you start a new project, then it's time you learn about Gradle Plugins. Come and learn what it takes to create a custom Gradle plugin for use in your Android/Java applications.
We're going to go over the following:
• Plugin Structure
• Key Components
• Testing
• Publishing
Walk away feeling empowered to create your own awesome plugins!
Example First / A Sane Test-Driven Approach to ProgrammingJonathan Acker
We all know we need automated tests for our code - they are our guardian angel against regression bugs. But what exactly is the point in writing a test in advance - how does this even make sense? The first thing to grasp is that, at this stage, these are not tests - but specifications, which force us to think about exactly what we want to do - in advance. In addition TDD/BDD provide a rigorous methodology, which can help to keep us sane whilst developing complex code in steady confident steps.
The document summarizes an advanced Perl training course covering new features in Perl 5.10 like defined-or operator, switch statement, smart matching and say(), as well as testing with modules like Test::MockObject, profiling with Devel::Cover, and benchmarking code with Benchmark.pm. The one-day course will quickly cover many Perl topics and point to additional online resources for further learning.
Test-driven development (TDD) is a software development process where developers first write automated tests that define desired improvements or new functions. They then write code to pass those tests and refactor the new code to acceptable standards. TDD involves writing unit tests, integration tests, and acceptance tests using tools like JUnit, FitNesse, and Cucumber. Practicing TDD can provide benefits like improved code quality, reduced bugs, and increased developer productivity.
This document provides an overview of test-driven development (TDD) and behavior-driven development (BDD), beginning with common misconceptions about TDD and how it differs from traditional testing approaches. It discusses how TDD is a design activity that focuses on emergent design and driving design with tests. Key principles of TDD/BDD are explained, such as writing tests before code, the red-green-refactor cycle, and outside-in development. The document also covers test automation, mock objects, different testing tools and frameworks, and best practices for TDD/BDD.
The document discusses Ruby and Ruby on Rails. It notes that Ruby is an object-oriented programming language created by Yukihiro Matsumoto in 1995. Ruby on Rails is a web application framework built on Ruby that was created by David Heinemeier Hansson in 2004. It follows the model-view-controller architectural pattern, separating applications into models, views, and controllers.
Presentation showing that writing tests is not really hard with examples on testing a simple class, testing with dataproviders, fixtures, mocks, stubs, databases and how to use zend framework bootstrap for MVC testing.
Given at php|tek 09 unconf sessions.
This document discusses unit testing PHP code with PHPUnit. It begins with an introduction to the speaker and then covers why testing is important, how to get started with PHPUnit, writing basic tests for a sample class, using features like data providers and expecting exceptions, and more advanced topics like stubs, mocks and testing databases and Zend Framework applications. The overall message is that testing is crucial for any PHP project and PHPUnit makes it easy to start writing tests.
The document discusses several anti-patterns for module testing, including indented test code that violates the "flat is better than nested" rule, including production logic in tests, having too many expectations in mocks, using redundant fixtures, and providing neglected diagnostics in test failures. It recommends practices like writing tests with clear expectations, using stubs instead of mocks, keeping fixtures simple, and formatting failures for clarity.
This document introduces unit testing with PHPUnit. It discusses what unit testing is, why it's important, and tools like SimpleTest and PHPUnit. It provides examples of basic unit tests for a HelloWorld class using PHPUnit. It also covers more advanced testing techniques like data providers, expected exceptions, fixtures, doubles, mocks, stubs, and database testing using examples like testing a BankAccount class. The document provides hints and tips for unit testing MVC frameworks like Zend Framework.
This document discusses refactoring code in Ruby. It provides examples of refactoring techniques like replacing conditionals with polymorphism, introducing named parameters, replacing magic numbers with symbolic constants, extracting surrounding methods, and replacing loops with closure methods. The goal of refactoring is to clean up code without changing its external behavior in order to make it more readable, flexible and maintainable.
O CPAN tem as ferramentas que você precisa para fazer TDD em Perl, o Coding D...Rodolfo Carvalho
Rodolfo Carvalho discussed Test-Driven Development (TDD) in Perl. He covered how to write tests first using modules like Test::More and Test::Most, then code to pass the tests. An example was provided of incrementally developing a Fibonacci function using TDD. He also discussed testing web applications with Test::WWW::Mechanize and Test::Mojo. Finally, he promoted regular coding dojos as a way to practice TDD in pairs and learn from others.
Pro Java Fx – Developing Enterprise ApplicationsStephen Chin
This document summarizes Stephen Chin's presentation on Pro JavaFX - Developing Enterprise Applications. It discusses JFXtras layouts and controls, automated JavaFX testing, sample enterprise applications using JavaFX, and calling REST and SOAP services from JavaFX. It also advertises a JavaFXpert RIA exemplar challenge and provides information on learning JavaFX.
The document discusses various testing techniques including parameterized tests. It provides an example of using parameterized tests with JUnit 4.8.1 to test a tax calculator with sample income and expected tax data. The test class is annotated with @RunWith(Parameterized.class) and has fields for the income and expected tax. It constructs test instances with the data and includes a test that verifies the calculated tax matches the expected value.
The document discusses testing in Django and provides an overview of writing tests from an evolutionary perspective. It begins by introducing the speaker and asking attendees to raise their hands based on their testing experience. It then defines what a test is, using an example of manually testing a function in the Python interpreter. It describes how tests can evolve to be automated and integrated into Django's testing framework. Finally, it outlines four key reasons for writing tests: to fix bugs only once, enable refactoring, serve as documentation, and clarify thinking.
This document discusses Python assertion and unit testing. It provides an example of using assertions to validate the output of a factorial function. Assertions allow checking conditions and halting the program if a condition is false. The document also covers unit testing frameworks in Python like unittest, and describes common concepts like test fixtures, test cases, test suites, and test runners. It provides an example unittest code to test the factorial function with common assertion methods like assertEqual.
This document provides an overview of test driven development with PHPUnit. It discusses what unit testing is, the benefits of testing, and how to get started with PHPUnit. Key topics covered include writing tests, assertions, dependencies, data providers, testing errors and exceptions, fixtures, and database testing. The document also mentions test output, incomplete/skipped tests, test doubles, code coverage analysis, and the skeleton generator.
This document provides an overview of PHPUnit, a unit testing framework for PHP. It introduces Sebastian Bergmann, the creator of PHPUnit, and describes some of PHPUnit's key features like test frameworks, integration with other tools, code coverage, and more. Examples are provided of writing unit tests with PHPUnit using the PHPUnit_Framework_TestCase class. Additional features like annotations, data providers, exceptions, groups, and behavior-driven development styles are also demonstrated.
Developer testing 101: Become a Testing FanaticLB Denker
In this workshop we will cover the methodologies and three basic levels of testing, then we will deep dive into how to use PHPUnit to achieve developer testing. The tests may not be the prettiest, most robust, or efficient, but you should leave the course with the ability and confidence to write tests for your code.
Topics include: xUnit framework basics and workflows, test classification, asserts, data driven testing, and an introduction to mocking.
This is a beginner course, but seasoned veterans may discover features they never knew.
- Ruby is an interactive, object-oriented programming language created by Yukihiro Matsumoto in 1995.
- Ruby on Rails is a web application framework built on Ruby that emphasizes convention over configuration and is optimized for programmer happiness.
- The document discusses Ruby and Ruby on Rails, providing an overview of their history, key principles like MVC, REST, and conventions used in Rails. It also provides examples of modeling data with classes and ActiveRecord in Rails.
This document discusses serverless applications and functions as a service (FaaS). It defines serverless as code that runs in ephemeral containers that are fully managed by third parties. FaaS allows developers to write event-triggered backend logic without managing servers. Examples are given of AWS Lambda and building a tic-tac-toe game using Lambda and other AWS services. Pricing models for the major FaaS providers are also presented. Finally, a sample serverless architecture diagram is shown.
Serverless - Lunch&Learn CleverToday - Mars 2017Brice Argenson
What is Serverless? What is BaaS and FaaS? That presentation give an introduction to those concepts and explains what are there benefits and drawbacks.
The document summarizes changes in Docker 1.13, including restructuring the CLI to group related commands together and improve usability. A newer Docker CLI can now communicate with older daemon versions. Docker 1.13 introduces secret management capabilities for swarm clusters and allows using Compose files with the docker stack command to deploy to swarms.
Packagez et déployez vos applications avec Docker - Montréal CloudFoundry Mee...Brice Argenson
Une présentation de Docker engine, Docker compose, Docker machine et Docker Swarm.
Le code source utilisé lors de la présentation est disponible ici: https://github.com/bargenson/cloudfoundry-docker-talk
The Patterns to boost your time to market - An introduction to DevOpsBrice Argenson
The document discusses patterns for improving time-to-market. It recommends adopting agile development practices like Scrum to improve the requirements to release process. It also suggests automating testing and deployments. Frequent deployments of code to production are advised, even without downtime using techniques like A/B testing. Measuring metrics at every step can provide insights to further speed up the process.
Introduction to Continuous Integration with JenkinsBrice Argenson
This document provides an introduction to continuous integration with Jenkins. It discusses what continuous integration is, how it works using examples, and why Jenkins is a popular open-source continuous integration server. Continuous integration involves developers frequently integrating their work into a shared repository. This allows for multiple times a day integration to catch bugs early. The document then demonstrates how to use Jenkins for continuous integration on a Java project.
The ServletContext represents the servlet context and allows communication between servlets and the servlet container. It provides access to context-wide resources such as initialization parameters, servlet context attributes, and logging. Some key things about the ServletContext:
- There is one instance per web application per Java Virtual Machine (JVM)
- Can be accessed by any servlet in the web application
- Contains information like context path, MIME types, etc.
- Allows servlets to share resources and configuration parameters
- Attributes set in the ServletContext are accessible by any servlet
So in summary, the ServletContext provides servlets with a way to share global data and configuration for a web application in a
The document discusses using server-sent events (SSE) with HTML5 to push data from a server to a client browser. It provides tools and guidelines for a project to build a TODO list application that uses SSE to continuously update the list of TODOs in the browser. The project skeleton outlines the TODOs API on the server and resources for further information on SSE and localStorage APIs used in the project.
Effective Java is a book by Joshua Bloch that provides best practices for writing effective Java code. It covers topics like object creation, classes and interfaces, methods, and general programming. The book recommends favoring composition over inheritance and static factory methods over constructors. It also advises avoiding unnecessary objects and using defensive copying when accepting mutable parameters. Effective Java provides many code examples to illustrate good and bad programming techniques.
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid
IBM watsonx Code Assistant for Z, our latest Generative AI-assisted mainframe application modernization solution. Mainframe (IBM Z) application modernization is a topic that every mainframe client is addressing to various degrees today, driven largely from digital transformation. With generative AI comes the opportunity to reimagine the mainframe application modernization experience. Infusing generative AI will enable speed and trust, help de-risk, and lower total costs associated with heavy-lifting application modernization initiatives. This document provides an overview of the IBM watsonx Code Assistant for Z which uses the power of generative AI to make it easier for developers to selectively modernize COBOL business services while maintaining mainframe qualities of service.
Just like life, our code must adapt to the ever changing world we live in. From one day coding for the web, to the next for our tablets or APIs or for running serverless applications. Multi-runtime development is the future of coding, the future is to be dynamic. Let us introduce you to BoxLang.
A neural network is a machine learning program, or model, that makes decisions in a manner similar to the human brain, by using processes that mimic the way biological neurons work together to identify phenomena, weigh options and arrive at conclusions.
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Paul Brebner
Closing talk for the Performance Engineering track at Community Over Code EU (Bratislava, Slovakia, June 5 2024) https://eu.communityovercode.org/sessions/2024/why-apache-kafka-clusters-are-like-galaxies-and-other-cosmic-kafka-quandaries-explored/ Instaclustr (now part of NetApp) manages 100s of Apache Kafka clusters of many different sizes, for a variety of use cases and customers. For the last 7 years I’ve been focused outwardly on exploring Kafka application development challenges, but recently I decided to look inward and see what I could discover about the performance, scalability and resource characteristics of the Kafka clusters themselves. Using a suite of Performance Engineering techniques, I will reveal some surprising discoveries about cosmic Kafka mysteries in our data centres, related to: cluster sizes and distribution (using Zipf’s Law), horizontal vs. vertical scalability, and predicting Kafka performance using metrics, modelling and regression techniques. These insights are relevant to Kafka developers and operators.
Nashik's top web development company, Upturn India Technologies, crafts innovative digital solutions for your success. Partner with us and achieve your goals
Hands-on with Apache Druid: Installation & Data Ingestion StepsservicesNitor
Supercharge your analytics workflow with https://bityl.co/Qcuk Apache Druid's real-time capabilities and seamless Kafka integration. Learn about it in just 14 steps.
These are the slides of the presentation given during the Q2 2024 Virtual VictoriaMetrics Meetup. View the recording here: https://www.youtube.com/watch?v=hzlMA_Ae9_4&t=206s
Topics covered:
1. What is VictoriaLogs
Open source database for logs
● Easy to setup and operate - just a single executable with sane default configs
● Works great with both structured and plaintext logs
● Uses up to 30x less RAM and up to 15x disk space than Elasticsearch
● Provides simple yet powerful query language for logs - LogsQL
2. Improved querying HTTP API
3. Data ingestion via Syslog protocol
* Automatic parsing of Syslog fields
* Supported transports:
○ UDP
○ TCP
○ TCP+TLS
* Gzip and deflate compression support
* Ability to configure distinct TCP and UDP ports with distinct settings
* Automatic log streams with (hostname, app_name, app_id) fields
4. LogsQL improvements
● Filtering shorthands
● week_range and day_range filters
● Limiters
● Log analytics
● Data extraction and transformation
● Additional filtering
● Sorting
5. VictoriaLogs Roadmap
● Accept logs via OpenTelemetry protocol
● VMUI improvements based on HTTP querying API
● Improve Grafana plugin for VictoriaLogs -
https://github.com/VictoriaMetrics/victorialogs-datasource
● Cluster version
○ Try single-node VictoriaLogs - it can replace 30-node Elasticsearch cluster in production
● Transparent historical data migration to object storage
○ Try single-node VictoriaLogs with persistent volumes - it compresses 1TB of production logs from
Kubernetes to 20GB
● See https://docs.victoriametrics.com/victorialogs/roadmap/
Try it out: https://victoriametrics.com/products/victorialogs/
Ensuring Efficiency and Speed with Practical Solutions for Clinical OperationsOnePlan Solutions
Clinical operations professionals encounter unique challenges. Balancing regulatory requirements, tight timelines, and the need for cross-functional collaboration can create significant internal pressures. Our upcoming webinar will introduce key strategies and tools to streamline and enhance clinical development processes, helping you overcome these challenges.
🏎️Tech Transformation: DevOps Insights from the Experts 👩💻campbellclarkson
Connect with fellow Trailblazers, learn from industry experts Glenda Thomson (Salesforce, Principal Technical Architect) and Will Dinn (Judo Bank, Salesforce Development Lead), and discover how to harness DevOps tools with Salesforce.
Building the Ideal CI-CD Pipeline_ Achieving Visual PerfectionApplitools
Explore the advantages of integrating AI-powered testing into the CI/CD pipeline in this session from Applitools engineer Brandon Murray. More information and session materials at applitools.com
Discover how shift-left strategies and advanced testing in CI/CD pipelines can enhance customer satisfaction and streamline development processes, including:
• Significantly reduced time and effort needed for test creation and maintenance compared to traditional testing methods.
• Enhanced UI coverage that eliminates the necessity for manual testing, leading to quicker and more effective testing processes.
• Effortless integration with the development workflow, offering instant feedback on pull requests and facilitating swifter product releases.
How GenAI Can Improve Supplier Performance Management.pdfZycus
Data Collection and Analysis with GenAI enables organizations to gather, analyze, and visualize vast amounts of supplier data, identifying key performance indicators and trends. Predictive analytics forecast future supplier performance, mitigating risks and seizing opportunities. Supplier segmentation allows for tailored management strategies, optimizing resource allocation. Automated scorecards and reporting provide real-time insights, enhancing transparency and tracking progress. Collaboration is fostered through GenAI-powered platforms, driving continuous improvement. NLP analyzes unstructured feedback, uncovering deeper insights into supplier relationships. Simulation and scenario planning tools anticipate supply chain disruptions, supporting informed decision-making. Integration with existing systems enhances data accuracy and consistency. McKinsey estimates GenAI could deliver $2.6 trillion to $4.4 trillion in economic benefits annually across industries, revolutionizing procurement processes and delivering significant ROI.
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...kalichargn70th171
In today's fiercely competitive mobile app market, the role of the QA team is pivotal for continuous improvement and sustained success. Effective testing strategies are essential to navigate the challenges confidently and precisely. Ensuring the perfection of mobile apps before they reach end-users requires thoughtful decisions in the testing plan.
Hyperledger Besu 빨리 따라하기 (Private Networks)wonyong hwang
Hyperledger Besu의 Private Networks에서 진행하는 실습입니다. 주요 내용은 공식 문서인https://besu.hyperledger.org/private-networks/tutorials 의 내용에서 발췌하였으며, Privacy Enabled Network와 Permissioned Network까지 다루고 있습니다.
This is a training session at Hyperledger Besu's Private Networks, with the main content excerpts from the official document besu.hyperledger.org/private-networks/tutorials and even covers the Private Enabled and Permitted Networks.
What’s new in VictoriaMetrics - Q2 2024 UpdateVictoriaMetrics
These slides were presented during the virtual VictoriaMetrics User Meetup for Q2 2024.
Topics covered:
1. VictoriaMetrics development strategy
* Prioritize bug fixing over new features
* Prioritize security, usability and reliability over new features
* Provide good practices for using existing features, as many of them are overlooked or misused by users
2. New releases in Q2
3. Updates in LTS releases
Security fixes:
● SECURITY: upgrade Go builder from Go1.22.2 to Go1.22.4
● SECURITY: upgrade base docker image (Alpine)
Bugfixes:
● vmui
● vmalert
● vmagent
● vmauth
● vmbackupmanager
4. New Features
* Support SRV URLs in vmagent, vmalert, vmauth
* vmagent: aggregation and relabeling
* vmagent: Global aggregation and relabeling
* vmagent: global aggregation and relabeling
* Stream aggregation
- Add rate_sum aggregation output
- Add rate_avg aggregation output
- Reduce the number of allocated objects in heap during deduplication and aggregation up to 5 times! The change reduces the CPU usage.
* Vultr service discovery
* vmauth: backend TLS setup
5. Let's Encrypt support
All the VictoriaMetrics Enterprise components support automatic issuing of TLS certificates for public HTTPS server via Let’s Encrypt service: https://docs.victoriametrics.com/#automatic-issuing-of-tls-certificates
6. Performance optimizations
● vmagent: reduce CPU usage when sharding among remote storage systems is enabled
● vmalert: reduce CPU usage when evaluating high number of alerting and recording rules.
● vmalert: speed up retrieving rules files from object storages by skipping unchanged objects during reloading.
7. VictoriaMetrics k8s operator
● Add new status.updateStatus field to the all objects with pods. It helps to track rollout updates properly.
● Add more context to the log messages. It must greatly improve debugging process and log quality.
● Changee error handling for reconcile. Operator sends Events into kubernetes API, if any error happened during object reconcile.
See changes at https://github.com/VictoriaMetrics/operator/releases
8. Helm charts: charts/victoria-metrics-distributed
This chart sets up multiple VictoriaMetrics cluster instances on multiple Availability Zones:
● Improved reliability
● Faster read queries
● Easy maintenance
9. Other Updates
● Dashboards and alerting rules updates
● vmui interface improvements and bugfixes
● Security updates
● Add release images built from scratch image. Such images could be more
preferable for using in environments with higher security standards
● Many minor bugfixes and improvements
● See more at https://docs.victoriametrics.com/changelog/
Also check the new VictoriaLogs PlayGround https://play-vmlogs.victoriametrics.com/
Superpower Your Apache Kafka Applications Development with Complementary Open...Paul Brebner
Kafka Summit talk (Bangalore, India, May 2, 2024, https://events.bizzabo.com/573863/agenda/session/1300469 )
Many Apache Kafka use cases take advantage of Kafka’s ability to integrate multiple heterogeneous systems for stream processing and real-time machine learning scenarios. But Kafka also exists in a rich ecosystem of related but complementary stream processing technologies and tools, particularly from the open-source community. In this talk, we’ll take you on a tour of a selection of complementary tools that can make Kafka even more powerful. We’ll focus on tools for stream processing and querying, streaming machine learning, stream visibility and observation, stream meta-data, stream visualisation, stream development including testing and the use of Generative AI and LLMs, and stream performance and scalability. By the end you will have a good idea of the types of Kafka “superhero” tools that exist, which are my favourites (and what superpowers they have), and how they combine to save your Kafka applications development universe from swamploads of data stagnation monsters!
2. • 80% reading code
• 20% writing code
• Some even say closer to 10:1
Read / Write Code
3. “I Have a Dream”
class MyThing
# ...
def do_something(a, b)
# Implementation details...
end
end
4. “I Have a Dream”
class MyThing
extend(T::Sig)
sig { params(a: Integer, b: Integer).returns(String) }
def do_something(a, b)
# Implementation details...
end
end
5. “I Have a Dream”
class MyThing
extend(T::Sig)
# Documentation
sig { params(a: Integer, b: Integer).returns(String) }
def do_something(a, b)
# Implementation details...
end
end
7. class MyThing
def do_something(a, b)
#...
end
end
Tests as Specification
class MyThingTest < HermeticTestCase
test "#do_something with arg1 and arg2 does X" do
# ...
end
test "#foo does something amazing" do
# ...
end
test "#do_something does Y if param1 is nil" do
# ...
end
test "#bar does something less amazing than foo" do
# ...
end
test "#do_something does Z" do
# ...
end
end
Mental Model
8. Tests as Specification
class MyThingTest < HermeticTestCase
test "#do_something with arg1 and arg2 does X" do
# ...
end
test "#foo does something amazing" do
# ...
end
test "#do_something does Y if param1 is nil" do
# ...
end
test "#bar does something less amazing than foo" do
# ...
end
test "#do_something does Z" do
# ...
end
end
Mental Model
class MyThing
def do_something(a, b)
#...
end
end
9. Tests as Specification
class MyThingTest < HermeticTestCase
test "#do_something with arg1 and arg2 does X" do
# ...
end
test "#foo does something amazing" do
# ...
end
test "#do_something does Y if param1 is nil" do
# ...
end
test "#bar does something less amazing than foo" do
# ...
end
test "#do_something does Z" do
# ...
end
end
Mental Model
class MyThing
def do_something(a, b)
#...
end
end
10. • Regroup related ideas (tests)
• Make it easier to identify that related tests have the same logic
• Make it easier to identify which part of a test does what
Build Mental Model Faster?
12. • Testing framework piggybacking on Minitest
• Came to life from 2x Hack Days projects in 2018
• Goals:
• Optimize time to build mental model
• Optimize time to write tests
What is it?
13. • Number of Test Cases / Lines of Code
• Higher test density => related ideas are more grouped together
Measurement: Test Density
14. class UpdaterComparatorTest < HermeticTestCase
class DummyUpdater < BaseUpdater; end
# ... setup block
test "#compare with updater a < b returns -1" do
result = @comparator.compare(UpdaterA.new, UpdaterB.new)
assert_equal(-1, result)
end
test "#compare with updater a > b returns 1" do
result = @comparator.compare(UpdaterB.new, UpdaterA.new)
assert_equal(1, result)
end
test "#compare with updater a == b returns 0" do
result = @comparator.compare(UpdaterA.new, UpdaterA.new)
assert_equal(0, result)
end
test "#compare with a missing updater raises" do
assert_raises ArgumentError do
@comparator.compare(DummyUpdater.new, UpdaterA.new)
end
end
end
Minitest
15. class UpdaterComparatorTest < HermeticTestCase
class DummyUpdater < BaseUpdater; end
# ... setup block
test "#compare with updater a < b returns -1" do
result = @comparator.compare(UpdaterA.new, UpdaterB.new)
assert_equal(-1, result)
end
test "#compare with updater a > b returns 1" do
result = @comparator.compare(UpdaterB.new, UpdaterA.new)
assert_equal(1, result)
end
test "#compare with updater a == b returns 0" do
result = @comparator.compare(UpdaterA.new, UpdaterA.new)
assert_equal(0, result)
end
test "#compare with a missing updater raises" do
assert_raises ArgumentError do
@comparator.compare(DummyUpdater.new, UpdaterA.new)
end
end
end
transform!(RSpock::AST::Transformation)
class UpdaterComparatorTest < HermeticTestCase
class DummyUpdater < CheckoutUpdaters::BaseUpdater; end
# ... setup block
test "#compare #{updater1.class} with #{updater2.class} returns #{result}" do
Expect
@comparator.compare(updater1, updater2) == result
Where
updater1 | updater2 | result
UpdaterA.new | UpdaterB.new | -1
UpdaterB.new | UpdaterA.new | 1
UpdaterB.new | UpdaterB.new | 0
end
test "#compare with unknown updater raises" do
Expect
assert_raises ArgumentError do
@comparator.compare(updater1, updater2)
end
Where
updater1 | updater2
DummyUpdater.new | DummyUpdater.new
DummyUpdater.new | UpdaterA.new
UpdaterA.new | DummyUpdater.new
end
end
RSpockMinitest
16. class UpdaterComparatorTest < HermeticTestCase
class DummyUpdater < BaseUpdater; end
# ... setup block
test "#compare with updater a < b returns -1" do
result = @comparator.compare(UpdaterA.new, UpdaterB.new)
assert_equal(-1, result)
end
test "#compare with updater a > b returns 1" do
result = @comparator.compare(UpdaterB.new, UpdaterA.new)
assert_equal(1, result)
end
test "#compare with updater a == b returns 0" do
result = @comparator.compare(UpdaterA.new, UpdaterA.new)
assert_equal(0, result)
end
test "#compare with a missing updater raises" do
assert_raises ArgumentError do
@comparator.compare(DummyUpdater.new, UpdaterA.new)
end
end
end
transform!(RSpock::AST::Transformation)
class UpdaterComparatorTest < HermeticTestCase
class DummyUpdater < CheckoutUpdaters::BaseUpdater; end
# ... setup block
test "#compare #{updater1.class} with #{updater2.class} returns #{result}" do
Expect
@comparator.compare(updater1, updater2) == result
Where
updater1 | updater2 | result
UpdaterA.new | UpdaterB.new | -1
UpdaterB.new | UpdaterA.new | 1
UpdaterB.new | UpdaterB.new | 0
end
test "#compare with unknown updater raises" do
Expect
assert_raises ArgumentError do
@comparator.compare(updater1, updater2)
end
Where
updater1 | updater2
DummyUpdater.new | DummyUpdater.new
DummyUpdater.new | UpdaterA.new
UpdaterA.new | DummyUpdater.new
end
end
RSpockMinitest
17. class UpdaterComparatorTest < HermeticTestCase
class DummyUpdater < BaseUpdater; end
# ... setup block
test "#compare with updater a < b returns -1" do
result = @comparator.compare(UpdaterA.new, UpdaterB.new)
assert_equal(-1, result)
end
test "#compare with updater a > b returns 1" do
result = @comparator.compare(UpdaterB.new, UpdaterA.new)
assert_equal(1, result)
end
test "#compare with updater a == b returns 0" do
result = @comparator.compare(UpdaterA.new, UpdaterA.new)
assert_equal(0, result)
end
test "#compare with a missing updater raises" do
assert_raises ArgumentError do
@comparator.compare(DummyUpdater.new, UpdaterA.new)
end
end
end
transform!(RSpock::AST::Transformation)
class UpdaterComparatorTest < HermeticTestCase
class DummyUpdater < CheckoutUpdaters::BaseUpdater; end
# ... setup block
test "#compare #{updater1.class} with #{updater2.class} returns #{result}" do
Expect
@comparator.compare(updater1, updater2) == result
Where
updater1 | updater2 | result
UpdaterA.new | UpdaterB.new | -1
UpdaterB.new | UpdaterA.new | 1
UpdaterB.new | UpdaterB.new | 0
end
test "#compare with unknown updater raises" do
Expect
assert_raises ArgumentError do
@comparator.compare(updater1, updater2)
end
Where
updater1 | updater2
DummyUpdater.new | DummyUpdater.new
DummyUpdater.new | UpdaterA.new
UpdaterA.new | DummyUpdater.new
end
end
RSpockMinitest
18. class UpdaterComparatorTest < HermeticTestCase
class DummyUpdater < BaseUpdater; end
# ... setup block
test "#compare with updater a < b returns -1" do
result = @comparator.compare(UpdaterA.new, UpdaterB.new)
assert_equal(-1, result)
end
test "#compare with updater a > b returns 1" do
result = @comparator.compare(UpdaterB.new, UpdaterA.new)
assert_equal(1, result)
end
test "#compare with updater a == b returns 0" do
result = @comparator.compare(UpdaterA.new, UpdaterA.new)
assert_equal(0, result)
end
test "#compare with a missing updater raises" do
assert_raises ArgumentError do
@comparator.compare(DummyUpdater.new, UpdaterA.new)
end
end
end
transform!(RSpock::AST::Transformation)
class UpdaterComparatorTest < HermeticTestCase
class DummyUpdater < CheckoutUpdaters::BaseUpdater; end
# ... setup block
test "#compare #{updater1.class} with #{updater2.class} returns #{result}" do
Expect
@comparator.compare(updater1, updater2) == result
Where
updater1 | updater2 | result
UpdaterA.new | UpdaterB.new | -1
UpdaterB.new | UpdaterA.new | 1
UpdaterB.new | UpdaterB.new | 0
end
test "#compare with unknown updater raises" do
Expect
assert_raises ArgumentError do
@comparator.compare(updater1, updater2)
end
Where
updater1 | updater2
DummyUpdater.new | DummyUpdater.new
DummyUpdater.new | UpdaterA.new
UpdaterA.new | DummyUpdater.new
end
end
RSpockMinitest
19. class UpdaterComparatorTest < HermeticTestCase
class DummyUpdater < BaseUpdater; end
# ... setup block
test "#compare with updater a < b returns -1" do
result = @comparator.compare(UpdaterA.new, UpdaterB.new)
assert_equal(-1, result)
end
test "#compare with updater a > b returns 1" do
result = @comparator.compare(UpdaterB.new, UpdaterA.new)
assert_equal(1, result)
end
test "#compare with updater a == b returns 0" do
result = @comparator.compare(UpdaterA.new, UpdaterA.new)
assert_equal(0, result)
end
test "#compare with a missing updater raises" do
assert_raises ArgumentError do
@comparator.compare(DummyUpdater.new, UpdaterA.new)
end
end
end
transform!(RSpock::AST::Transformation)
class UpdaterComparatorTest < HermeticTestCase
class DummyUpdater < CheckoutUpdaters::BaseUpdater; end
# ... setup block
test "#compare #{updater1.class} with #{updater2.class} returns #{result}" do
Expect
@comparator.compare(updater1, updater2) == result
Where
updater1 | updater2 | result
UpdaterA.new | UpdaterB.new | -1
UpdaterB.new | UpdaterA.new | 1
UpdaterB.new | UpdaterB.new | 0
end
test "#compare with unknown updater raises" do
Expect
assert_raises ArgumentError do
@comparator.compare(updater1, updater2)
end
Where
updater1 | updater2
DummyUpdater.new | DummyUpdater.new
DummyUpdater.new | UpdaterA.new
UpdaterA.new | DummyUpdater.new
end
end
RSpockMinitest
20. 4 26
Test Cases per Lines of Code
test cases w/o RSpock lines of code w/o RSpock
6 30test cases with RSpock lines of code with RSpock
34. Then
Then "The product is added to the cart"
cart.products.size == 1
cart.products.first == product
35. Expect
When "Calling #abs on a negative number"
actual = -2.abs
Then "Value is positive"
actual == 2
Expect "absolute of -2 is 2"
-2.abs == 2
Using Expect
When + Then
36. • Use When + Then to describe methods with side-effects
• Use Expect to describe purely functional methods (query methods)
Expect: Rule of Thumb
37. Cleanup
Given "Open the file"
file = File.new("/invalid/file/path") # raises
# other blocks...
Cleanup
# Use safe navigation operator, since +file+ is nil if an error occurred.
file&.close
38. Where
test "#{a} XOR #{b} results in #{r}" do
Expect
a ^ b == r
Where
a | b | r
0 | 0 | 0
0 | 1 | 1
1 | 0 | 1
1 | 1 | 0
end
42. • Ordering test cases makes them easier to find and reason about.
• Ordered data table makes it easier to understand test cases.
• Recommend to order by boolean increment.
Where Blocks
44. Why do this?
test "#{a} XOR #{b} results in #{r}" do
Expect
a ^ b == r
Where
a | b | r
0 | 0 | 0
0 | 1 | 1
1 | 0 | 1
1 | 1 | 0
end
45. test "#{a} XOR #{b} results in #{r}" do
Expect
a ^ b == r
Where
a | b | r
0 | 0 | 0
0 | 1 | 1
1 | 0 | 1
1 | 1 | 0
end
When you can do this:
[
{a: 0, b: 0, r: 0},
{a: 0, b: 1, r: 1},
{a: 1, b: 0, r: 1},
{a: 1, b: 1, r: 1},
].each do |a:, b:, r:|
test "#{a} XOR #{b} results in #{r}" do
assert_equal r, a ^ b
end
end
Why do this?
46. • Executed code != Source code
• Debugging in Pry has slightly different code
What’s the catch?
47. • Better tooling support (i.e. Pry)
• Open-sourcing the project
• More features!!
What’s next?