JUnit is the de facto standard in Java testing. Yet many advanced JUnit features are little known and poorly understood. This session reviews some lesser-known features of JUnit, along with a few associated libraries, that can make your unit tests more powerful, expressive, and fun. The session is intended for Java developers, lead developers, and architects trying to introduce good testing practices into their teams.
What is a constructor?
Constructor is a method which gets executed automatically when we create or instantiate object of that class having constructor.
More Highlights of Constructor
A single class can have multiple constructors means we can have more than one constructor in a class. It is also called as overloaded constructor.
A benefit of using a constructor is that it guarantees that the object will go through a proper initialization before an object being used means we can pre-initialize some of the class variables with values before an object being used.
A constructor can be called another constructor by using "this" keyword. "this" keyword is the current instance of a class.
Java Multi Threading Concept
By N.V.Raja Sekhar Reddy
www.technolamp.co.in
Want more...
Like us @ https://www.facebook.com/Technolamp.co.in
subscribe videos @ http://www.youtube.com/user/nvrajasekhar
NATS is a high performance messaging system that was originally created as part of CloudFoundry but since then it has grown its own ecosystem and community around it, and also recently included as part of the Cloud Native Computing Foundation (CNCF).
Similar to Ruby, one of the goals from NATS is to make building messaging based applications as simple and reliable as possible. In this talk, we will cover why NATS might be interesting to consider for your next project and share some of the lessons learned so far from maintaining the Ruby clients from NATS.
This course provides a strong background about JAVA programming language in the field of computing. The course begins with an introductory overview of the Computer and programs, with distinguishes the terms API, IDE and JDK, and gives a comprehensive knowledge about Java development kits and Java integrative development environments like eclipse and NetBeans. Furthermore, the course prepares student to write, compile, run and develop Java applications which are used to find out the solution for several real life problems, in conjunction with using GUI to obtain input, process and display outputs like message dialog boxes, input dialog boxes, confirmation dialog and so on.
JAVA is a computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible.
The aim of this course is to explore Java programming fundamentals related to write, compile, run and develop Java applications that are used to discover the solution for several real life problems.
The official learning outcome for this course is: Upon successful completion of the course the students:
• Must know the basic concepts related JAVA programming language.
• Must know how to write, compile, run and develop java applications.
A combination of lectures and practical sessions will be used in this course in order to achieve the aim of the course.
By MSc. Karwan Mustafa Kareem
What is a constructor?
Constructor is a method which gets executed automatically when we create or instantiate object of that class having constructor.
More Highlights of Constructor
A single class can have multiple constructors means we can have more than one constructor in a class. It is also called as overloaded constructor.
A benefit of using a constructor is that it guarantees that the object will go through a proper initialization before an object being used means we can pre-initialize some of the class variables with values before an object being used.
A constructor can be called another constructor by using "this" keyword. "this" keyword is the current instance of a class.
Java Multi Threading Concept
By N.V.Raja Sekhar Reddy
www.technolamp.co.in
Want more...
Like us @ https://www.facebook.com/Technolamp.co.in
subscribe videos @ http://www.youtube.com/user/nvrajasekhar
NATS is a high performance messaging system that was originally created as part of CloudFoundry but since then it has grown its own ecosystem and community around it, and also recently included as part of the Cloud Native Computing Foundation (CNCF).
Similar to Ruby, one of the goals from NATS is to make building messaging based applications as simple and reliable as possible. In this talk, we will cover why NATS might be interesting to consider for your next project and share some of the lessons learned so far from maintaining the Ruby clients from NATS.
This course provides a strong background about JAVA programming language in the field of computing. The course begins with an introductory overview of the Computer and programs, with distinguishes the terms API, IDE and JDK, and gives a comprehensive knowledge about Java development kits and Java integrative development environments like eclipse and NetBeans. Furthermore, the course prepares student to write, compile, run and develop Java applications which are used to find out the solution for several real life problems, in conjunction with using GUI to obtain input, process and display outputs like message dialog boxes, input dialog boxes, confirmation dialog and so on.
JAVA is a computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible.
The aim of this course is to explore Java programming fundamentals related to write, compile, run and develop Java applications that are used to discover the solution for several real life problems.
The official learning outcome for this course is: Upon successful completion of the course the students:
• Must know the basic concepts related JAVA programming language.
• Must know how to write, compile, run and develop java applications.
A combination of lectures and practical sessions will be used in this course in order to achieve the aim of the course.
By MSc. Karwan Mustafa Kareem
Slides from the NestJS MasterClass.
We learned how to build JavaScript server-side applications with NestJS - A progressive NodeJS framework built with TypeScript.
You can find the code on GitHub:
https://github.com/nirkaufman/task-manager
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.
Http4s, Doobie and Circe: The Functional Web StackGaryCoady
Http4s, Doobie and Circe together form a nice platform for building web services. This presentations provides an introduction to using them to build your own service.
Injecting custom code into authentication and authorization in ASP.NET has always been tedious at best. AspNet.Identity is a new library shipping with MVC 5, built to replace both ASP.NET Membership and Simple Membership. AspNet.Identity makes it much easier to implement custom authentication and authorization without the need to rewrite core components. In this session I will go deep into the abstractions that AspNet.Identity builds atop of, and show how to take advantage of these hook points to implement a custom membership system.
the slide about Exception handling in java and the file and io handling in java .inbuilt java packages in for java exception.for beginner in programming
Hamcrest is a library for creating matchers for usage in unit tests, mocks and UI validation. This talk gives a brief introduction to using and writing Hamcrest matchers.
The topics covered:
* Basic introduction to Hamcrest
* Using Matchers in assertions
* Using Matchers with Mockito
* Writing custom matchers
* Ad-hoc matchers
Slides from the NestJS MasterClass.
We learned how to build JavaScript server-side applications with NestJS - A progressive NodeJS framework built with TypeScript.
You can find the code on GitHub:
https://github.com/nirkaufman/task-manager
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.
Http4s, Doobie and Circe: The Functional Web StackGaryCoady
Http4s, Doobie and Circe together form a nice platform for building web services. This presentations provides an introduction to using them to build your own service.
Injecting custom code into authentication and authorization in ASP.NET has always been tedious at best. AspNet.Identity is a new library shipping with MVC 5, built to replace both ASP.NET Membership and Simple Membership. AspNet.Identity makes it much easier to implement custom authentication and authorization without the need to rewrite core components. In this session I will go deep into the abstractions that AspNet.Identity builds atop of, and show how to take advantage of these hook points to implement a custom membership system.
the slide about Exception handling in java and the file and io handling in java .inbuilt java packages in for java exception.for beginner in programming
Hamcrest is a library for creating matchers for usage in unit tests, mocks and UI validation. This talk gives a brief introduction to using and writing Hamcrest matchers.
The topics covered:
* Basic introduction to Hamcrest
* Using Matchers in assertions
* Using Matchers with Mockito
* Writing custom matchers
* Ad-hoc matchers
The presentation contains a definition and survey of the benefits of Unit Testing, and a little coding example to get the feeling of Unit Testing using JUnit, EasyMock and XMLUnit.
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/254wkpw.
Aaron Bedra focuses on describing a system as a series of models that can be used to systematically and automatically generate input data and ensure that a code is behaving as expected. Bedra discusses property based testing and how it can help one build more resilient systems and even reduce the time needed to maintain a test suite. Filmed at qconlondon.com.
Aaron Bedra is Chief Security Officer at eligible.com. He is the creator of Repsheet, an open source threat intelligence framework. Bedra is the co-author of Programming Clojure, 2nd Edition and a frequent contributor to open source software.
(Seleniumcamp) Selenium RC for QA EngineerYan Alexeenko
The Selenium RC opportunities, problems and some features in work with it for cross-browser testing (Firefox, Internet Explorer, Safari, Google Chrome) are presented in the presentation. The issues, concerning testing automation start, the points of testing, performed data, test synchronization problems and different solutions of these problems are considered. Beside that, application testing problems, using Flash and Silverlight, file loading variants, XSS injections are discussed.
This presentation explains parameterized tests, theory tests, and generative testing. It also explains single mode faults and double mode faults and shows how to reduce the number of test cases when there's an combinatorial explosion. Lot's of JUnit examples.
This talk is based on heated discussions about the syntax of asserts. Do you like the good old `assertNotEquals(id, c.getId())` or do you prefer something fancier like `assertThat(id, is(not(equalTo(c.getId()))))`?
We will take a quick look at the differences between asserts in JUnit, TestNG, Hamcrest, fest, AssertJ, and Spock. This topic is at least as important as Vim vs Emacs and tabs vs spaces!
Topic: Software engineering practices
Language: English
"Design and Test First"-Workflow für REST APIsMarkus Decke
Often we as developers hand craft REST APIs, that can be cumbersome.
Requirements shouldn't be copied to code, either for tests or production.
In my talk I want to stress that we can have a better workflow with REST API specification projects, than the usual one.
I held this at bedon conference 2015 http://bed-con.org/2015/
Actors testing is different from what you are used to. First, you have messages instead of calls, second, you have to deal with concurrency and all the consequences that it brings with it:
* Thread.sleeps in tests;
* Flakiness;
* Green on laptop / red on jenkins;
* Missed test cases.
Fortunately Akka provides a TestKit which helps to avoid all these things when used properly. Let's take out and inspect tools from this kit and learn couple of useful patterns.
When you write unit tests for your projects, there’s a fair chance that you do so by following the classical « Given-When-Then » paradigm, in which you set some input data, execute the code you’re testing, and finally assert that its outcome is indeed the one you expected.
While this approach is perfectly sound, it does suffer one downside: your program will only be tested on the static input data defined in your tests, and there is no real guarantee that this data does cover all edge cases. This can be especially problematic for SDK developers, who, by definition, have a very hard time anticipating all the different situations in which their code will be used.
To improve on this issue, another approach exists, and it is called property-based testing. The idea behind it is very simple: you write your tests by defining properties that must always be true for your program. For example, « an array reversed twice is always equal to itself ». The testing framework will then generate random input values and test wether the property holds or not. And, as you can imagine, this approach is extremely good at narrowing down on overlooked edge cases.
In Swift, we are lucky enough to already have a full-fledged implementation called SwiftCheck, that enables property-based testing (https://github.com/typelift/SwiftCheck). The goal of this talk is thus to explain how property-based testing can be a powerful addition to a testing suite, and give actual and actionable examples of how it can be added to a project using SwiftCheck.
A presentation on JUnit Pioneer given at Fortitude Technologies on Mar. 4, 2021. JUnit Pioneer is an extension library for JUnit 5 (Jupiter).
Sample code on GitHub at:
https://github.com/sleberknight/junit-pioneering-presentation-code
JUnit Pioneer home page:
https://junit-pioneer.org
Presentation on some JUnit 4 Goodness that developers who came to JUnit at version 3 may have let slip under the radar. Parameterized tests, matcher assertions and the @Ignore annotations are presented in this slideshow.
Beyond xUnit example-based testing: property-based testing with ScalaCheckFranklin Chen
Test-Driven Development has become deservedly popular in the past decade, with easy-to-use xUnit unit testing frameworks leading the way toward encouraging developers to write tests. But xUnit has limitations: how does one know one has written enough test cases for a desired behavior? And what if the behavior is conditional on other behavior? Property-based testing, first popularized for Haskell with the QuickCheck library, but available now for other languages as well, offers a powerful addition to one's testing toolkit.
I will discuss the concepts of property-based testing and illustrate them concretely using ScalaCheck for Scala, and point toward similar test frameworks in other languages.
Grails GORM - You Know SQL. You Know Queries. Here's GORM.Ted Vinke
This presentation shows practical basics of how Grails Object Relational Mapping (GORM) can help you query data, test it, and think in domain terms along the way when SQL at the moment is all you know.
Evidence is a new, framework-agnostic unit testing library which I developed out of necessity and frustration with the existing offering. Although it's heavily inspired by it's Ruby, Python and Java couterparts, Evidence is packed with niceness targeted at the specificities of the JavaScript language and its different environments. Hopefully this introduction to Evidence will give you the motivation, tools and knowledge to start unit testing your JavaScript code if you are not doing so already.
Written specs are easy to read but hard to write. Even with an understanding of the principles and tips for writing good Gherkin, it can be very hard to keep scenarios clean, informative and readable.
These slides are from a workshop given by John Ferguson Smart and Tom Roden, where they take a practical look at some real-world Gherkin scenarios, investigate what makes them smell and practise how to improve them. Discover some powerful refactoring patterns to help make your own specs a joy to read.
It was the time of Da Vinci and Michelangelo. It was also the time of Machiavelli and the Medici. Artists working on timeless masterpieces crossed paths with mercenary captains, contracted to do a very specific job.
In this keynote talk, John Smart will address important questions with deep implications for any IT team, or any organisation trying to make a difference, or simply to get the most value out of their IT projects.
Who is your real customer? Is there a cost to quality? Are you building an artwork that will last, or simply fulfilling a contract?
An inspiring and entertaining talk that will take attendees on journey from the Italian Renaissance to Silicon Valley and the City of London, and see what lessons can be learned about cultures, attitudes and work ethics today.
Discover how you can multiply your team’s productivity and innovation by engaging the creativity of your whole team from the outset. Drawing from his long experience helping teams deliver better software faster and more effectively, John will discuss the latest practical techniques leveraged from Behaviour Driven Development, Lean Enterprise, DevOps, and Test Automation, combined with research in Psychology and Team Performance, to show you how to get the best out of your teams.
Learn about the new roles of business analysts, developers and testers in the future of software development, where testers can play a vital role in not only detecting defects but preventing them. Discover how you can make test automation happen during, not after, the sprint, and how to engage the creativity of the whole team right from the word "go".
his talk will present the core concepts of Exponential Business Agility, or XBA. XBA is a set of patterns for organising value streams around self-organising, autonomous teams, and is part of the XSCALE approach to scaling agile. XBA combines the Spotify model with practice patterns drawn from the Iroquois Confederacy, the most successful and longest-lived holarchy in history.
Learn how Throughput Accounting optimises the contribution of each business function to top line throughput rather than blindly attempting to minimise operating expense.
And discover how Self-Propagating Transformation avoids pushing change into pre-existing teams, programs or silos, but generates agile capability by grafting the kernel of a new culture onto the trunk of the old.
Be a pod of dolphins, not a dancing elephant. Don’t try to scale agile. De-scale your organisation instead.
As projects get faster and teams get leaner, the need to write high quality automated acceptance criteria quickly and efficiently has never been greater. Engineers in Test simply cannot afford to spend time maintaining brittle tests. And yet, without solid test automation strategies, this is what many teams find themselves doing. In this workshop, you will learn a better way. You will learn how to write clean, clear and maintainable tests using the Screenplay Pattern, an innovative new approach to writing BDD-style automated acceptance tests that are easier to understand, easier to extend and easier to maintain. The workshop will be a practical demonstration of the principles of good automated test design. There will be live coding of real-world BDD automated acceptance tests in abundance, using Java, Serenity BDD and Cucumber. We will go from requirements and BDD-style Acceptance Criteria in Cucumber right through to automated acceptance tests and living documentation.
Writing good acceptance criteria is one of the keys to effective software delivery. But it’s hard. In this workshop, you will learn about Feature Mapping, a new technique and easy that can help teams write higher quality acceptance criteria more easily. Feature Mapping is an excellent way to build a deep shared understanding of a story's requirements and clear a path to a smooth implementation of automated acceptance tests.
International speaker and author of “BDD in Action” John Ferguson Smart shows how you can multiply your team’s productivity and innovation by engaging the creativity of your whole team from the outset. Drawing from his long experience helping teams deliver better software faster and more effectively, John will discuss the latest practical techniques leveraged from Behaviour Driven Development, Lean Enterprise, DevOps, and Test Automation, combined with research in Psychology and Team Performance, to show you how to get the best out of your teams. Learn about the new roles of business analysts, developers and testers in a DevOps world, and how testers can play a vital role in not only detecting defects but preventing them. Discover how you can make test automation happen during, not after, the sprint, and how to engage the creativity of the whole team right from the word "go".
IT teams today are under constant pressure to deliver more value sooner, and Behaviour Driven Development (BDD) is one of the more effective ways to help teams deliver the high quality software that their business needs. When they adopt BDD, many teams look to tools like Cucumber to help them. But BDD isn’t simply about picking up a new tool.
In fact, there is a lot more to BDD than Given/When/Then and tools like Cucumber, and both can be misused. In this talk, we will take a step back and look at the bigger picture, and learn why using Gherkin at the wrong time, or for the wrong purpose, may be holding you back.
IT teams today are under constant pressure to deliver more value sooner, and Behaviour Driven Development (BDD) is one of the more effective ways to help teams deliver the high quality software that their business needs. When they adopt BDD, many teams look to tools like Cucumber to help them. But BDD isn’t simply about picking up a new tool.
In fact, there is a lot more to BDD than Given/When/Then and tools like Cucumber, and both can be misused. In this talk, we will take a step back and look at the bigger picture, and learn why using Gherkin at the wrong time, or for the wrong purpose, may be holding you back.
The changing role of testing and test automation in the increasingly fast-paced world of continuous delivery and automated acceptance testing. Learn how, in a DevOps environment, testing activities start with requirements discovery and definition, playing a vital role in not only detecting defects, but preventing them, and ensuring not only that the features are built right, but the right features are built. And learn how test automation needs to happen during, not after, the sprint, and how you can achieve this.
Despite rumors to the contrary, the role of the tester is not diminished with the arrival of automated DevOps, with its ultra-rapid deployment cycles and its emphasis on automation. On the contrary, testers play a vital role in ensuring that the code that gets deployed ten times a day is worth deploying.
Learn how to write robust and articulate tests using the Screenplay Pattern, an innovative approach to writing BDD-style automated acceptance tests that are easier to understand, easier to extend and easier to maintain.
The essentials of Cucumber-JVM and Spock - a handbook written for the BDD/TDD Masterclass (https://johnfergusonsmart.com/programs-courses/bdd-tdd-clean-coding/)
Every test tells a story, but some tell a better story than others. Every test illustrates a specific path through the system to achieve a specific goal, but some paths are clearer than others. Valuable tests are the ones that both tell a compelling story, and can stand the test of time, providing value not only as acceptance tests but also as living documentation and easily maintainable regression tests.
In this session, John will invite you to come on a journey of discovery to learn how to write clean, clear and maintainable tests using the Journey Pattern, an innovative new approach to writing automated acceptance tests that are easier to understand, easier to extend and easier to maintain. You will also witness a demonstration of these principles in action, with live coding of Serenity BDD automated tests.
Learn how to plan, prioritise and deliver higher value features by thinking of deliverable features not in terms of what they cost, but of what they can deliver.
XScale is a set of practices based on BDD that enables a product team to efficiently define, budget and prioritise a roadmap or backlog.
It’s also a way to answer some questions Agile has traditionally avoided:
- How much will a set of features cost?
- How do we trade off different feature sets?
- How do we know a feature is ready to ship?
In this workshop, we outline several key practices and practice using a few of them. The main practices we cover include:
- Feature Points, a way to reconcile budgets with story points
- Backlog Bingo determines the dollar investment and relative return for a set of products and services
- Royal Cod applies Backlog Bingo to prioritize a Breadth-First Roadmap
- Release Refactoring enables product owners to make rational trade-offs between feature-sets.
Behaviour Driven Development is a powerful collaboration technique that can empower teams to deliver higher value features to the business faster and more effectively. But although Behaviour Driven Development is based on a number of simple principles, it can go dramatically wrong in a myriad of different ways.
In this talk we discuss twelve BDD anti-patterns we frequently encounter in real-world BDD projects, anti-patterns that can dramatically reduce the effectiveness of BDD as a practice, and that can even cause BDD adoption to fail entirely. Looking at everything from insufficient collaboration practices to poor use of test automation tooling, from teams that test too much to teams that forget the most important scenarios, we will look at the many different ways that BDD can go wrong, and how it should be done.
We will use real-world examples to illustrate each of these anti-patterns. You will learn how to spot these issues in your own projects, and more importantly how to avoid them in the first place.
Every test tells a story, but some tell a better story than others. Every test illustrates a specific path through the system to achieve a specific goal, but some paths are clearer than others. Valuable tests are the ones that tell a compelling story.
Come on a journey of discovery to learn how to write such tests, and witness a demonstration of these principles in action, with live coding of Serenity BDD automated tests.
Behaviour-Driven Development (BDD) is a game changer for the whole team! Behaviour Driven Development is a powerful collaboration technique that can empower teams to deliver higher value features to the business faster and more effectively. More than just a testing technique, BDD is both a collaboration and a verification tool, and a vital step on the road to Continuous Delivery.
Think BDD is just for web sites? Think again! In this talk, we rethink traditional software testing strategies in the context of micro-services and Behaviour-Driven Development. We will see how traditional testing approaches are both inadequate and poorly targeted for micro-services development. We will learn how to use BDD techniques to discover, describe and document micro-service requirements, and tools like Cucumber and Serenity to turn these requirements into automated acceptance tests and living documentation. We will see how Consumer-Driven Contract tools help ensure that micro-services play well together, and how you can implement the details with the help of unit-testing tools like Spock and REST-Assured.
Behaviour Driven Development is a powerful collaboration technique that can empower teams to deliver higher value features to the business faster and more effectively. But although Behaviour Driven Development is based on a number of simple principles, it can go dramatically wrong in a myriad of different ways.
In this talk we discuss twelve BDD anti-patterns we frequently encounter in real-world BDD projects, anti-patterns that can dramatically reduce the effectiveness of BDD as a practice, and that can even cause BDD adoption to fail entirely. Looking at everything from insufficient collaboration practices to poor use of test automation tooling, from teams that test too much to teams that forget the most important scenarios, we will look at the many different ways that BDD can go wrong, and how it should be done.
We will use real-world examples to illustrate each of these anti-patterns. You will learn how to spot these issues in your own projects, and more importantly how to avoid them in the first place.
Behaviour Driven Development is an increasingly popular Agile practice that turns testing on its head, and involves a major shift in the role testers play in a project. Although popularly associated with automated acceptance testing and tools like Cucumber, BDD actually has much broader applications. In this talk, we will look at how Behaviour Driven Development radically changes the traditional tester role in Agile projects, and empowers them to tangibly contribute much more to the successful outcomes of the project. We will see how collaboratively discussing and defining acceptance criteria help reduce assumptions and errors in the early phases of the project, and help ensure that the features being built are well understood, testable, and valuable to the business. We will look at ways to write more effective, easier to maintain automated acceptance criteria, that free testers to do more productive testing tasks such as exploratory testing. And we will see how automated and manual acceptance test reporting can be combined to provide valuable progress, product documentation and release preparation reporting.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
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.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
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.
Leading Change strategies and insights for effective change management pdf 1.pdf
JUnit Kung Fu: Getting More Out of Your Unit Tests
1. JUnit Kung Fu
Getting more out of your unit tests
John Ferguson Smart
Principle Consultant
Wakaleo Consulting
2. So who is this guy, anyway?
John Ferguson Smart
Consultant, Trainer, Mentor, Author, Speaker
3. So who is this guy, anyway?
John Ferguson Smart
Consultant, Trainer, Mentor, Author,...
4. Agenda
What will we cover today
Naming your tests
Hamcrest Assertions and Matchers
Parameterized tests and JUnit Theories
JUnit Rules
Parallel Testing
JUnit Categories
Continuous Testing
Mockito
5. Anatomy of a JUnit 4 test
What’s the big deal with JUnit 4?
import static com.wakaleo.gameoflife.domain.Cell.DEAD_CELL;
import static com.wakaleo.gameoflife.domain.Cell.LIVE_CELL;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import org.junit.Test; No need to extend TestCase
public class WhenYouCreateACell {
Annotation-based
@Test
public void aLiveCellShouldBeRepresentedByAnAsterisk() {
Cell cell = Cell.fromSymbol("*");
assertThat(cell, is(LIVE_CELL));
}
Call the tests anything you want
@Ignore("Pending Implementation")
@Test Annotations for test metadata
public void aDeadCellShouldBeRepresentedByADot() {
Cell cell = Cell.fromSymbol(".");
assertThat(cell, is(DEAD_CELL));
}
...
}
6. What’s in a name
Name your tests well
"What's in a name? That which we call a rose
By any other name would smell as sweet."
Romeo and Juliet (II, ii, 1-2)
7. What’s in a name
The 10 5 Commandments of Test Writing
I. Don’t say “test, say “should” instead
II. Don’t test your classes, test their behaviour
III. Test class names are important too
IV. Structure your tests well
V. Tests are deliverables too
8. What’s in a name
Don’t use the word ‘test’ in your test names
testBankTransfer()
testWithdraw()
testDeposit()
9. What’s in a name
Do use the word ‘should’ in your test names
testBankTransfer()
testWithdraw()
tranferShouldDeductSumFromSourceAccountBalance()
testDeposit()
transferShouldAddSumLessFeesToDestinationAccountBalance()
depositShouldAddAmountToAccountBalance()
10. What’s in a name
Your test class names should represent context
When is this behaviour applicable?
What behaviour are we testing?
11. What’s in a name
Write your tests consistently
‘Given-When-Then’ or ‘Arrange-Act-Assert’ (AAA)
@Test
public void aDeadCellWithOneLiveNeighbourShouldRemainDeadInTheNextGeneration() {
String initialGrid = "...n" +
".*.n" + Prepare the test data (“arrange”)
"...";
String expectedNextGrid = "...n" +
"...n" +
"...n"; Do what you are testing (“act”)
Universe theUniverse = new Universe(seededWith(initialGrid));
theUniverse.createNextGeneration();
String nextGrid = theUniverse.getGrid();
Check the results (“assert”)
assertThat(nextGrid, is(expectedNextGrid));
}
12. What’s in a name
Tests are deliverables too - respect them as such
Refactor, refactor, refactor!
Clean and readable
13. Express Yourself with Hamcrest
Why write this...
import static org.junit.Assert.*;
...
assertEquals(10000, calculatedTax, 0);
when you can write this...
import static org.hamcrest.Matchers.*;
...
assertThat(calculatedTax, is(10000));
“Assert that are equal 10000 and calculated tax (more or less)” ?!
Don’t I just mean “assert that calculated tax is 10000”?
14. Express Yourself with Hamcrest
With Hamcrest, you can have your cake and eat it!
assertThat(calculatedTax, is(expectedTax));
Readable asserts
String color = "red";
assertThat(color, is("blue"));
Informative errors
String[] colors = new String[] {"red","green","blue"};
String color = "yellow";
assertThat(color, not(isIn(colors)));
Flexible notation
15. Express Yourself with Hamcrest
More Hamcrest expressiveness
String color = "red";
assertThat(color, isOneOf("red",”blue”,”green”));
List<String> colors = new ArrayList<String>();
colors.add("red");
colors.add("green");
colors.add("blue");
assertThat(colors, hasItem("blue"));
assertThat(colors, hasItems("red”,”green”));
assertThat(colors, hasItem(anyOf(is("red"), is("green"), is("blue"))));
17. Home-made Hamcrest Matchers
Customizing Hamcrest matchers
You can build your own by combining existing Matchers...
Create a dedicated Matcher for the Stakeholder class
List stakeholders = stakeholderManager.findByName("Health");
Matcher<Stakeholder> calledHealthCorp = hasProperty("name", is("Health Corp"));
assertThat(stakeholders, hasItem(calledHealthCorp));
Use matcher directly with hasItem()
“The stakeholders list has (at least) one item with
the name property set to “Health Corp””
18. Home-made Hamcrest Matchers
Writing your own matchers in three easy steps!
public class WhenIUseMyCustomHamcrestMatchers {
@Test
public void thehasSizeMatcherShouldMatchACollectionWithExpectedSize() {
List<String> items = new ArrayList<String>();
items.add("java");
assertThat(items, hasSize(1));
}
}
We want something like this...
I want a matcher that checks the size of a collection
19. Home-made Hamcrest Matchers
Writing your own matchers in three easy steps!
public class HasSizeMatcher extends TypeSafeMatcher<Collection<? extends Object>> {
private Matcher<Integer> matcher;
Extend the TypeSafeMatcher class
public HasSizeMatcher(Matcher<Integer> matcher) {
this.matcher = matcher; Provide expected values in
} the constructor
public boolean matchesSafely(Collection<? extends Object> collection) {
return matcher.matches(collection.size());
} Do the actual matching
public void describeTo(Description description) {
description.appendText("a collection with a size that is");
matcher.describeTo(description);
} Describe our expectations
}
So let’s write this Matcher!
20. Home-made Hamcrest Matchers
Writing your own matchers in three easy steps!
import java.util.Collection;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
public class MyMatchers { Use a factory class to store your matchers
@Factory
public static Matcher<Collection<? extends Object>> hasSize(Matcher<Integer> matcher){
return new HasSizeMatcher(matcher);
}
}
All my custom matchers go in a special Factory class
21. Home-made Hamcrest Matchers
Writing your own matchers in three easy steps!
import static com.wakaleo.gameoflife.hamcrest.MyMatchers.hasSize;
import static org.hamcrest.MatcherAssert.assertThat;
public class WhenIUseMyCustomHamcrestMatchers {
@Test
public void thehasSizeMatcherShouldMatchACollectionWithExpectedSize() {
List<String> items = new ArrayList<String>();
items.add("java");
assertThat(items, hasSize(1));
}
}
Hamcrest-style error messages
22. Home-made Hamcrest Matchers
But wait! There’s more!
@Test
public void weCanUseCustomMatchersWithOtherMatchers() {
List<String> items = new ArrayList<String>();
items.add("java");
assertThat(items, allOf(hasSize(1), hasItem("java")));
}
Combining matchers
@Test
public void weCanUseCustomMatchersWithOtherMatchers() {
List<String> items = new ArrayList<String>();
items.add("java");
items.add("groovy");
assertThat(items, hasSize(greaterThan(1)));
}
Nested matchers
24. Using Parameterized Tests
Parameterized tests - for data-driven testing
Take a large set of test data, including an expected result
Define a test that uses the test data
Verify calculated result against expected result
{2, 0, 0}
{2, 1, 2}
{2, 2, 4}
{2, 3, 6}
{2, 4, 8}
x=a*b
{2, 5, 10}
Test
{2, 6, 12}
{2, 7, 14}
... Verify
Data
26. Using Parameterized Tests
Parameterized tests with JUnit 4.8.1 Income Expected Tax
$0.00 $0.00
What you need: $10,000.00 $1,250.00
Some test data $14,000.00 $1,750.00
$14,001.00 $1,750.21
A test class with matching fields $45,000.00 $8,260.00
$48,000.00 $8,890.00
And some tests $48,001.00 $8,890.33
$65,238.00 $14,578.54
And an annotation $70,000.00 $16,150.00
public class TaxCalculatorDataTest {
@RunWith(Parameterized.class) $70,001.00 $16,150.38
public classdouble income;
private TaxCalculatorDataTest {
$80,000.00 $19,950.00
private double expectedTax;
income;
private double expectedTax; $100,000.00 $27,550.00
public TaxCalculatorDataTest(double income, double expectedTax) {
super();
this.income = income;
public TaxCalculatorDataTest(double income, double expectedTax) {
this.income = income;
this.expectedTax = expectedTax;
super();
} this.expectedTax = expectedTax;
this.income = income;
} } this.expectedTax = expectedTax;
}
@Test
public void shouldCalculateCorrectTax() {...}
@Test
} public void shouldCalculateCorrectTax() {...}
}
27. Using Parameterized Tests
This is a parameterized test
How it works Income Expected Tax
@RunWith(Parameterized.class) $0.00 $0.00
public class TaxCalculatorDataTest { The @Parameters annotation $10,000.00 $1,250.00
private double income;
private double expectedTax;
indicates the test data $14,000.00 $1,750.00
@Parameters $14,001.00 $1,750.21
public static Collection<Object[]> data() { $45,000.00 $8,260.00
return Arrays.asList(new Object[][] {
{ 0.00, 0.00 }, $48,000.00 $8,890.00
{ 10000.00, 1250.00 }, { 14000.00, 1750.00 }, $48,001.00 $8,890.33
{ 14001.00, 1750.21 }, { 45000.00, 8260.00 },
{ 48000.00, 8890.00 }, { 48001.00, 8890.33 }, $65,238.00 $14,578.54
{ 65238.00, 14578.54 }, { 70000.00, 16150.00 },
$70,000.00 $16,150.00
{ 70001.00, 16150.38 }, { 80000.00, 19950.00 },
{ 100000.00, 27550.00 }, }); $70,001.00 $16,150.38
}
$80,000.00 $19,950.00
public TaxCalculatorDataTest(double income, double expectedTax) { $100,000.00 $27,550.00
super();
this.income = income;
this.expectedTax = expectedTax; The constructor takes the
} fields from the test data
@Test
public void shouldCalculateCorrectTax() {
TaxCalculator calculator = new TaxCalculator(); The unit tests use data
double calculatedTax = calculator.calculateTax(income);
assertThat(calculatedTax, is(expectedTax)); from these fields.
}
}
28. Using Parameterized Tests
Parameterized Tests in Eclipse Income Expected Tax
$0.00 $0.00
Run the test only once $10,000.00 $1,250.00
Eclipse displays a result for each data set $14,000.00
$14,001.00
$1,750.00
$1,750.21
$45,000.00 $8,260.00
$48,000.00 $8,890.00
$48,001.00 $8,890.33
$65,238.00 $14,578.54
$70,000.00 $16,150.00
$70,001.00 $16,150.38
$80,000.00 $19,950.00
$100,000.00 $27,550.00
29. Using Parameterized Tests
Example: using an Excel Spreadsheet
@Parameters
public static Collection spreadsheetData() throws IOException {
InputStream spreadsheet = new FileInputStream("src/test/resources/aTimesB.xls");
return new SpreadsheetData(spreadsheet).getData();
}
30. Using Parameterized Tests
Example: testing Selenium 2 Page Objects
A Page Object class
public class ExportCertificateSubmissionFormPage extends WebPage {
@FindBy(name="HD_EN") WebElement importerName;
@FindBy(name="HD_EA") WebElement importerAddress;
@FindBy(name="HD_ER") WebElement importerRepresentative;
...
public String getImporterName() {
return importerName.getValue();
}
public void setImporterName(String value) {
enter(value, into(importerName));
}
...
}
31. Using Parameterized Tests
Example: testing Selenium 2 Page Objects
Testing the fields using a parameterized test
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{ "importerName", "an-importer-name" },
{ "importerAddress", "an-importer-address" },
{ "importerRepresentative", "a-importer-representative" },
...
});
}
32. Using Parameterized Tests
Example: testing Selenium 2 Page Objects
Setting up the test data
private String field;
private String inputValue;
public ReadingAndWritingFieldsWhenRaisingACertificate(String field,
String inputValue) {
this.field = field;
this.inputValue = inputValue;
}
33. Using Parameterized Tests
Example: testing Selenium 2 Page Objects
Test reading and writing to/from the field
@Test
public void userShouldBeAbleToWriteToAnInputFieldAndThenReadTheValue() {
setFieldValueUsing(setterFor(field));
String retrievedValue = getFieldValueUsing(getterFor(field));
assertThat(retrievedValue, is(inputValue));
} (Reflection magic goes here)
35. JUnit Rules
The Temporary Folder Rule
public class LoadDynamicPropertiesTest {
Create a temporary folder
@Rule
public TemporaryFolder folder = new TemporaryFolder();
private File properties;
@Before Prepare some test data
public void createTestData() throws IOException {
properties = folder.newFile("messages.properties");
BufferedWriter out = new BufferedWriter(new FileWriter(properties));
// Set up the temporary file
out.close();
}
Use this folder in the tests
@Test
public void shouldLoadFromPropertiesFile() throws IOException {
DynamicMessagesBundle bundle = new DynamicMessagesBundle();
bundle.load(properties);
// Do stuff with the temporary file
}
}
The folder will be deleted afterwards
36. JUnit Rules
The ErrorCollector Rule
Report on multiple error conditions in a single test
public class ErrorCollectorTest {
@Rule
public ErrorCollector collector = new ErrorCollector();
@Test Two things went wrong here
public void testSomething() {
collector.addError(new Throwable("first thing went wrong"));
collector.addError(new Throwable("second thing went wrong"));
String result = doStuff();
collector.checkThat(result, not(containsString("Oh no, not again")));
}
Check using Hamcrest matchers
private String doStuff() {
return "Oh no, not again";
}
}
37. JUnit Rules
The ErrorCollector Rule
Report on multiple error conditions in a single test
public class ErrorCollectorTest {
@Rule All three error messages are reported
public ErrorCollector collector = new ErrorCollector();
@Test
public void testSomething() {
collector.addError(new Throwable("first thing went wrong"));
collector.addError(new Throwable("second thing went wrong"));
String result = doStuff();
collector.checkThat(result, not(containsString("Oh no, not again")));
}
private String doStuff() {
return "Oh no, not again";
}
}
38. JUnit Rules
The Timeout Rule
Define a timeout for all tests
public class GlobalTimeoutTest {
@Rule
public MethodRule globalTimeout = new Timeout(1000);
@Test No test should take longer than 1 second
public void testSomething() {
for(;;);
}
Oops
@Test
public void testSomethingElse() {
}
}
39. JUnit Rules
The Verifier Rule
Adding your own custom verification logic
public class VerifierTest {
private List<String> systemErrorMessages = new ArrayList<String>();
@Rule
public MethodRule verifier = new Verifier() {
@Override
public void verify() { After each method, perform this check
assertThat(systemErrorMessages.size(), is(0));
}
};
@Test
public void testSomething() {
// ...
systemErrorMessages.add("Oh, bother!");
}
}
40. JUnit Rules
The Watchman Rule
Keeping an eye on the tests
public class WatchmanTest {
private static String watchedLog;
@Rule
public MethodRule watchman = new TestWatchman() { Called whenever a test fails
@Override
public void failed(Throwable e, FrameworkMethod method) {
watchedLog += method.getName() + " " + e.getClass().getSimpleName() + "n";
}
@Override
public void succeeded(FrameworkMethod method) {
watchedLog += method.getName() + " " + "success!n";
}
};
Called whenever a test succeeds
@Test
public void fails() {
fail();
}
@Test
public void succeeds() {...}
}
42. JUnit Categories
Setting up JUnit Categories
1) Define some categories
Categories are defined as interfaces
public interface IntegrationTests {}
public interface PerformanceTests {}
public interface PerformanceTests extends IntegrationTests {}
Subclassing works too
43. JUnit Categories
Setting up JUnit Categories
2) Annotate your tests
public class CellTest {
A test with a category
@Category(PerformanceTests.class)
@Test
public void aLivingCellShouldPrintAsAPlus() {...}
@Category(IntegrationTests.class)
@Test A test with several
public void aDeadCellShouldPrintAsAMinus() {...} categories
@Category({PerformanceTests.class,IntegrationTests.class})
@Test
public void thePlusSymbolShouldProduceALivingCell() {...} A normal test
@Test
public void theMinusSymbolShouldProduceADeadCell() {...}
}
44. JUnit Categories
Setting up JUnit Categories
2) Or annotate your class
You can also annotate the class
@Category(IntegrationTests.class)
public class CellTest {
@Test
public void aLivingCellShouldPrintAsAPlus() {...}
@Test
public void aDeadCellShouldPrintAsAMinus() {...}
@Test
public void thePlusSymbolShouldProduceALivingCell() {...}
@Test
public void theMinusSymbolShouldProduceADeadCell() {...}
}
45. JUnit Categories
Setting up JUnit Categories
3) Set up a test suite
import org.junit.experimental.categories.Categories;
import org.junit.experimental.categories.Categories.IncludeCategory;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Categories.class) Run only performance tests
@IncludeCategory(PerformanceTests.class)
@SuiteClasses( { CellTest.class, WhenYouCreateANewUniverse.class })
public class PerformanceTestSuite {
Still need to mention the test classes
}
46. JUnit Categories
Setting up JUnit Categories
3) Set up a test suite - excluding categories
import org.junit.experimental.categories.Categories;
import org.junit.experimental.categories.Categories;
import org.junit.experimental.categories.Categories.IncludeCategory;
import org.junit.experimental.categories.Categories.IncludeCategory;
import org.junit.runner.RunWith;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Categories.class)
@RunWith(Categories.class) Don’t run performance tests
@IncludeCategory(PerformanceTests.class)
@ExcludeCategory(PerformanceTests.class)
@SuiteClasses( { CellTest.class, WhenYouCreateANewUniverse.class })
@SuiteClasses( { CellTest.class, WhenYouCreateANewUniverse.class })
public class PerformanceTestSuite {
public class UnitTestSuite {
}
}
47. Parallel tests
Running tests in parallel
Run your tests faster
Also works well with multi-core CPUs
Results vary depending on the tests
IO
Database
...
48. Parallel tests
Setting up parallel tests with JUnit and Maven
<project...> Needs Surefire 2.5
<plugins>
...
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration> ‘methods’, ‘classes’, or ‘both’
<parallel>methods</parallel>
</configuration>
</plugin>
</plugins>
...
<build>
<dependencies>
<dependency> Needs JUnit 4.8.1 or better
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</build>
...
</project>
49. Continuous Testing
Continuous Tests with Infinitest
Infinitest is a continuous test tool for Eclipse and IntelliJ
Runs your tests in the background when you save your code
50. Continuous Testing
Using Infinitest
Whenever you save your file changes, unit tests will be rerun
Failing test
Project containing an error
Error message about the failed test