This session showcases several unit testing libraries and frameworks that make it possible to write the most-effective unit and integration tests. It also highlights some of the most underused features of JUnit, including Theories, parameterized tests, and Hamcrest matchers.
Among the libraries it covers: Unitils, Spring Test, DbUnit, XMLUnit, Dumpster, Mockito, and JBehave. The presentation supplies code examples and discusses TDD/BDD best practices.
Update:
Video available from Oredev: vimeo.com/53147485
Metaprogramming is the dirty little secret behind the success of many Java frameworks such as Spring and Struts2, and constitutes the backbone of many of the most fundamental APIs across the JEE technology stack. This session aims introduce the topic and highlight, with code examples, the different mechanisms and techniques to take advantage of this underused feature of the Java Programming Language.
This session will adopt a learn-by-example approach that combines the philosophy and theory behind metaprogramming with concrete code examples. The audience will be walked real-life scenarios to highlight the benefits of this technique such as minimizing the number of lines of code, reduced development time, and greater flexibility, etc… Design patterns, and best practices will be picked up along the way.
No previous knowledge or exposure to the topic is required, but an intermediate understanding of Java SE is expected.
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...Jorge Hidalgo
Slides from JavaOne 2014 conference session CON2013
The Java compiler and annotation processors are powerful tools within the Java platform, and both, combined, unleash great power in developers’ hands, as this session illustrates. Triggered during the Java compilation process, APs can be used to generate new sources and configuration from metadata present in the class source. Why expend time creating a BeanInfo class or dealing with boring XML configuration files when you can have them easily created at compilation time? Moreover, APs are compatible with IDEs and build tools, and hence they are virtually everywhere your Java code is. Unleash the power of annotation processors, and let them do the hard work for you
In this core java training session, you will learn Elements of Java programming. Topics covered in this session are:
• Quick review of some important concepts from last class
• History of Java
• JDK and JRE
• Byte Code and JVM (Java Virtual Machine)
• Platform Independence
• Principles of Object Oriented Programming
• Writing your first Java Application
• Elements of Java programming language
• Built in Data Types
• Conditional Statements
• Loops
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
Update:
Video available from Oredev: vimeo.com/53147485
Metaprogramming is the dirty little secret behind the success of many Java frameworks such as Spring and Struts2, and constitutes the backbone of many of the most fundamental APIs across the JEE technology stack. This session aims introduce the topic and highlight, with code examples, the different mechanisms and techniques to take advantage of this underused feature of the Java Programming Language.
This session will adopt a learn-by-example approach that combines the philosophy and theory behind metaprogramming with concrete code examples. The audience will be walked real-life scenarios to highlight the benefits of this technique such as minimizing the number of lines of code, reduced development time, and greater flexibility, etc… Design patterns, and best practices will be picked up along the way.
No previous knowledge or exposure to the topic is required, but an intermediate understanding of Java SE is expected.
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...Jorge Hidalgo
Slides from JavaOne 2014 conference session CON2013
The Java compiler and annotation processors are powerful tools within the Java platform, and both, combined, unleash great power in developers’ hands, as this session illustrates. Triggered during the Java compilation process, APs can be used to generate new sources and configuration from metadata present in the class source. Why expend time creating a BeanInfo class or dealing with boring XML configuration files when you can have them easily created at compilation time? Moreover, APs are compatible with IDEs and build tools, and hence they are virtually everywhere your Java code is. Unleash the power of annotation processors, and let them do the hard work for you
In this core java training session, you will learn Elements of Java programming. Topics covered in this session are:
• Quick review of some important concepts from last class
• History of Java
• JDK and JRE
• Byte Code and JVM (Java Virtual Machine)
• Platform Independence
• Principles of Object Oriented Programming
• Writing your first Java Application
• Elements of Java programming language
• Built in Data Types
• Conditional Statements
• Loops
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
Crack your Java interview by knowing all the questions that your interviewer may ask. Brush up your knowledge with this superb set of Java interview questions & answers prepared by BestOnlineTrainers
Java is a general-purpose, object-oriented computer programming language that offers special features that allow programs to take advantage of the power and flexibility of the Internet.
These question are the basic questions for Interview based on Java language. These questions are able to crack the interview based on java language
Learn more at blog : --
https://solutionbyexpert.blogspot.com/2020/08/become-expert-secret-of-success-ii.html
#coding
#coding development skill program
#java
In this core java training session, you will learn get introduction to Java. Topics covered in this session are:
• History of Java – A Programmer’s Perspective
• Salient Features of Java
• Major Java Editions
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
Using xUnit as a Swiss-Aarmy Testing ToolkitChris Oldwood
Modern Unit Testing practices act as a conduit for improved software designs that are more amenable to change and can be easily backed by automation for fast feedback on quality assurance. The necessity of reducing external dependencies forces us to design our modules with minimum coupling which can then be leveraged both at the module, component and subsystem levels in our testing. As we start to integrate our units into larger blocks and interface our resulting components with external systems we find ourselves switching nomenclature as we progress from Unit to Integration testing. But is a change in mindset and tooling really required?
The xUnit testing framework is commonly perceived as an aid to Unit Testing but the constraints that it imposes on the architecture mean that it is an excellent mechanism for invoking arbitrary code in a restricted context. Tests can be partitioned by categorisation at the test and fixture level and through physical packaging leading to a flexible test code structure. Throw in its huge popularity and you have a simplified learning curve for expressing more that just unit tests.
Using scenarios from his current system Chris aims to show how you can use a similar format and tooling for unit, component and integration level tests; albeit with a few liberties taken to work around the inherent differences with each methodology.
Crack your Java interview by knowing all the questions that your interviewer may ask. Brush up your knowledge with this superb set of Java interview questions & answers prepared by BestOnlineTrainers
Java is a general-purpose, object-oriented computer programming language that offers special features that allow programs to take advantage of the power and flexibility of the Internet.
These question are the basic questions for Interview based on Java language. These questions are able to crack the interview based on java language
Learn more at blog : --
https://solutionbyexpert.blogspot.com/2020/08/become-expert-secret-of-success-ii.html
#coding
#coding development skill program
#java
In this core java training session, you will learn get introduction to Java. Topics covered in this session are:
• History of Java – A Programmer’s Perspective
• Salient Features of Java
• Major Java Editions
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
Using xUnit as a Swiss-Aarmy Testing ToolkitChris Oldwood
Modern Unit Testing practices act as a conduit for improved software designs that are more amenable to change and can be easily backed by automation for fast feedback on quality assurance. The necessity of reducing external dependencies forces us to design our modules with minimum coupling which can then be leveraged both at the module, component and subsystem levels in our testing. As we start to integrate our units into larger blocks and interface our resulting components with external systems we find ourselves switching nomenclature as we progress from Unit to Integration testing. But is a change in mindset and tooling really required?
The xUnit testing framework is commonly perceived as an aid to Unit Testing but the constraints that it imposes on the architecture mean that it is an excellent mechanism for invoking arbitrary code in a restricted context. Tests can be partitioned by categorisation at the test and fixture level and through physical packaging leading to a flexible test code structure. Throw in its huge popularity and you have a simplified learning curve for expressing more that just unit tests.
Using scenarios from his current system Chris aims to show how you can use a similar format and tooling for unit, component and integration level tests; albeit with a few liberties taken to work around the inherent differences with each methodology.
Why another test framework in dotnet ? In this presentation, I will try to convince you to switch to xUnit. Main concepts & extensibility points are covered here. Happy testing !
AI and Machine Learning Demystified by Carol Smith at Midwest UX 2017Carol Smith
What is machine learning? Is UX relevant in the age of artificial intelligence (AI)? How can I take advantage of cognitive computing? Get answers to these questions and learn about the implications for your work in this session. Carol will help you understand at a basic level how these systems are built and what is required to get insights from them. Carol will present examples of how machine learning is already being used and explore the ethical challenges inherent in creating AI. You will walk away with an awareness of the weaknesses of AI and the knowledge of how these systems work.
The Yahoo UI (YUI) Library is well known for its excellent documentation. One of its secrets is YUI Doc, a Python application used at build time to generate API documentation for JavaScript code.
But is YUI Doc really better than JS Doc Toolkit -- an elder application, written in JavaScript, that also generates API documentation. When should you choose one over the other? Which is the better choice for your project?
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Ondřej Machulda
Annotated slides from Berlin PHP Usergroup Meetup, 4th April 2017.
---
Not only unit tests but also end-to-end tests in real browser are important part of test automation and test pyramid. So let's have a look how to easily write and run Selenium functional tests using PHPUnit and Steward.
Miller Columns (used in iPhone and Mac Finder) are an elegant way of displaying and navigating a tree. This talk describes a JavaScript implementation of Miller Columns, and why JavaScript needs modules and a standard library.
Creating Realistic Unit Tests with TestcontainersPaul Balogh
** Recording available at https://www.youtube.com/watch?v=sX4s1HqPZcw **
Sometimes, unit tests with mocked services just aren't enough. We'd like to be able to run repeatable tests against the real thing without fear of corrupting data or affecting others.
With Testcontainers, there is no need for mocks or complicated environment configurations. We can define our target environment in code and then run our tests against ephemeral containers. Java developers have had this ability for several years, but now Go developers have this similar ability!
Enjoy the discussion and demonstration of this open-source project created by the folks at AtomicJar, recently acquired by Docker.
Dead-Simple Async Control Flow with CoroutinesTravis Kaufman
Coroutines are extremely powerful constructs that make writing asynchronous code dead simple. In this talk, we'll go over how we can implement coroutines in ES2015 using generators and promises, as well as tools and libraries that allow you to leverage coroutines today. We'll also walk through some sample use cases that showcase the power of coroutines.
Example code is available at https://github.com/traviskaufman/co-talk-examples
Talk at RubyKaigi 2015.
Plugin architecture is known as a technique that brings extensibility to a program. Ruby has good language features for plugins. RubyGems.org is an excellent platform for plugin distribution. However, creating plugin architecture is not as easy as writing code without it: plugin loader, packaging, loosely-coupled API, and performance. Loading two versions of a gem is a unsolved challenge that is solved in Java on the other hand.
I have designed some open-source software such as Fluentd and Embulk. They provide most of functions by plugins. I will talk about their plugin-based architecture.
How to test infrastructure code: automated testing for Terraform, Kubernetes,...Yevgeniy Brikman
This talk is a step-by-step, live-coding class on how to write automated tests for infrastructure code, including the code you write for use with tools such as Terraform, Kubernetes, Docker, and Packer. Topics covered include unit tests, integration tests, end-to-end tests, test parallelism, retries, error handling, static analysis, and more.
"What is the future of Java?" is a hard question to tackle. It should be given serious thought whether you are a veteran with a lot invested, a noob trying to figure out what is worthwhile, or just a self-proclaimed Java hater.
In this session, Abdelmonaim will start by introducing the concept of Programming Languages Darwinism to answer what really determines the fate of a technology. A series of questions will be addressed to achieve some clarity such as: How is the paradigm shifting? Why do functional programming languages matter? What is the state of mobile Java? How does the patent wars affect Java? What about the recent security threats? And many more... Expect this session to be controversial, emotionally-charged, and very opinionated.
You spend your precious time building the perfect application. You do everything right. You carefully craft every piece of code and rigorously follow the best practices and design patterns, you apply the most successful methodologies software engineering has to offer with discipline, and you pay attention to the most minuscule of details to produce the best user experience possible. It all pays off eventually, and you end up with a beautiful code base that is not only reliable but also performs well. You proudly watch your baby grow, as new users come in bringing more traffic your way and craving new features. You keep them happy and they keep coming back. One morning, you wake up to servers crashing under load, and data stores failing to keep up with all the demand. You panic. You throw in more hardware and try optimize, but the hungry crowd that was once your happy user base catches up to you. Your success is slipping through your fingers. You find yourself stuck between having to rewrite the whole application and a hard place. It's frustrating, dreadful, and painful to say the least. Don't be that guy! Save your soul before it's too late, and come to learn how to build, deploy, and maintain enterprise-grade Java applications that scale from day one. Topics covered include: parallelism, load distribution, state management, caching, big data, asynchronous processing, and static content delivery. Leveraging cloud computing, scaling teams and DevOps will also be discuss. P.S. This session is more technical than you might think.
http://jaxconf.com/sessions/economies-scaling-software
The rise of Mobile and the diversity its technologies make exposing a RESTfull API the most crucial capability of any application and the key to its success. In the absence of widely adopted best practices and well-defined conventions, designing such an API is nothing but trivial. This presentation introduces the fundamentals of REST architecture, and discusses the principles of RESTfull design. Among the topics covered: resource modeling (URI design, and HTTP verbs/status code canonical usage), multiple representation support, testing, cache control, security (Http and OAuth), and API versioning. HATEOAS and REST maturity model are also discussed. No prior knowledge REST is required.
The rise of NoSQL is characterized with confusion and ambiguity; very much like any fast-emerging organic movement in the absence of well-defined standards and adequate software solutions. Whether you are a developer or an architect, many questions come to mind when faced with the decision of where your data should be stored and how it should be managed. The following are some of these questions: What does the rise of all these NoSQL technologies mean to my enterprise? What is NoSQL to begin with? Does it mean "No SQL"? Could this be just another fad? Is it a good idea to bet the future of my enterprise on these new exotic technologies and simply abandon proven mature Relational DataBase Management Systems (RDBMS)? How scalable is scalable? Assuming that I am sold, how do I choose the one that fit my needs best? Is there a middle ground somewhere? What is this Polyglot Persistence I hear about? The answers to these questions and many more is the subject of this talk along with a survey of the most popular of NoSQL technologies. Be there or be square.
JavaOne 2010: Building enterprise web applications with spring 3
Spring is an open source, lightweight Java framework that has become the de facto standard of Java enterprise application development. This session will adopt a learn-by-example approach that combines the philosophy and theory behind Spring with concrete code examples. You'll be walked through building a full-featured Spring 3.0 enterprise Web application end to end. The basics of the Spring framework, design patterns, and best practices will be picked up along the way. Topic to be covered topics include: Dependency Injection, Spring MVC, Spring DAO, Spring ORM, Spring AOP, and Spring Security. This session is intended for developers at any level who are interested in writing Spring or Spring MVC Web applications.
Introduction To Building Enterprise Web Application With Spring MvcAbdelmonaim Remani
This the perfect introduction for people who have absolutely no experience with the Spring framework. The session adopts a learn-by-example approach and takes the form of a practical hands-on-lab with a lot of live coding. Attendees will be presented with a sample web application and various use-case scenarios, they will build an actual Spring MVC web application backed by a MySQL database end-to-end, They will Test it, and deploy it on an Apache TomCat web server. The basics of the Spring framework, design patterns, and best practices will be picked up by example along the way. Covered topics include: Inversion of Control (Dependency Injection), Spring MVC, Spring DAO, Spring ORM (iBatis), Aspect Oriented Programming in Spring, Basic Web Security, and the Mail API. Bring your laptop! Prerequisites: Familiarity with the architecture of Java web application and its technologies (Servlets, JSP, Java EL, JSTL, etc... )
Adobe Flex is the leading techonology for the development and deployment of cross platform Rich Internet applications. This session is an introduction to building RIA with Adobe Flex and AIR.
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Maruthi Prithivirajan, Head of ASEAN & IN Solution Architecture, Neo4j
Get an inside look at the latest Neo4j innovations that enable relationship-driven intelligence at scale. Learn more about the newest cloud integrations and product enhancements that make Neo4j an essential choice for developers building apps with interconnected data and generative AI.
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
3. Who Am I? Software Engineer Particularly interested in technology evangelism and enterprise software development and architecture President and Founder of a number of organizations The Chico Java User Group The Silicon Valley Spring User Group LinkedIn http://www.linkedin.com/in/polymathiccoder Twitter http://twitter.com/polymathiccoder
4. Warning This presentation is very long and covers a lot of material
5. Outline Part I: Unit Testing Vanilla Is Boring Stay PUT All Those Theories All that CRUD Fakery Mockery Part II: TDD Part III: BDD Part IV: Tools Cross-cutting Story Time When I tell you a story Libra-palooza When I tell you about the coolness of some libraries
8. What is Unit Testing? What is a Unit? The smallest piece of code that Can be isolated Is testable Targets specific functionality Hmm… Let’s see… A statement? A branch? A method? A basis path within a method Defined by the flow of execution from the start of a method to its exit How many a method has depends on cyclomatic complexity N decisions = 2^N basis possible paths Infinite paths
9. What is Unit Testing? What kind of Testing? The verification of Intent The answer to the question: Does the code do what the developer intended for it to do? Reliability The answer to the question: Can I depend or build upon it?
10. xUnitand xUnit Concepts xUnit is any Unit Testing framework Based on SUnit, a Smalltalk project, design by Kent Beck Concepts Test fixtures Test case Assertions Test execution Test suites
11. Good Test Data Include Valid data Invalid data / Boundary conditions Different Formats Different Order Wide Range Null data Error Conditions
12. Good Tests Cover all possible basis paths Have Self-Describing Names Are Cohesive Independent of each other Reliable Repeatable Fast
13. The Most Opinionated Slide! Lame Excuses! Waste of time Nuisance Distraction from real work Hard to maintain Blah… Blah… Blah… 3 bullet points Quit being lazy! Do yourself a favor and get with the program! You are attitude is the fastest way to get inducted to the Hall of Lame
14. xUnit Frameworks in Java The most popular frameworks JUnit A port of the original SUnit to Java by Erich Gamma and Kent Beck http://junit.org/ TestNG http://testng.org/ This presentation focuses on JUnit
19. The Code QuadraticEquation.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/main/java/com/polymathiccoder/talk/xunit/domain/QuadraticEquation.java
21. The Quadratic Equation 3 possible data combinations that must be tested Coefficients yielding a negative discriminant Coefficients yielding a discriminant equals to zero Coefficients yielding a positive discriminant 3 different outcomes The equation has no real solution The equation has one real solution The equation has two real solution 3 different basis paths
22. JUnit Annotations Test suites @RunWith Naming Convention <Class Name>Test Test fixtures Set Up @Before @BeforeClass Tear Down @After @AfterClass
24. Testing Private Methods Don’t test them Relax the visibility to make the code testable Annotate Google Guava’s @VisibleForTesting Use a nested test class Use reflection
25. The Code QuadraticEquationTest.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/test/java/com/polymathiccoder/talk/xunit/domain/QuadraticEquationTest.java
28. Stay PUT Parameterized or Data-Driven Unit Tests Annotations @RunWith(Parameterized.class) To provide the parameters to be supplied via constructor injection @Parameters public static Collection<Object[]> parameters() @Parameter Object[] parameters
30. Libra-palooza Hamcrest Matchers Library Included in JUnit since 4.4 http://code.google.com/p/hamcrest/ Unitils Reflection-based assertions, etc… http://unitils.org Fest Fluent Assertion, etc… http://code.google.com/p/fest/
31. The Code QuadraticEquationParameterizedTest.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/test/java/com/polymathiccoder/talk/xunit/domain/QuadraticEquationParameterizedTest.java
36. The Code RiverCrossing.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/main/java/com/polymathiccoder/talk/xunit/domain/RiverCrossing.java
38. The River Crossing Puzzle 9 possible combinations that must be tested Wolf and Cabbage left behind Cabbage and Wolf left behind Wolf and Goat left behind Goat and Wolf left behind Goat and Cabbage left behind Cabbage and Goat left behind Wolf and Wolf left behind Goat and Goat left behind Cabbage and Cabbage left behind 3 different outcomes One gets transported to the other side One of two left behind eats the other Error trying to transport more than one 18 basis paths
39. The River Crossing Puzzle 9 possible combinations that must be tested and 3 basis paths yielding 3 different outcomes 9 x 3 = 18 Vanilla Tests 3 x 3 = 9 Parameterized Tests 1 x 3 = 3 Theories
40. Theories Running tests with every possible combination of data points Annotations @RunWith(Theories.class) To provide the parameters to be supplied via constructor injection @DataPoints public static Object[] objects @DataPoint public static object
41. Assumptions and Rules Assumptions assumeThat, assumeTrue, assumeNotNull, etc… Rules Allowing for alterations in how test methods are run and reported @Rule Injects public fields of type MethodRule ErrorCollector ExpectedException ExternalResource TemporaryFolder TestName TestWatchman Timeout Verifier
42. The Code RiverCrossingTheory.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/test/java/com/polymathiccoder/talk/xunit/domain/RiverCrossingTheory.java
46. The Employee Database Simple Domain Object Employee Id - Number Name - Text Data-Access Object Interface EmployeeDao – CRUD operations Two implementations EmployeeCollectionImpl – A Java Collection implementation EmployeeDaoDbImpl – A JDBC implementation
47. The Code Employee.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/main/java/com/polymathiccoder/talk/xunit/domain/Employee.java EmployeeDao.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/main/java/com/polymathiccoder/talk/xunit/repository/EmployeeDao.java
48. The Code EmployeeDaoCollectionImpl.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/main/java/com/polymathiccoder/talk/xunit/repository/EmployeeDaoCollectionImpl.java EmployeeDaoDbImpl.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/main/java/com/polymathiccoder/talk/xunit/repository/EmployeeDaoDbImpl.java
50. Testing Persistence Code Data Define the initial state of data before each test Define the expected state of data after each test Ensure that the data is in a known state before you run the test Run the test Compare against the expected dataset to determine the success or failure of the test Clean after yourself if necessary
51. Testing Persistence Code Notes of Java Collections An Immutable/un-modifiable collection is NOT necessarily a collection of Immutable/un-modifiable objects Notes on testing database code Use a dedicated database instance for testing per user Use an in-memory database if you can HSQLDB H2 Etc…
52. Custom Hamcrest Matches Hamcrest Matches Write your own custom type-safe matcher One asserting per unit test Generating a readable description to be included in test failure messages https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/test/java/com/polymathiccoder/talk/xunit/domain/matcher/EmployeeIsEqual.java
55. The Code EmployeeDaoCollectionImplTest.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/test/java/com/polymathiccoder/talk/xunit/repository/EmployeeDaoCollectionImplTest.java
57. Libra-palooza DBUnit A JUnit extension used to unit test database code Export/Import data to and from XML Initialize database into a known state Verify the state of the database against an expected state http://www.dbunit.org/
59. The Code EmployeeDaoDbImplTest.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/test/java/com/polymathiccoder/talk/xunit/repository/EmployeeDaoDbImplTest.java
62. The Mailer Simple email sender that uses the JavaMailAPI Fakes Dumpster A fake SMTP server to be used in unit tests http://quintanasoft.com/dumbster/ ActiveMQ An embedded broker (Make sure to disabled persistence) http://activemq.apache.org/
63. The Code Mailer.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/main/java/com/polymathiccoder/talk/xunit/repository/Mailer.java MailerTest.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/test/java/com/polymathiccoder/talk/xunit/repository/MailerTest.java
69. The Egyptian Plover & the Nile Crocodile Herodotus in “The Histories” claimed that there is a symbiotic relationship between the Egyptian Plover and the Nile Crocodile
70.
71. The Code EgyptianPlover.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/main/java/com/polymathiccoder/talk/xunit/domain/EgyptianPlover.java
73. The Egyptian Plover & the Nile Crocodile 3 different basis path The plover finds the crocodile’s mouth closed and flies away The plover finds the crocodile’s mouth open, doesn’t find any leeches, then flies away The plover finds the crocodile’s mouth open, picks the leeches, then flies away 3 different outcomes False is returned indicating that the plover didn’t eat An exception is thrown and False is returned indicating that the plover didn’t eat True indicating that the plover ate
74. Mocking Dependencies need to be mock to test in isolation Simulating an object to mimic the behavior of a real object in a controlled manner
75. Mocking Dependencies need to be mock to test in isolation Simulating an object to mimic the behavior of a real object in a controlled manner
77. Libra-palooza Mockito The coolest mocking framework there is Annotations @RunWith(MockitoJUnitRunner.class) @Mock @InjectMocks @Spy Stub method calls Verify interactions http://code.google.com/p/mockito/
78. The Code EgyptianPloverTest.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/test/java/com/polymathiccoder/talk/xunit/domain/EgyptianPloverTest.java
79. This is a digitally constructed image from the Warren Photographic Image Library of Nature and Pets http://www.warrenphotographic.co.uk/
81. Test Suites and Groups Annotations @Category @RunWith(Categories.class) @IncludeCategory @ExcludeCategory @SuiteClasses
82. The Code FastTest.java SlowTest.java SlowAndFastTest.java SlowTestSuite.java https://github.com/PolymathicCoder/LeTourDeXUnit/tree/master/src/test/java/com/polymathiccoder/talk/xunit/misc
83. Miscellaneous Topics Testing AOP (Aspect-Oriented Programming) Code Unit Testing the Advice Verify the execution of the Advice when Joint Point is reached Testing Concurrency In Junit Concurrent test execution Annotations @Concurrent @RunWith(ConcurrentSuite.class) GroboUtils http://groboutils.sourceforge.net/ ConcJUnit http://www.cs.rice.edu/~mgricken/research/concutest/concjunit/
86. Why Not Test First Instead? Most of us are just not disciplined to test last In order to determine a sets of verifications in the form tests to fulfill the requirements No room for misunderstanding Testable code is good code When you let testing drive the implementation A test-driven implementation is testable by definition No refactoring will be necessary
87. What if? Design Testing Write failing tests Implementation Get the tests to pass
90. TDD Is Great, But… TDD works But Thinking of requirements in terms of tests is NOT easy Syllogism Tests verify requirements Requirements define behavior Tests verify behavior Neuro-Linguistic Programming (NLP) suggests that the words we use influence the way we think What if we start using terminology that focuses on the behavioral aspects of the system rather than testing?
91. The BDD Way BDD is simply a rephrased TDD The focus on behavior Bridges the gap between Business users and Technologists Makes the development goals and priorities more aligned with business requirements TDD vs. BDD Verification State-Based Bottom-Up approach Specification Interaction-Based Outside-In Approach
92. The BDD Way “Behavior-Driven Development (BDD) is about implementing an application by describing it from the point of view of its stakeholders” – Jbehave.org
93. BDD Concepts Story A description of a feature that has business value As a [Role], I want to [Feature] So that I [Value] Sounds familiar? Agile for you!
94. BDD Concepts Scenario A description of how the user expects the system to behave using a sequence of steps Step Can be a context, an event, or an outcome Given [Context] When [Event] Then [Outcome]
95. BDD in Java JBehave Very powerful and flexible Well-documented Separation of story files from code http://jbehave.org EasyB http://www.easyb.org/ Concordion http://www.concordion.org/
97. The Quadratic Equation 3 possible data combinations that must be tested Coefficients yielding a negative discriminant Coefficients yielding a discriminant equals to zero Coefficients yielding a positive discriminant 3 different outcomes The equation has no real solution The equation has one real solution The equation has two real solution 3 different basis paths
98. BDD with JBehave Write the story Map the steps to a POJO @Given @When @Then Configure the stories @Configure Run the stories @RunWith(AnnotatedEmbedderRunner.class) @UsingEmbedder @UsingSteps View Reports
99. The Code quadraticEquation.story https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/test/java/com/polymathiccoder/talk/xunit/domain/quadraticEquation.story QuadraticEquationStories.java https://github.com/PolymathicCoder/LeTourDeXUnit/blob/master/src/test/java/com/polymathiccoder/talk/xunit/domain/QuadraticEquationStories.java
101. Tools Code Coverage Cobertura http://cobertura.sourceforge.net/ EMMA http://emma.sourceforge.net/ Continuous Integration On the server: Jenkins/Hudson http://jenkins-ci.org/ On your IDE: Infinitest http://infinitest.github.com/
103. Material The Slides http://www.slideshare.net/PolymathicCoder The Code https://github.com/PolymathicCoder/LeTourDeXUnit The Speaker Email: abdelmonaim.remani@gmail.com Twitter: @polymathiccoder LinkedIn: http://www.linkedin.com/in/polymathiccoder