There is more to unit testing than using a unit testing framework. In order to succeed you want to use the right tools for the job. There are a few tools that almost no one talks about – some enabling the creation of top-notch, robust unit tests; some will help you run your tests better and faster.
In this session, Dror will explain about the inevitable maintainability problems developers face when writing and maintaining huge unit testing suits, and how unit level BDD, AutoMocking and Continuous Execution can help take control over your tests.
The document discusses Google Guice, an open source framework for Java that supports dependency injection. It provides examples of how to use Guice to inject dependencies into classes through field injection, method injection, and constructor injection. It also covers how to define modules to configure dependency bindings and scopes like singletons. The document is intended to introduce developers to the basics of using Guice for dependency injection in Java applications.
The Tellurium Automated Testing Framework (Tellurium) is a UI module-based web automated testing framework built on top of Selenium. Here is a step by step guide to teach you how to create a New Tellurium Test project.
Selenide is simple and powerful in use wrapper-library over Selenium. But what the point just of shorter lines of code? In this talk we will see how to tame your webui mustang with Selenide and put it into fence of simple BDD stories with Easyb. We also consider pros and cons of the approach and compare to available alternatives.
Test-Driven Development and Android discusses TDD for Android applications. It describes integrating JUnit with Android and recommended test case classes for different testing needs such as activities, services, and content providers. It also covers running tests from the command line, setting up test fixtures with setUp() and tearDown(), grouping tests by size with annotations, and using Monkey to perform random stress testing. Functional testing of activities is possible using ActivityInstrumentationTestCase2.
The Screenplay Pattern: Better Interactions for Better AutomationApplitools
The document discusses the Screenplay Pattern, an approach to modeling user interactions in automated tests. It outlines some problems with traditional page object patterns, such as duplication of code and unintuitive structure. The Screenplay Pattern models interactions as tasks performed by actors using their abilities, providing a more intuitive and flexible design. The document then demonstrates implementing the Screenplay Pattern in C# using the Boa Constrictor library, rewriting a web test to search DuckDuckGo in this manner in 3 sentences or less.
SWTBot is a tool for automating UI tests of Eclipse plug-ins. The document covers setting up SWTBot, challenges of UI testing, exercises in using the SWTBot API to find widgets and perform actions, best practices like using abstractions and page objects, and tips for logging and timeouts. Key points include using matchers to find widgets robustly, ensuring thread safety, and modeling capabilities rather than UI elements.
The document discusses iOS UI testing in Xcode. It provides an overview of record and playback, test scripts written in Swift or Objective-C, and running UI automation tests on iOS. It demonstrates recording a test and shows an example test for the "Add" button that launches the application, finds the button, taps it, and makes an assertion about the number of table cells. It also discusses code coverage and test reports.
This document discusses using Gherkin with XCUITest for iOS automation testing. It begins with an introduction to XCUITest, including recording tests, interacting with elements, and refactoring code. It then demonstrates building a simple test suite for a weather app. Finally, it shows how to implement Gherkin feature files to specify tests in a human-readable format, including steps to set up tests and make assertions. Gherkin allows for acceptance test driven development and collaboration across teams.
The document discusses Google Guice, an open source framework for Java that supports dependency injection. It provides examples of how to use Guice to inject dependencies into classes through field injection, method injection, and constructor injection. It also covers how to define modules to configure dependency bindings and scopes like singletons. The document is intended to introduce developers to the basics of using Guice for dependency injection in Java applications.
The Tellurium Automated Testing Framework (Tellurium) is a UI module-based web automated testing framework built on top of Selenium. Here is a step by step guide to teach you how to create a New Tellurium Test project.
Selenide is simple and powerful in use wrapper-library over Selenium. But what the point just of shorter lines of code? In this talk we will see how to tame your webui mustang with Selenide and put it into fence of simple BDD stories with Easyb. We also consider pros and cons of the approach and compare to available alternatives.
Test-Driven Development and Android discusses TDD for Android applications. It describes integrating JUnit with Android and recommended test case classes for different testing needs such as activities, services, and content providers. It also covers running tests from the command line, setting up test fixtures with setUp() and tearDown(), grouping tests by size with annotations, and using Monkey to perform random stress testing. Functional testing of activities is possible using ActivityInstrumentationTestCase2.
The Screenplay Pattern: Better Interactions for Better AutomationApplitools
The document discusses the Screenplay Pattern, an approach to modeling user interactions in automated tests. It outlines some problems with traditional page object patterns, such as duplication of code and unintuitive structure. The Screenplay Pattern models interactions as tasks performed by actors using their abilities, providing a more intuitive and flexible design. The document then demonstrates implementing the Screenplay Pattern in C# using the Boa Constrictor library, rewriting a web test to search DuckDuckGo in this manner in 3 sentences or less.
SWTBot is a tool for automating UI tests of Eclipse plug-ins. The document covers setting up SWTBot, challenges of UI testing, exercises in using the SWTBot API to find widgets and perform actions, best practices like using abstractions and page objects, and tips for logging and timeouts. Key points include using matchers to find widgets robustly, ensuring thread safety, and modeling capabilities rather than UI elements.
The document discusses iOS UI testing in Xcode. It provides an overview of record and playback, test scripts written in Swift or Objective-C, and running UI automation tests on iOS. It demonstrates recording a test and shows an example test for the "Add" button that launches the application, finds the button, taps it, and makes an assertion about the number of table cells. It also discusses code coverage and test reports.
This document discusses using Gherkin with XCUITest for iOS automation testing. It begins with an introduction to XCUITest, including recording tests, interacting with elements, and refactoring code. It then demonstrates building a simple test suite for a weather app. Finally, it shows how to implement Gherkin feature files to specify tests in a human-readable format, including steps to set up tests and make assertions. Gherkin allows for acceptance test driven development and collaboration across teams.
This talk was given at "The KISS Method and PageObjects" meetup (https://goo.gl/2DBuxj).
The talk is about KISS (Keep It Simple Stupid) principle applied to PageObjects design with a comparison to other more classic approaches.
The slides contain both Selenium Webdriver and Selenide examples.
src code for the talk: https://github.com/yashaka/talks/tree/master/kiss-pageobjects
How to setup unit testing in Android Studiotobiaspreuss
The document describes the steps to set up unit testing in an Android project using Android Studio, Robolectric, and JUnit. It includes adding dependencies for Robolectric and JUnit to the app/build.gradle file, applying the Robolectric Gradle plugin, creating a test folder and sample test class, and configuring the project structure and IDE integration so tests can be run from Android Studio.
Plugin for Plugin, или расширяем Android New Build System. Антон РуткевичYandex
This document discusses creating a Gradle plugin that allows placeholders to be replaced in the Android BuildConfig.java file.
The plugin processes each variant after evaluation, adds a task to generate the BuildConfig, handles inputs and outputs, and replaces placeholders with values from a map. This allows variables like server URLs to be configured and replaced during the build.
The key steps are to create a Gradle plugin, process each variant after evaluation, add an action to the generateBuildConfig task, handle inputs and outputs, and perform the replacements. The plugin demonstrates how to extend the new Android build system from a Gradle plugin.
Slides from "Polyglot Automation" talk given at QA Fest conference.
There are many good programming languages. But test automation is preety simple so the power of language will not matter. But choosing language does matter for effective automation. How to choose the language for Web UI automation? Why Web UI automation is easy? How to choose easyy tools for your automation? How to learn new language and why? We will try to answer all these questions in this talk.
SWTBot is an open-source Java framework for testing SWT and Eclipse-based applications. It provides an easy API to automate UI testing similar to a click-robot by handling SWT complexity. SWTBot's API can be integrated into JUnit tests to develop and run test cases. It allows finding widgets using text, labels, groups, tooltips, or IDs, and performing common actions like clicking, typing, and selecting. SWTBot also takes screenshots on errors and supports different test execution modes like via launch configurations or from the command line.
XCUITest for iOS App Testing and how to test with XcodepCloudy
This document discusses IOS app testing using XCTest and XCUITest. It covers the challenges of IOS automation, current tool options like Appium, XCTest, and XCUITest. It provides an introduction to XCTest and XCUITest, including how to create a basic automation script. It also discusses the impact of XCUITest on Appium, as Appium now proxies commands to XCUITest for IOS 9 and above, rather than the deprecated UIAutomation framework.
Xcode 7 introduces new features for automated UI testing and code coverage. It allows writing tests that interact with the user interface using elements, queries, and simulated events. The UI can be recorded to capture actions and facilitate test creation. Code coverage provides a report on which code is and isn't exercised by tests. Beta releases added capabilities for recording gestures, supporting code coverage for static libraries, and interacting with controls like pickers, sliders and alerts. Known issues include limitations interacting identifying elements and with popovers. The presentation demonstrates UI recording and testing capabilities in Xcode 7.
This document discusses React, a JavaScript library for building user interfaces. It provides an overview of React concepts like components, props, state, lifecycle methods, and the virtual DOM. Components are the basic building blocks and can be composed to build complex UIs. Data flows unidirectionally from parent to child components via props, while state is local and mutable. The virtual DOM allows React to efficiently update the real DOM by comparing component trees.
This document introduces JsUnit, an open source JavaScript unit testing framework that allows writing and running unit tests for JavaScript code in browsers. It discusses key aspects of JsUnit like how it conforms to the XUnit testing standard, how to write test functions and pages, how to group tests into test suites, and how JsUnit provides tools to automatically run tests across multiple browsers and operating systems for continuous integration and testing purposes.
Learn How to Unit Test Your Android Application (with Robolectric)Marakana Inc.
The document discusses the Android unit test framework Robolectric. It provides an overview of Robolectric, including how it works by using shadow objects to simulate the Android framework classes, allowing tests to run on a normal JVM. It also covers how to get started with Robolectric by using the sample project, and how to write tests by accessing shadow objects and dealing with classes that don't expose full state.
SWTBot is a open source UI testing tool for SWT and Eclipse based applications. It requires bare minimum learning since it is Java based and integrates well with the JUnit framework.
An ideal unit testing tool for SWT and Eclipse based applications developers.
Dagger is a dependency injection framework that helps manage object creation and dependencies. It allows injecting dependencies into classes rather than having them directly instantiate dependencies. This improves testability. The document discusses how Dagger is used at the New York Times, including setting up modules, components, scopes like activity scope, and testing with Dagger. Qualifiers are used to provide different implementations for different flavors. Modules provide dependencies, components compose modules and inject dependencies. This architecture allows scaling across build variants and libraries while improving testability and code organization.
Functional Testing made easy with SWTBot for Developers and TestersAurélien Pupier
The document discusses using SWTBot, an automated testing framework for SWT applications. It provides an overview of SWTBot's capabilities and limitations, then describes how implementing the "Page Object Pattern" addresses some limitations by creating an application-oriented API that hides implementation details and allows testers to write tests without knowledge of underlying UI components. The implementation was successful in improving test code quality and robustness when used at Bonitasoft with their QA team.
This document discusses various types of tests for Android applications, including instrumentation tests, which run on an emulator or physical device, and unit tests, which run on a JVM without Android dependencies. It covers challenges with instrumentation tests like speed and dependencies on the device state. The document recommends writing business logic separately from UI code to make it more testable. It also provides information on frameworks like Robolectric, Mockito, and JaCoCo that can help with unit testing and code coverage of Android applications.
My Robolectric overview done on Android meet-up hosted by Xebia
The final code from the presentation with additional examples will be here:
https://github.com/emartynov/robolectric-presentation
This document discusses two approaches to automating tests for Unity games: the Puppetry driver framework and image recognition using OpenCV.
The Puppetry driver allows writing tests by finding and interacting with game objects, but requires knowledge of Unity-specific concepts. Image recognition finds elements by screenshotting and template matching, handling different resolutions and states, but lacks capabilities to directly check game state.
Both approaches are debated in a fictional debate format comparing their speed, stability, maintenance, entry threshold, and abilities for new tests, layout testing, and more. While the Puppetry driver is faster to set up initially, image recognition requires learning appium but may scale better for complex games.
Iasi code camp 20 april 2013 implement-quality-java-massol-codecampCodecamp Romania
This document discusses implementing quality practices on Java projects. It provides tips on API stability, such as using deprecations, CLIRR to track API changes, excluding internal packages from javadocs, and using annotations to mark unstable APIs. It also discusses preventing JAR hell by avoiding duplicate classes at runtime and ensuring correct dependency versions. The document recommends using Jacoco to enforce test coverage thresholds and failing the build when not met. It suggests strategies for improving functional test stability, such as ignoring known failure cases. Finally, it proposes designating regular bug fixing days to focus on resolving existing issues.
This document contains a collection of code snippets and questions related to Android development puzzles and concepts. It discusses topics like the Android application lifecycle when finishing an activity, how fragment and activity handle returning results from started activities, and default behavior of progress bars and Toasts. The snippets are accompanied by multiple choice questions testing understanding of how the code would execute or appear.
HIV attacks and weakens the immune system, leading potentially to AIDS. HIV stands for human immunodeficiency virus and there is currently no cure. Within a few weeks of HIV infection, symptoms can include fever, sore throat, fatigue and diarrhea. AIDS is the final stage of HIV where the immune system is severely damaged, resulting in life-threatening infections. Kaposi's sarcoma is a cancer that causes lesions in soft tissues and organs, and often affects people with HIV/AIDS.
Electronics 101 for software developersDror Helper
These days it seems as if everybody talks about the internet of things (IoT). With a cheap Arduino, Raspberry PI (or another microcontroller) every developer has the power to control the real world.
Suddenly confronted with resistors, digital inputs, analog interfaces and a weird bread board full of holes – a developer is reminded that the world of hardware can be confusing and sometimes downright frustrating.
This talk was given at "The KISS Method and PageObjects" meetup (https://goo.gl/2DBuxj).
The talk is about KISS (Keep It Simple Stupid) principle applied to PageObjects design with a comparison to other more classic approaches.
The slides contain both Selenium Webdriver and Selenide examples.
src code for the talk: https://github.com/yashaka/talks/tree/master/kiss-pageobjects
How to setup unit testing in Android Studiotobiaspreuss
The document describes the steps to set up unit testing in an Android project using Android Studio, Robolectric, and JUnit. It includes adding dependencies for Robolectric and JUnit to the app/build.gradle file, applying the Robolectric Gradle plugin, creating a test folder and sample test class, and configuring the project structure and IDE integration so tests can be run from Android Studio.
Plugin for Plugin, или расширяем Android New Build System. Антон РуткевичYandex
This document discusses creating a Gradle plugin that allows placeholders to be replaced in the Android BuildConfig.java file.
The plugin processes each variant after evaluation, adds a task to generate the BuildConfig, handles inputs and outputs, and replaces placeholders with values from a map. This allows variables like server URLs to be configured and replaced during the build.
The key steps are to create a Gradle plugin, process each variant after evaluation, add an action to the generateBuildConfig task, handle inputs and outputs, and perform the replacements. The plugin demonstrates how to extend the new Android build system from a Gradle plugin.
Slides from "Polyglot Automation" talk given at QA Fest conference.
There are many good programming languages. But test automation is preety simple so the power of language will not matter. But choosing language does matter for effective automation. How to choose the language for Web UI automation? Why Web UI automation is easy? How to choose easyy tools for your automation? How to learn new language and why? We will try to answer all these questions in this talk.
SWTBot is an open-source Java framework for testing SWT and Eclipse-based applications. It provides an easy API to automate UI testing similar to a click-robot by handling SWT complexity. SWTBot's API can be integrated into JUnit tests to develop and run test cases. It allows finding widgets using text, labels, groups, tooltips, or IDs, and performing common actions like clicking, typing, and selecting. SWTBot also takes screenshots on errors and supports different test execution modes like via launch configurations or from the command line.
XCUITest for iOS App Testing and how to test with XcodepCloudy
This document discusses IOS app testing using XCTest and XCUITest. It covers the challenges of IOS automation, current tool options like Appium, XCTest, and XCUITest. It provides an introduction to XCTest and XCUITest, including how to create a basic automation script. It also discusses the impact of XCUITest on Appium, as Appium now proxies commands to XCUITest for IOS 9 and above, rather than the deprecated UIAutomation framework.
Xcode 7 introduces new features for automated UI testing and code coverage. It allows writing tests that interact with the user interface using elements, queries, and simulated events. The UI can be recorded to capture actions and facilitate test creation. Code coverage provides a report on which code is and isn't exercised by tests. Beta releases added capabilities for recording gestures, supporting code coverage for static libraries, and interacting with controls like pickers, sliders and alerts. Known issues include limitations interacting identifying elements and with popovers. The presentation demonstrates UI recording and testing capabilities in Xcode 7.
This document discusses React, a JavaScript library for building user interfaces. It provides an overview of React concepts like components, props, state, lifecycle methods, and the virtual DOM. Components are the basic building blocks and can be composed to build complex UIs. Data flows unidirectionally from parent to child components via props, while state is local and mutable. The virtual DOM allows React to efficiently update the real DOM by comparing component trees.
This document introduces JsUnit, an open source JavaScript unit testing framework that allows writing and running unit tests for JavaScript code in browsers. It discusses key aspects of JsUnit like how it conforms to the XUnit testing standard, how to write test functions and pages, how to group tests into test suites, and how JsUnit provides tools to automatically run tests across multiple browsers and operating systems for continuous integration and testing purposes.
Learn How to Unit Test Your Android Application (with Robolectric)Marakana Inc.
The document discusses the Android unit test framework Robolectric. It provides an overview of Robolectric, including how it works by using shadow objects to simulate the Android framework classes, allowing tests to run on a normal JVM. It also covers how to get started with Robolectric by using the sample project, and how to write tests by accessing shadow objects and dealing with classes that don't expose full state.
SWTBot is a open source UI testing tool for SWT and Eclipse based applications. It requires bare minimum learning since it is Java based and integrates well with the JUnit framework.
An ideal unit testing tool for SWT and Eclipse based applications developers.
Dagger is a dependency injection framework that helps manage object creation and dependencies. It allows injecting dependencies into classes rather than having them directly instantiate dependencies. This improves testability. The document discusses how Dagger is used at the New York Times, including setting up modules, components, scopes like activity scope, and testing with Dagger. Qualifiers are used to provide different implementations for different flavors. Modules provide dependencies, components compose modules and inject dependencies. This architecture allows scaling across build variants and libraries while improving testability and code organization.
Functional Testing made easy with SWTBot for Developers and TestersAurélien Pupier
The document discusses using SWTBot, an automated testing framework for SWT applications. It provides an overview of SWTBot's capabilities and limitations, then describes how implementing the "Page Object Pattern" addresses some limitations by creating an application-oriented API that hides implementation details and allows testers to write tests without knowledge of underlying UI components. The implementation was successful in improving test code quality and robustness when used at Bonitasoft with their QA team.
This document discusses various types of tests for Android applications, including instrumentation tests, which run on an emulator or physical device, and unit tests, which run on a JVM without Android dependencies. It covers challenges with instrumentation tests like speed and dependencies on the device state. The document recommends writing business logic separately from UI code to make it more testable. It also provides information on frameworks like Robolectric, Mockito, and JaCoCo that can help with unit testing and code coverage of Android applications.
My Robolectric overview done on Android meet-up hosted by Xebia
The final code from the presentation with additional examples will be here:
https://github.com/emartynov/robolectric-presentation
This document discusses two approaches to automating tests for Unity games: the Puppetry driver framework and image recognition using OpenCV.
The Puppetry driver allows writing tests by finding and interacting with game objects, but requires knowledge of Unity-specific concepts. Image recognition finds elements by screenshotting and template matching, handling different resolutions and states, but lacks capabilities to directly check game state.
Both approaches are debated in a fictional debate format comparing their speed, stability, maintenance, entry threshold, and abilities for new tests, layout testing, and more. While the Puppetry driver is faster to set up initially, image recognition requires learning appium but may scale better for complex games.
Iasi code camp 20 april 2013 implement-quality-java-massol-codecampCodecamp Romania
This document discusses implementing quality practices on Java projects. It provides tips on API stability, such as using deprecations, CLIRR to track API changes, excluding internal packages from javadocs, and using annotations to mark unstable APIs. It also discusses preventing JAR hell by avoiding duplicate classes at runtime and ensuring correct dependency versions. The document recommends using Jacoco to enforce test coverage thresholds and failing the build when not met. It suggests strategies for improving functional test stability, such as ignoring known failure cases. Finally, it proposes designating regular bug fixing days to focus on resolving existing issues.
This document contains a collection of code snippets and questions related to Android development puzzles and concepts. It discusses topics like the Android application lifecycle when finishing an activity, how fragment and activity handle returning results from started activities, and default behavior of progress bars and Toasts. The snippets are accompanied by multiple choice questions testing understanding of how the code would execute or appear.
HIV attacks and weakens the immune system, leading potentially to AIDS. HIV stands for human immunodeficiency virus and there is currently no cure. Within a few weeks of HIV infection, symptoms can include fever, sore throat, fatigue and diarrhea. AIDS is the final stage of HIV where the immune system is severely damaged, resulting in life-threatening infections. Kaposi's sarcoma is a cancer that causes lesions in soft tissues and organs, and often affects people with HIV/AIDS.
Electronics 101 for software developersDror Helper
These days it seems as if everybody talks about the internet of things (IoT). With a cheap Arduino, Raspberry PI (or another microcontroller) every developer has the power to control the real world.
Suddenly confronted with resistors, digital inputs, analog interfaces and a weird bread board full of holes – a developer is reminded that the world of hardware can be confusing and sometimes downright frustrating.
The document appears to be a map or diagram detailing the organization of Allied forces and their commanders in the European Theater of World War II between November 1942 and May 1945. Key details include divisions, army groups, and commanding officers such as Montgomery, Clark, Patton, Bradley, Devers, and Alexander. The forces are divided into Eastern, Western, and Center Task Forces across multiple army groups.
Este documento proporciona información sobre el boxeo. Explica que el boxeo es un deporte de combate entre dos personas que usan solo sus puños dentro de un cuadrilátero, siguiendo reglas específicas. También describe que el boxeo se originó en África hace miles de años y luego se extendió a Egipto, Grecia, Roma e Inglaterra, donde se desarrollaron reglas formales. El boxeo ha evolucionado para incluir categorías de peso y divisiones de género.
Regarded as the “front page of the internet,” Reddit is where 234 million users share links and discuss ideas. Can marketers post about a product or service there? The short answer: yes. But here's how to do successfully.
More information on posting to Reddit here: http://bit.ly/1TruCHd
The document provides information about Diesel Locomotive Works (DLW) in Varanasi, India. Some key points:
- DLW is a production unit owned by Indian Railways that manufactures diesel-electric locomotives. It was established in 1961 in collaboration with an American company.
- DLW's annual production capacity is 200 locomotives. It produces various locomotive models for freight, passenger and mixed-use applications with power ratings ranging from 1300-5500 horsepower.
- The factory has different production shops for activities like welding, machining, engine assembly, and locomotive assembly. Locomotives pass through various stages from raw material to the final testing and painting processes.
-
PRESENTATION ON DIESEL TRACTION CENTRE GONDA ABDUS SAMAD
This document provides a presentation on the Diesel Traction Centre in N.E.R Gonda. It summarizes that the centre was established in 1982 with 22 locomotives and now houses 160 locomotives. It also discusses the classification system for locomotives, indicating gauge, power source, and service type. It highlights several innovations the centre has developed, including an SFC recorder to measure locomotive performance, a governor test stand to test diesel engine control, and tools to aid locomotive maintenance like a bogie frame manipulator.
Indian Railways has one of the largest and busiest rail networks in the world. It is divided into 16 zones with 67 divisions total. Approximately 50% of Indian Railways' 108,805 km of track is diesel-powered.
A diesel locomotive shed is where repair and maintenance of diesel locomotives is performed to keep them working properly. It aims to increase operational life, minimize line failures, and improve locomotive efficiency through technical manpower. A shed has facilities like berths, pits, cranes, fuel and lube oil storage, water treatment, and testing labs.
The Locomotive Diesel Shed in Phulera has an area of 2261 square meters and holdings of 64 locomotives.
Secret unit testing tools no one ever told you aboutDror Helper
There are more to unit testing than using a unit testing framework – in order to succeed you want to use the right tools for the job. There are a few tools that almost no one talks about – some enabling creating of top-notch, robust unit tests. Some will help you run your tests better and faster.
In this session I’ll explain about the inevitable maintainability problems developers face when writing and maintaining huge unit testing suits and how unit level BDD, AutoMocking, and Continuous Execution can help take control over your tests.
This document discusses using AngularJS with Django to build a single page application called Tweeter. Some key advantages of this approach are that it is faster since pages don't need to reload, any JavaScript framework can be used, and the backend is reusable for mobile apps. Django REST framework is used to create RESTful APIs for models like Tweets that Angular consumes through resources and controllers. Templates are used to pass data from Django to Angular initially, while Angular routing and partials handle page changes within the SPA. Overall this provides a smooth integration of Django and Angular that separates concerns for a better user experience.
This document discusses unit testing for mobile apps. It provides an overview of unit testing, including why to test code (to fix bugs early, refine design, ease changes, and provide documentation), how to test code (after writing, before writing, and after fixing bugs), and popular tools for unit testing iOS and Android apps, such as XCTest, JUnit, and Robolectric. Code samples are provided to demonstrate unit testing with XCTest, OCMock, JUnit, and Mockito. The presentation concludes with a demo of testing with KIF and a call for questions.
The secret unit testing tools no one has ever told you aboutDror Helper
There are more to unit testing than using a unit testing framework - in order to succeed you want to use the right tools for the job. There are a few tools that almost no one talks about - some enabling creating of top-notch, robust unit tests. Some will help you run your tests better and faster.
In this session I'll explain about the inevitable maintainability problems developers face when writing and maintaining huge unit testing suits and how unit level BDD, AutoMocking, and Continuous Execution can help take control over your tests.
Breaking Dependencies to Allow Unit TestingSteven Smith
Unit testing software can be difficult, especially when the software wasn't designed to be testable. Dependencies on infrastructure concerns and software we don't control are one of the biggest contributors to testing difficulty. In this session, you'll learn the difference between unit tests and other kinds of tests, how to recognize and invert dependencies, and how to unit test your code's interactions with these dependencies without testing the infrastructure itself.
JHipster is one of those open-source projects you stumble upon and immediately think, "Of course!" It combines three very successful frameworks in web development: Bootstrap, Angular, and Spring Boot. Bootstrap was one of the first dominant web-component frameworks. Its largest appeal was that it only required a bit of HTML and it worked! All the efforts we made in the Java community to develop web components were shown a better path by Bootstrap. It leveled the playing field in HTML/CSS development, much like Apple's Human Interface Guidelines did for iOS apps.
This talk shows you how to use JHipster to build a Spring Boot API, an Angular UI, and make it all look good with Bootstrap. You'll learn how to deploy the generated project to Heroku too!
The first question after people have learned about how to implement anadvanced architecture in their applications from scratch is: "How do I transform my codebase from its current state to a well architected app?" Forget about BigBang rewrites. Come and learn some strategies, tricks, and gotchas about how to do the migration to an advanced arch mobile app. Move to from Objective-C to Swift in the process and keep it functional during the whole process.
TDD is now mainstream but a lot people don't know or don't remember what is its purpose. TDD is about software design not testing or catching bug. TDD helps developers to shape and create software with "good" design, what is a "good" design is something that we will discuss in the topic.
Async task, threads, pools, and executors oh my!Stacy Devino
http://360andev.com/sessions/100-async-task-threads-pools-and-executors/
Frome 360 AnDev conference
There are many ways to use Threads and in the multithreaded world in which we live, it can be confusing when, where, and how to use these functions correctly. Still, that assumes you know what they all mean and how to manipulate them. Novices and Experts welcome as there are many schools of thought, but we will explore them all together.
Don’t worry, we have you covered.
Animated Version : but.ly/asyncThread
This document discusses UI testing with Xamarin.Forms. It recommends focusing UI tests on verifying UI flow and interactions without looking at system functionality. The document covers test principles, writing tests using AAA pattern, using Behavior Driven Development approach with Gherkin, identifying controls with AutomationId, running tests on App Center Test Cloud, and integrating UI tests with DevOps. Demo code shows writing queries inside and outside Repl(), and sample tests.
Testing code through automated tests is important to ensure security and catch bugs early in the development process. There are different types of tests like unit tests which test individual functions and modules, and functional tests which test overall page behavior and interactions. Writing tests requires considering what to test, test organization, and dealing with limitations of testing tools.
V1.0
How often do you get a bug report that you can’t reproduce?
How often do you struggle to find the source of the bug in your code?
How can you streamline the testing process and make sure you don’t repeat the same bugs?
With Visual Studio 2010 & Team Foundation Server (TFS) 2010 there are a lot of new features for testers and developers that will solve these problems.
In this session you will learn how to: automate more, reproduce bugs easier, maintain your tests and configuration and discover problems sooner.
from Peter Gfader
This document discusses unit testing at different developer experience levels. A level 1 developer thinks code always works properly without needing tests. A level 2 developer sees value in occasional manual testing but not unit tests due to cost. A level 5 developer sees value in basic unit tests to prevent bugs. A level 11 developer understands principles of unit tests like being simple, independent, complete, and deterministic. Higher levels emphasize high test coverage, using tests for documentation and design, and ensuring tests are reproducible. The document provides examples of good and bad unit test code and discusses tools for measuring coverage.
The secret unit testing tools no one ever told you aboutDror Helper
There are more to unit testing than using a unit testing framework - in order to succeed you want to use the right tools for the job. There are a few tools that almost no one talks about - some enabling creating of top-notch, robust unit tests. Some will help you run your tests better and faster. In this session I'll explain about the inevitable maintainability problems developers face when writing and maintaining huge unit testing suits and how unit level BDD, AutoMocking, and Continuous Execution can help take control over your tests.
This document discusses developing middleware for the Swift object storage system. It introduces middlewares and how they can extend functionality without modifying code. It covers the WSGI interface, common middleware patterns, and tools like paste.deploy for packaging and deploying middlewares. Finally, it provides an example of writing a middleware for Swift to generate and serve preview images on GET requests.
This document discusses automated acceptance testing for ASP.NET applications. It begins with a demonstration of using Selenium WebDriver to automate a Google search. The document then covers topics like the testing pipeline, challenges with real-world testing, focusing tests on solving specific pain points, and designing UI for testability. It emphasizes that UI tests should validate scenarios rather than individual actions and should focus on the most critical tests. The document also discusses tools, techniques, and strategies for testing databases, legacy systems, and more.
Reactive Type safe Webcomponents with skateJSMartin Hochel
This was presented at GUG Prague js dev meetup www.gug.cz/cs/akce/reactive-type-safe-webcomponents/terminy/1
You know the drill right? new cool framework/library appears... boom! new Datepicker in that framework follows and soon enough whole UI libraries, again and again....
It's 2017 and it's time to stop this madness once and for all! How you ask?
In this talk I will do an overview of component creation in terms of re-usability followed up with real life examples how to create performant, reactive, small and type-safe web components with tiny superpowered library called SkateJS.
Write once, use everywhere by using the platform.
Source code: https://github.com/Hotell/reactive-typesafe-webcomponents
SkateJS: https://github.com/skatejs/skatejs
A few things could be improved in this test:
1. Extract the HTTP client into a dependency rather than creating it directly in the test. This decouples the test from the implementation details of making HTTP requests.
2. Consider using a mock HTTP client in the test to avoid actual network calls. This makes the test faster and isolated.
3. Split the test into two - one for the POST and one for the GET. Having multiple assertions in one test violates the one-assertion-per-test rule and makes the test less readable.
4. Add more validation of the response, e.g. check status codes, response bodies etc. rather than a single assertion.
So in summary
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.
Debugging with visual studio beyond 'F5'Dror Helper
Debugging is part of any development process, but unfortunately it’s never planned or expected. On top of that, it’s rarely approached in a structured way, and while many modern IDEs have powerful debugging tools – most developers are not aware of how they can be used to reduce the time and pain of debugging. The whole act of debugging is done as an ad-hoc, time consuming activity, which is considered less interesting then developing new features or investigating the latest and greatest technology. But while there are many articles and productivity tools aimed at writing better code – faster, it seems as though it’s impossible to find resources that teach you how to effectively debug your code. In this lecture, we will discuss how to approach a debugging session, and show the latest power debugging capabilities Visual Studio has to offer. These will help you save time and pain by first understanding the problem and then fixing the bug that caused it.
Every software developer enjoys finding new and clever ways to solve problems. Writing code using his/her wits, intelligent and creativity. However, sometimes being too clever can lead to hard to track bugs, maintainability issues and impossible to understand code. Is all cleverly written code good code, or is it a problem just waiting to happen? In this session, I will show you real world examples of cleverly written code. And show you how we can use clean code principles, refactoring and design patterns, to transform that code from clever code to good code – one that your peers and future self would thank you for writing.
Part of the software developer job is to find new and better ways to solve problems. Writing code using his/her wits, intelligent and creativity.
However, sometimes being too clever can lead to hard to track bugs, maintainability issues and impossible to understand code. Is all cleverly written code good code, or is it a problem just waiting to happen?
In this session, I will show you real world examples of cleverly written code. And show you how we can use clean code principles, refactoring and design patterns, to transform that code from clever code to good code, code one that your peers - and future self - would thank you for writing.
A software developer guide to working with awsDror Helper
This document provides guidance for software developers working with AWS. It begins by recommending steps for getting started with AWS, including creating an AWS account and user, and not using the root account for security. It then discusses considerations for deciding on compute types, networking configurations, architecture for high availability, storage and database options, and how to test services locally before deploying to AWS. The document demonstrates calling AWS services from code and provides resources for learning more about AWS services and costs.
In Agile development, architects still play an important role by setting constraints and principles to provide guidance and boundaries for development teams. While Agile values working software over documentation, architects can document architecture decisions and provide guidance through code examples. On Agile teams, the architect acts as an owner who facilitates architectural decisions, explores new technologies, and evolves the architecture over time based on learnings. The architect also helps align development across teams when needed.
Harnessing the power of aws using dot net coreDror Helper
In the past AWS and C# seemed to belong to two different eco-systems. One was a leading cloud platform while the other a widely used, powerful programming platform.
Does it mean that a developer that needs to provide a solution in the cloud must choose between the two? Not anymore.
In this talk, I will show how to write C# code that runs in a dockerized container in the cloud or as an AWS Lambda and harness, the popular AWS services.
Developing multi-platform microservices using .NET coreDror Helper
In the past, C# developers’ could only look in envy as the world moved to container based micro services and cloud deployment – until now.
With the new ASP.NET Core a C# developer can write REST based microservices using the latest and greatest Visual Studio and deploy them in a different OS - or the cloud using Docker, quickly and effortlessly.
Harnessing the power of aws using dot netDror Helper
In the past AWS and C# seemed to belong to two different eco-systems. One was a leading cloud platform while the other a widely used, powerful programming platform.
Does it mean that a developer that needs to provide a solution in the cloud must choose between the two? Not anymore.
In this talk, I will show how to write C# code that runs in a dockerized container in the cloud or as an AWS Lambda and harness, the popular AWS services.
C++ Unit testing - the good, the bad & the uglyDror Helper
C++ is a powerful language when used by a seasoned developer. It is being used everywhere from operating systems and compilers to cross platform mobile apps development.
But this power comes with a cost - C++ programming is not simple nor easy – with memory leaks, stack overflows and strange exceptions, a software developer needs all of the power he can use.
By harnessing the power of unit tests a software developer can find defects quickly, avoid regression and speed up development time.
In this talk I’ll show how to use the right unit testing tools and practices available that will help you get your C++ code under control and even test legacy code which no one ever want to touch.
The document discusses strategies for working with legacy C++ code, including gaining control over legacy code through iterative refactoring while ensuring existing functionality is maintained. It emphasizes learning what the code does, making sure it continues functioning properly, and making gradual improvements. Specific techniques mentioned include writing tests, creating fake objects to inject into code under test instead of real dependencies, and using templates or friendship to fake classes that are otherwise difficult to mock.
Visual Studio tricks every dot net developer should knowDror Helper
Debugging is hard - this is a fact of life. Unfortunately, it’s never planned nor expected. It takes too much time, time we could have spent doing cool stuff - like developing new features for our customers.
But while there are many articles and productivity tools aimed at writing better code – faster, it seems as though it’s impossible to find resources that teach you how to effectively debug your code.
In this talk we’ll explore Visual Studio’s more powerful but lesser known debugging capabilities. We’ll also showcase OzCode and explain how it helps finding and fixing bugs faster.
TDD, BDD, ATDD are all methodologies that enable incremental design that is suitable for Agile environments. It seems that every day a new xDD methodology is born with the promise to be better than what came before. Should you use behaviour-driven tests or plain old unit tests? Which methodology is better? And how exactly would it benefit the development life cycle?
In this session, Dror will help to sort out the various methodologies – explaining where they came from, the tools they use, and discussing how and when to use each one. Here we will once and for all answer the question as to whether or not there’s one “DD” to rule them all.
This document discusses best practices for writing unit tests. It emphasizes that unit tests should be easy to understand, trustworthy, and robust. A good unit test only fails if a bug is introduced or requirements change. The document provides examples of well-written unit tests and discusses how to avoid common problems like fragile tests. It stresses the importance of testing only specified functionality, using isolation frameworks to mock dependencies, and not putting test logic in the test. Overall, the document promotes writing "clean tests" to avoid brittle tests and minimize maintenance overhead.
This document introduces WinDbg, a debugger tool that can be used for post mortem crash analysis, memory leak detection, and deadlock discovery. It discusses how to load crash dumps and symbols, and provides an overview of basic commands like listing processes and threads. Crash analysis commands for .NET like !analyze, !printexception, and !clrstack are presented. Commands for investigating memory issues like !dumpheap and !gcroot are also highlighted. The document concludes with discussing deadlock detection using commands like !dlk and !mwaits.
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.
Unit tests are great, they help a developer gain control over his code and catch bugs and regression issues.
Test Driven Development is a methodology that uses unit tests but it's not about writing unit tests - in fact the tests are only a design tool.
TDD is a methodology that solves problems in an iterative way, it's about emergent design that creates a maintainable solution.
In this session I'll talk about common mistakes and misconceptions, how to benefit from TDD and show how to design your code using unit tests.
The code for this talk can be found on GitHub: https://github.com/dhelper/DesignWIthTests
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.
Maintaining the product is one (if not the most) expensive area of the overall product costs. Writing clean code can significantly lower these costs, making it more efficient during the initial development and results in more stable code. In this session participants will learn how to apply C# techniques in order to improve the efficiency, readability, testability and extensibility of code.
Using FakeItEasy allows creating fake objects to use in tests. It is a .NET dynamic fake framework that provides a fluent interface to define fake object behavior and assertions. FakeItEasy fakes objects by creating derived classes, so only virtual, abstract, and interface methods can be faked. It handles default behavior and parameter handling to reduce test code. Dependency injection helps pass fake objects to production code under test.
🏎️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.
Orca: Nocode Graphical Editor for Container OrchestrationPedro J. Molina
Tool demo on CEDI/SISTEDES/JISBD2024 at A Coruña, Spain. 2024.06.18
"Orca: Nocode Graphical Editor for Container Orchestration"
by Pedro J. Molina PhD. from Metadev
What to do when you have a perfect model for your software but you are constrained by an imperfect business model?
This talk explores the challenges of bringing modelling rigour to the business and strategy levels, and talking to your non-technical counterparts in the process.
14 th Edition of International conference on computer visionShulagnaSarkar2
About the event
14th Edition of International conference on computer vision
Computer conferences organized by ScienceFather group. ScienceFather takes the privilege to invite speakers participants students delegates and exhibitors from across the globe to its International Conference on computer conferences to be held in the Various Beautiful cites of the world. computer conferences are a discussion of common Inventions-related issues and additionally trade information share proof thoughts and insight into advanced developments in the science inventions service system. New technology may create many materials and devices with a vast range of applications such as in Science medicine electronics biomaterials energy production and consumer products.
Nomination are Open!! Don't Miss it
Visit: computer.scifat.com
Award Nomination: https://x-i.me/ishnom
Conference Submission: https://x-i.me/anicon
For Enquiry: Computer@scifat.com
The Comprehensive Guide to Validating Audio-Visual Performances.pdfkalichargn70th171
Ensuring the optimal performance of your audio-visual (AV) equipment is crucial for delivering exceptional experiences. AV performance validation is a critical process that verifies the quality and functionality of your AV setup. Whether you're a content creator, a business conducting webinars, or a homeowner creating a home theater, validating your AV performance is essential.
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.
Transforming Product Development using OnePlan To Boost Efficiency and Innova...OnePlan Solutions
Ready to overcome challenges and drive innovation in your organization? Join us in our upcoming webinar where we discuss how to combat resource limitations, scope creep, and the difficulties of aligning your projects with strategic goals. Discover how OnePlan can revolutionize your product development processes, helping your team to innovate faster, manage resources more effectively, and deliver exceptional results.
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.
Photoshop Tutorial for Beginners (2024 Edition)alowpalsadig
Photoshop Tutorial for Beginners (2024 Edition)
Explore the evolution of programming and software development and design in 2024. Discover emerging trends shaping the future of coding in our insightful analysis."
Here's an overview:Introduction: The Evolution of Programming and Software DevelopmentThe Rise of Artificial Intelligence and Machine Learning in CodingAdopting Low-Code and No-Code PlatformsQuantum Computing: Entering the Software Development MainstreamIntegration of DevOps with Machine Learning: MLOpsAdvancements in Cybersecurity PracticesThe Growth of Edge ComputingEmerging Programming Languages and FrameworksSoftware Development Ethics and AI RegulationSustainability in Software EngineeringThe Future Workforce: Remote and Distributed TeamsConclusion: Adapting to the Changing Software Development LandscapeIntroduction: The Evolution of Programming and Software Development
Photoshop Tutorial for Beginners (2024 Edition)Explore the evolution of programming and software development and design in 2024. Discover emerging trends shaping the future of coding in our insightful analysis."Here's an overview:Introduction: The Evolution of Programming and Software DevelopmentThe Rise of Artificial Intelligence and Machine Learning in CodingAdopting Low-Code and No-Code PlatformsQuantum Computing: Entering the Software Development MainstreamIntegration of DevOps with Machine Learning: MLOpsAdvancements in Cybersecurity PracticesThe Growth of Edge ComputingEmerging Programming Languages and FrameworksSoftware Development Ethics and AI RegulationSustainability in Software EngineeringThe Future Workforce: Remote and Distributed TeamsConclusion: Adapting to the Changing Software Development LandscapeIntroduction: The Evolution of Programming and Software Development
The importance of developing and designing programming in 2024
Programming design and development represents a vital step in keeping pace with technological advancements and meeting ever-changing market needs. This course is intended for anyone who wants to understand the fundamental importance of software development and design, whether you are a beginner or a professional seeking to update your knowledge.
Course objectives:
1. **Learn about the basics of software development:
- Understanding software development processes and tools.
- Identify the role of programmers and designers in software projects.
2. Understanding the software design process:
- Learn about the principles of good software design.
- Discussing common design patterns such as Object-Oriented Design.
3. The importance of user experience (UX) in modern software:
- Explore how user experience can improve software acceptance and usability.
- Tools and techniques to analyze and improve user experience.
4. Increase efficiency and productivity through modern development tools:
- Access to the latest programming tools and languages used in the industry.
- Study live examples of applications
8 Best Automated Android App Testing Tool and Framework in 2024.pdfkalichargn70th171
Regarding mobile operating systems, two major players dominate our thoughts: Android and iPhone. With Android leading the market, software development companies are focused on delivering apps compatible with this OS. Ensuring an app's functionality across various Android devices, OS versions, and hardware specifications is critical, making Android app testing essential.
Boost Your Savings with These Money Management AppsJhone kinadey
A money management app can transform your financial life by tracking expenses, creating budgets, and setting financial goals. These apps offer features like real-time expense tracking, bill reminders, and personalized insights to help you save and manage money effectively. With a user-friendly interface, they simplify financial planning, making it easier to stay on top of your finances and achieve long-term financial stability.
Nashik's top web development company, Upturn India Technologies, crafts innovative digital solutions for your success. Partner with us and achieve your goals
Mobile App Development Company In Noida | Drona InfotechDrona Infotech
React.js, a JavaScript library developed by Facebook, has gained immense popularity for building user interfaces, especially for single-page applications. Over the years, React has evolved and expanded its capabilities, becoming a preferred choice for mobile app development. This article will explore why React.js is an excellent choice for the Best Mobile App development company in Noida.
Visit Us For Information: https://www.linkedin.com/pulse/what-makes-reactjs-stand-out-mobile-app-development-rajesh-rai-pihvf/
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!
How Can Hiring A Mobile App Development Company Help Your Business Grow?ToXSL Technologies
ToXSL Technologies is an award-winning Mobile App Development Company in Dubai that helps businesses reshape their digital possibilities with custom app services. As a top app development company in Dubai, we offer highly engaging iOS & Android app solutions. https://rb.gy/necdnt
How Can Hiring A Mobile App Development Company Help Your Business Grow?
Secret unit testing tools
1. The secret unit testing tools no one has
ever told you about
Dror Helper | blog.drorhelper.com | @dhelper
Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
2. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
About.ME
Consultant @CodeValue
Developing software (professionally) since 2002
Mocking code since 2008
Clean coder & Test Driven Developer
OzCode (a.k.a “Magical debugging”) Evangelist
Blogger: http://blog.drorhelper.com
3. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
But it was not always like that
1st Attempt Failed!
2nd Attempt Failed!!!
New job +
UT + Mentor
Success
4. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Why should I care about tools?
5. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Background: unit testing tools
6. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Well known unit testing tools
Build Failed!
7. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Server
Dev Machine
Source ControlBuild Server
Test Runner
Code
Coverage
Build Agent
Unit Testing
Framework
Isolation
Framework
?
8. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
xUnit test framework
Test Suite
Fixture
Test Case
Test Case
Test Case
Test Case
Test Case
Fixture
Test Case
Test Case
Fixture
Test Case
Test Case
Test Case
public class BeforeAndAfter {
[SetUp]
public void Initialize() {
}
[TearDown]
public void Cleanup() {
}
[Test]
public void test1() {
}
[Test]
public void test2() {
}
}
9. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Mocking Frameworks
Unit test
Code under test
DependencyFake object(s)
10. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
What Mocking framework can do for you?
• Create Fake objects
• Set behavior on fake objects
• Verify method was called
• And more...
11. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
[Test]
public void Calculate_ReturnTwoValidNumbers_ServerCalled()
{
IDataAccess fakeDataAccess = A.Fake<IDataAccess>();
A.CallTo(() => fakeDataAccess.GetData(A<string>.Ignored))
.Returns(new Tuple<int, int>(2, 3));
var fakeCalculatorService = A.Fake<ICalculatorService>();
var cut = new DistrobutedCalculator(fakeDataAccess, fakeCalculatorService);
cut.Calculate();
A.CallTo(() => fakeCalculatorService.Add(2,3)).MustHaveHappened();
}
12. These tools do not help us write good
unit tests
In fact, sometimes
they prevent us from
writing good unit tests!
13. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Definition: unit tests
Automated piece of code that invokes
a unit of work in the system and then
checks a single assumption about the
behavior of that unit of work
[Roy Osherove, The Art Of Unit Testing]
14. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Unit test structure
[Test]
public void MyTest()
{
}
15. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
No guidance Fragile tests Stop unit testing
16. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
What about AAA?
[Test]
public async void GetUserFromUrl() {
var clientFake = A.Fake<IJsonClient>();
A.CallTo(() => clientFake.HttpGetUncompressedAsync(A<string>.Ignored))
.Returns(Task.FromResult(JsonResult));
var userRepository = new UserRepository(clientFake);
var user = await userRepository.GetUser(11361);
var expected = new User {
Id=11361, DisplayName = "Dror Helper", ImageUrl=DefaultAvatar, Reputation=13904
};
Assert.That(user, Is.EqualTo(expected));
}
Arrange
Act
Assert
17. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Problem solved? Hardly!
• Where to start?
• How to test existing code?
• What about test structure?
• Integration tests vs. unit tests
• What is a “unit of work”?
18. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Test setup (Arrange)
19. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Arrange issues
[TestMethod]
public async Task LoadUser_ReputationStaysTheSame_ReputationTrendSame() {
var user1 = new User {ImageUrl = "http://dummy.jpg", Reputation = 10};
var user2 = new User {ImageUrl = "http://dummy.jpg", Reputation = 10};
var fakeUserRepository = new FakeUserRepository(new[] { user1, user2 });
var viewModel = await InvokeAsync(() => new UserDetailsViewModel(fakeUserRepository));
await viewModel.LoadUser();
await viewModel.LoadUser();
var result = await InvokeAsync(() => ((SolidColorBrush)viewModel.ReputationTrend).Color);
Assert.AreEqual(Colors.White, result);
}
20. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Solution: Setup/TearDown
private UserDetailsViewModel _viewModel;
[TestInitialize]
public async Task InitilizeUserViewModel() {
var user1 = new User { ImageUrl = "http://dummy.jpg", Reputation = 10 };
var user2 = new User { ImageUrl = "http://dummy.jpg", Reputation = 10 };
var fakeUserRepository = new FakeUserRepository(new[] { user1, user2 });
_viewModel = await InvokeAsync(() => new UserDetailsViewModel(fakeUserRepository));
}
[TestMethod]
public async Task LoadUser_ReputationStaysTheSame_ReputationTrendSame() {
await _viewModel.LoadUser();
await _viewModel.LoadUser();
var result = InvokeAsync(() => ((SolidColorBrush)_viewModel.ReputationTrend).Color);
Assert.AreEqual(Colors.White, result);
}
21. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Why you shouldn’t use Setup in unit tests
private UserDetailsViewModel _viewModel;
[TestInitialize]
public async Task InitilizeUserViewModel() {
var user1 = new User { ImageUrl = "http://dummy.jpg", Reputation = 10 };
var user2 = new User { ImageUrl = "http://dummy.jpg", Reputation = 10 };
var fakeUserRepository = new FakeUserRepository(new[] { user1, user2 });
_viewModel = await InvokeAsync(() => new UserDetailsViewModel(fakeUserRepository));
}
[TestMethod]
public async Task LoadUser_ReputationStaysTheSame_ReputationTrendSame() {
await _viewModel.LoadUser();
await _viewModel.LoadUser();
var result = InvokeAsync(() => ((SolidColorBrush)_viewModel.ReputationTrend).Color);
Assert.AreEqual(Colors.White, result);
}
22. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Solution: Extract to methods
[TestMethod]
public async Task LoadUser_ReputationStaysTheSame_ReputationTrendSame() {
var user1 = CreateUser(reputation: 10);
var user2 = CreateUser(reputation: 10);
var fakeUserRepository = new FakeUserRepository(new[] { user1, user2 });
var viewModel = await InvokeAsync(() => new UserDetailsViewModel(fakeUserRepository));
await viewModel.LoadUser();
await viewModel.LoadUser();
var result = await InvokeAsync(() => ((SolidColorBrush)viewModel.ReputationTrend).Color);
Assert.AreEqual(Colors.White, result);
}
23. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Over extraction
[TestMethod]
public async Task LoadUser_ReputationStaysTheSame() {
var viewModel = InitializeSystem(10, 10);
await viewModel.LoadUser();
await viewModel.LoadUser();
CheckColor(Colors.White, viewModel);
}
24. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
The problem with factories
private User CreateUser(int reputation) {
return new User {
ImageUrl = "http://dummy.jpg",
Reputation = reputation
};
}
private User CreateUser(int reputation, string imageUrl) {
return new User
{
ImageUrl = imageUrl,
Reputation = reputation
};
}
25. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Builder pattern
class UserBuilder
{
private int _id, _reputation;
private string _displayName, _imageUrl;
public UserBuilder() {
_id = 1;
_displayName = "dummy";
_imageUrl = "http://dummy.jpg";
}
User Build() {
return new User {
Id = _id, DisplayName = _displayName, ImageUrl = _imageUrl, Reputation = _reputation
};
}
}
26. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Builder pattern (cont.)
class UserBuilder
{
...
public UserBuilder WithName(string displayName) {
_displayName = displayName;
return this;
}
public UserBuilder WithReputation(int reputation) {
_reputation = reputation;
return this;
}
...
}
var user1 = new UserBuilder()
.WithReputation(10)
.Build();
27. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Tool: AutoMocking Containers
Test Container SUT
http://blog.ploeh.dk/2013/03/11/auto-mocking-container/
New()
Configure
CreateCreate SUT
Act
28. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Automocking with AutoFixture
[Fact]
public void YellIfTouchHotIron() {
var fixture = new Fixture().Customize(new AutoFakeItEasyCustomization());
Fake<IMouth> fakeMouth = fixture.Freeze<Fake<IMouth>>();
Fake<IHand> fakeHand = fixture.Freeze<Fake<IHand>>();
A.CallTo(() => fakeHand.FakedObject.TouchIron(A<Iron>._)).Throws<BurnException>();
var brain = fixture.Create<Brain>();
brain.TouchIron(new Iron {IsHot = true});
A.CallTo(() => fakeMouth.FakedObject.Yell()).MustHaveHappened();
}
29. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Automocking with Typemock Isolator
[TestMethod]
public void FakeAllDependencies_ChangeBehavior()
{
var real = Isolate.Fake.Dependencies<ClassUnderTest>();
var fake = Isolate.GetFake<Dependency>(real);
Isolate.WhenCalled(() => fake.Multiplier).WillReturn(2);
var result = real.Calculate(1, 2);
Assert.AreEqual(6, result);
}
30. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Problem: Complex inputs
• Big objects
• Deep objects
• Need for precision
• Lack of knowledge
31. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Solution: use trivial inputs
Sometimes missing the point
Not always enough for “real test”
32. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Solution: Serialization
Supported in most programming languages (XML, json).
• Need development testing delayed
• Production code change indefinitely delayed
33. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Tool: Export using OzCode
34. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Verification (Assert)
35. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Can you spot the problem?
[TestMethod]
public void PerformSomeActionReturns42()
{
var myClass = ...
bool initOk = myClass.Initialize();
var result = myClass.PerformSomeAction();
Assert.IsTrue(initOk);
Assert.AreEqual(42, result);
}
http://stackoverflow.com/q/26400537/11361
36. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Can you spot the problem?
[TestMethod]
public void TestPasswordComplexity()
{
var result = _UserManager.ChangePasswordAsync(_TestUser.Id, "Password123!", "1!").Result; //Changes the password.
Assert.IsFalse(result.Succeeded);
result = _UserManager.ChangePasswordAsync(_TestUser.Id, "Password123!", "123456789").Result; //Changes the password.
Assert.IsFalse(result.Succeeded);
result = _UserManager.ChangePasswordAsync(_TestUser.Id, "Password123!", "123456789!").Result; //Changes the password.
Assert.IsFalse(result.Succeeded);
result = _UserManager.ChangePasswordAsync(_TestUser.Id, "Password123!", "abcdefghijk").Result; //Changes the password.
Assert.IsFalse(result.Succeeded);
result = _UserManager.ChangePasswordAsync(_TestUser.Id, "Password123!", "abcdefghijK1!").Result; //Changes the password.
Assert.IsTrue(result.Succeeded);
}
http://stackoverflow.com/q/26400537/11361
37. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
How many Assert(s) per test?
One Assert Per Test!
Two Assert == Two Tests Usually ???
”(…the Code is more)
what you'd call guidelines
than actual rules”
38. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Sometimes multiple asserts make sense
[TestMethod]
public void CompareTwoAsserts()
{
var actual = GetNextMessage();
Assert.AreEqual(1, actual.Id);
Assert.AreEqual("str-1", actual.Content);
}
39. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
public class AssertAll
{
public static void Execute(params Action[] assertionsToRun)
{
var errorMessages = new List<exception>();
foreach (var action in assertionsToRun)
{
try
{
action.Invoke();
}
catch (Exception exc)
{
errorMessages.Add(exc);
}
}
if(errorMessages.Any())
{
var separator = string.Format("{0}{0}", Environment.NewLine);
string errorMessage = string.Join(separator, errorMessages);
Assert.Fail(string.Format("The following conditions failed:{0}{1}", Environment.NewLine, errorMessage));
}
}
}
http://blog.drorhelper.com/2011/02/multiple-asserts-done-right.html
40. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Using AssertAll
[TestMethod]
public void CompareTwoAsserts()
{
var actual = CreateMessage();
AssertAll.Execute(
() => Assert.AreEqual(1, actual.Id),
() => Assert.AreEqual("str-1", actual.Content);
}
41. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Some frameworks are catching up!
https://github.com/nunit/docs/wiki/Multiple-Asserts-Spec
42. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Ever had issues choosing the right Assert?
• IsTrue vs. AreEqual
• Parameter ordering confusion
• StringAssert/CollectionAssert
It’s all about proper error messages
43. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Tool: 3rd party assertion libraries
Better error messages
Readability
Multiple asserts*
×Additional dependency
×Limited UT framework support
×System.Object “SPAMED” by extension messages
44. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Shouldly
[Fact]
public void AddTest()
{
var calculator = new Calculator();
var result = calculator.Add(2, 3);
Assert.Equal(6, result);
}
[Fact]
public void AddTest_Shouldly()
{
var calculator = new Calculator();
var result = calculator.Add(2, 3);
result.ShouldBe(6);
}
https://github.com/shouldly/shouldly
Shouldly.ShouldAssertException
result
should be
6
but was
5
Xunit.Sdk.EqualException
Assert.Equal() Failure
Expected: 6
Actual: 5
45. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Shouldly
[Fact]
public void GetDivisorsTest()
{
var calculator = new Calculator();
var result = calculator.GetDivisors(20);
Assert.Equal(new[] {2,3,5,7}, result);
}
[Fact]
public void GetDivisorsTest_Shouldly()
{
var calculator = new Calculator();
var result = calculator.GetDivisors(20);
result.ShouldBe(new[] { 2, 3, 5, 7 });
}
https://github.com/shouldly/shouldly
Shouldly.ShouldAssertException
result
should be
[2, 3, 5, 7]
but was
[2, 4, 5, 10]
difference
[2, *4*, 5, *10*]
Xunit.Sdk.EqualException
Assert.Equal() Failure
Expected: Int32[] [2, 3, 5, 7]
Actual: WhereEnumerableIterator<Int32> [2, 4, 5, 10]
46. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
FluentAssertions
[Fact]
public void CompareTwoObjects()
{
var customer1 = new Customer("cust-1", "John Doe");
var customer2 = new Customer("cust-2", "John Doe");
customer1.ShouldBeEquivalentTo(customer2,
o => o.Excluding(customer => customer.Id));
}
http://www.fluentassertions.com/
47. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
AssertHelper
[Test]
public void CheckCompare()
{
var myClass = new MyClass();
Expect.That(() => myClass.ReturnFive() == 10);
}
[Test]
public void CheckTrue()
{
var myClass = new MyClass();
Expect.That(() => myClass.ReturnFalse() == true);
}
[Test]
public void StringStartsWith() {
var s1 = "1234567890";
Expect.That(() => s1.StartsWith("456"));
}
[Test]
public void CollectionContains()
{
var c1 = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
Expect.That(() => c1.Contains(41));
}
https://github.com/dhelper/AssertHelper
49. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Test structure issues
• What to call the test?
• AAA is not mandatory
• What should I test?
• How to avoid unreadable, complicated tests?
- Unit testing framework provide no structure
50. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
The BDD approach
Step
Definitions
51. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Specifications == focused test
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario: Add two numbers
Given I have entered 50 into the calculator
And I have entered 70 into the calculator
When I press add
Then the result should be 120 on the screen
52. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
BDD Example: SpecFlow
http://www.specflow.org/
53. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Tool: BDDfy
[TestClass]
public class CardHasBeenDisabled {
private Card _card;
private Atm _subject;
void GivenTheCardIsDisabled() {
_card = new Card(false, 100);
_subject = new Atm(100);
}
void WhenTheAccountHolderRequestsMoney() {
_subject.RequestMoney(_card, 20);
}
void ThenTheAtmShouldRetainTheCard() {
Assert.IsTrue(_subject.CardIsRetained);
}
void AndTheAtmShouldSayTheCardHasBeenRetained() {
Assert.AreEqual(DisplayMessage.CardIsRetained, _subject.Message);
}
[TestMethod]
public void Execute()
{
this.BDDfy();
}
}
55. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Everybody needs a CI server
Unit tests without a CI server are a waste of time
- if you're running all of the tests all of the time
locally you're a better man then I am
56. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Tool: Continuous testing
DotCover
Typemock Runner
nCrunch
57. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
The right tools will help you write good tests
Arrange
Builder Pattern
AutoMocking
Containers
Export
Assert
Shouldly
FluentAssertions
AssertHelper
Test
Structure
BDDfy
Continuous
Testing
Typemock
Runner
DotCover
nCrunch
58. Join the conversation on Twitter: @DevWeek // #DW2016 // #DevWeek
Thank you
Dror Helper | @dhelper | http://blog.drorhelper.com
Editor's Notes
2003 – first attempt at unit testing
2003 + Week – Failed!
2005 – Leave job
2006 – 2nd attempt at Unit testing
Failed
Find job + UT + Mentor
Success
Individuals and interactions over processes and tools
Automated
Test Unit of Work
Check Single Assumption
Duplicate code
Complex system initialization
Constructor updated
Create instances of SUT
Decouples SUT from constructor
Usually use DI/IoC container
- Two asserts – no idea what caused the failure
- Test is testing several things
Explain about Using Object.Equals & Object.ToString
Demo?
- Two asserts – no idea what caused the failure
Test is testing several things
Left or right? InstanceOf MSTest vs. NUnit