This document discusses integration testing and provides guidance on how to effectively test systems with dependencies on external resources like databases and web services. It emphasizes separating integration tests from unit tests, faking dependencies using tools like in-memory databases and SOAPUI, and testing applications in their real container using the Spring Test framework.
Vous avez atteint le Graal de 100% de Code Coverage ? Bravo ! Pourtant, vous rencontrez encore des bugs lors du lancement de l'application. Vous pratiquez déjà les Tests d'Intégration ? Bravo également ! Pourtant, vous devez les corriger sans cesse car ils sont instables.
Dans cette présentation, je tenterai de démontrer la raison d'être des Tests d'Intégration et leur complémentarité avec les Tests Unitaires. Je montrerai également comment améliorer la fiabilité des TI et quels sont les outils pour cela. Le reste de la présentation sera consacré aux TI in-container, Spring et Java EE.
This workshop is about testing the right way. Get a clear view on how to test your code in an efficient and useful way!
This first testing-related workshop is about all aspects of unit testing. Integration testing and TDD will have their own dedicated workshops.
Vous avez atteint le Graal de 100% de Code Coverage ? Bravo ! Pourtant, vous rencontrez encore des bugs lors du lancement de l'application. Vous pratiquez déjà les Tests d'Intégration ? Bravo également ! Pourtant, vous devez les corriger sans cesse car ils sont instables.
Dans cette présentation, je tenterai de démontrer la raison d'être des Tests d'Intégration et leur complémentarité avec les Tests Unitaires. Je montrerai également comment améliorer la fiabilité des TI et quels sont les outils pour cela. Le reste de la présentation sera consacré aux TI in-container, Spring et Java EE.
This workshop is about testing the right way. Get a clear view on how to test your code in an efficient and useful way!
This first testing-related workshop is about all aspects of unit testing. Integration testing and TDD will have their own dedicated workshops.
A presentation that guides you through the stages of testing your Java enterprise application. Finally it shows you that Arquillian is the best tool for that
Testcontainers - Geekout EE 2017 presentationRichard North
Unit testing our code on the JVM is well catered for with a lot of great tools that are mature and reliable – things tend to just work. Integrated testing, however, is another matter. Any time we face a situation where we need to involve non-JVM elements in our tests, we’re faced with painful environment setup and repeatability issues. Testcontainers aims to make integrated tests a little less unpleasant, through the power of Docker. Databases, Web browsers – in fact anything available as a Docker image – can be made available as a component to use in our tests.
In this talk, we’ll go through the motivations for building Testcontainers, its features, as well as some examples of using it in practice for testing various types of components.
Many developers are on board with writing unit tests for their code. However a lot of developers don’t test as much as they should because deciding how and what to unit test is harder than deciding to test. Laravel 5 is built with great support for unit testing with PHPUnit but testing applications built using the Model View Controller pattern can prove challenging. This talk will cover ways to design your code to make testing easier and also help you decide what should be unit tested and what should be left to other testing methods.
Continuous Integration Testing in DjangoKevin Harvey
Continuous Integration is like having a robot that cleans up after you: it installs your dependencies, builds your project, run your tests, and reports back to you. This presentation outlines two methods for CI: Travis and Jenkins.
how to write functional tests with Selenium. how to set up Selenium Testing On Grails Apps In Continuous
Integration Using two approaches: The long way – using Maven and/or Ant The fast way, using the grails-
selenium-rc plug-in - ( see
http://buildchimp.com/wordpress/?p=241 )
В ходе доклада мы обсудим такие виды тестирования как:
- юнит тестирование,
- тестирование верстки,
- e2e-тестирование,
- тестирование производительности для FE
Также мы коснемся таких фундаментальных вещей, как:
- Что такое F.I.R.S.T
- Где заканчивается ответственность разработчика и начинает - ответственность QA инженера
- Как договариваться с бэкенд разработчиками
- И конечно, почему тесты нужны.
Arquillian (http://jboss.org/arquillian) is a test harness that simplifies integration testing using container managed resources.
ShrinkWrap (http://jboss.org/shrinkwrap) is a fluent Java API for dynamically generating deployable archives.
Slides from the Selenium Clinic Tutorial from Eurostar 2012 hosted by Simon Stewart and Alan Richardson. The tutorial was awarded "Best Tutorial" at the conference.
The reference slides were excerpted from Alan Richardson's online WebDriver course hosted at Udemy.
http://www.udemy.com/selenium-2-webdriver-basics-with-java/
Take Control of your Integration Testing with TestContainersNaresha K
Slides from my demonstration titled "Take Control of your Integration Testing with TestContainers". Demonstrates using TestContainers for RDBMS and test driving S3 API with localstack.
San Francisco Java User Group presents Chris Bedford who talks about:
- How to write functional tests with Selenium (including explaining its IDE, architecture, RC, and alternatives like Canoo WebTest)
- How to set up Selenium testing for web apps in continuous integration using Maven, Ant, Cargo, etc.
- How to use Hudson for build server (brief overview)
January 12, 2010 in San Francisco, CA
http://www.sfjava.org/calendar/11982857/
Hosted by SUPINFO International University
Sponsored by TEKsystems, Guidewire Software, Sun, O'Reilly, JetBrains, and Marakana.
Video by Max Walker
Organized by Marakana
This ppt provide basic understanding regarding Spring Boot. And how to configure Spring Boot application with Hibernate and mysql by using eclipse IDE. Also provides understanding about how to configure Spring Tool Suit (STS) in Eclipse.
Real Java EE Testing with Arquillian and ShrinkWrapDan Allen
Recorded on 2010-04-30 at the Northern Virginia Software Symposium, a stop on the NFJS 2010 tour, this presentation introduces Arquillian, an extension for TestNG and JUnit that provides a component model for tests, making it simple to test real components inside a real container.
A presentation that guides you through the stages of testing your Java enterprise application. Finally it shows you that Arquillian is the best tool for that
Testcontainers - Geekout EE 2017 presentationRichard North
Unit testing our code on the JVM is well catered for with a lot of great tools that are mature and reliable – things tend to just work. Integrated testing, however, is another matter. Any time we face a situation where we need to involve non-JVM elements in our tests, we’re faced with painful environment setup and repeatability issues. Testcontainers aims to make integrated tests a little less unpleasant, through the power of Docker. Databases, Web browsers – in fact anything available as a Docker image – can be made available as a component to use in our tests.
In this talk, we’ll go through the motivations for building Testcontainers, its features, as well as some examples of using it in practice for testing various types of components.
Many developers are on board with writing unit tests for their code. However a lot of developers don’t test as much as they should because deciding how and what to unit test is harder than deciding to test. Laravel 5 is built with great support for unit testing with PHPUnit but testing applications built using the Model View Controller pattern can prove challenging. This talk will cover ways to design your code to make testing easier and also help you decide what should be unit tested and what should be left to other testing methods.
Continuous Integration Testing in DjangoKevin Harvey
Continuous Integration is like having a robot that cleans up after you: it installs your dependencies, builds your project, run your tests, and reports back to you. This presentation outlines two methods for CI: Travis and Jenkins.
how to write functional tests with Selenium. how to set up Selenium Testing On Grails Apps In Continuous
Integration Using two approaches: The long way – using Maven and/or Ant The fast way, using the grails-
selenium-rc plug-in - ( see
http://buildchimp.com/wordpress/?p=241 )
В ходе доклада мы обсудим такие виды тестирования как:
- юнит тестирование,
- тестирование верстки,
- e2e-тестирование,
- тестирование производительности для FE
Также мы коснемся таких фундаментальных вещей, как:
- Что такое F.I.R.S.T
- Где заканчивается ответственность разработчика и начинает - ответственность QA инженера
- Как договариваться с бэкенд разработчиками
- И конечно, почему тесты нужны.
Arquillian (http://jboss.org/arquillian) is a test harness that simplifies integration testing using container managed resources.
ShrinkWrap (http://jboss.org/shrinkwrap) is a fluent Java API for dynamically generating deployable archives.
Slides from the Selenium Clinic Tutorial from Eurostar 2012 hosted by Simon Stewart and Alan Richardson. The tutorial was awarded "Best Tutorial" at the conference.
The reference slides were excerpted from Alan Richardson's online WebDriver course hosted at Udemy.
http://www.udemy.com/selenium-2-webdriver-basics-with-java/
Take Control of your Integration Testing with TestContainersNaresha K
Slides from my demonstration titled "Take Control of your Integration Testing with TestContainers". Demonstrates using TestContainers for RDBMS and test driving S3 API with localstack.
San Francisco Java User Group presents Chris Bedford who talks about:
- How to write functional tests with Selenium (including explaining its IDE, architecture, RC, and alternatives like Canoo WebTest)
- How to set up Selenium testing for web apps in continuous integration using Maven, Ant, Cargo, etc.
- How to use Hudson for build server (brief overview)
January 12, 2010 in San Francisco, CA
http://www.sfjava.org/calendar/11982857/
Hosted by SUPINFO International University
Sponsored by TEKsystems, Guidewire Software, Sun, O'Reilly, JetBrains, and Marakana.
Video by Max Walker
Organized by Marakana
This ppt provide basic understanding regarding Spring Boot. And how to configure Spring Boot application with Hibernate and mysql by using eclipse IDE. Also provides understanding about how to configure Spring Tool Suit (STS) in Eclipse.
Real Java EE Testing with Arquillian and ShrinkWrapDan Allen
Recorded on 2010-04-30 at the Northern Virginia Software Symposium, a stop on the NFJS 2010 tour, this presentation introduces Arquillian, an extension for TestNG and JUnit that provides a component model for tests, making it simple to test real components inside a real container.
How do you tame a big ball of mud? One test at a time.Matt Eland
A broad and high level overview of .NET unit test libraries that will help you write better tests. Discussions around Scientist .NET, Bogus, AutoFixture, Snapper, and others.
JNation - Integration Testing from the Trenches RebootedNicolas Fränkel
Years after Kent Beck provided JUnit, unit testing is part of most developer teams tooling. However, there's a trend that tends to threaten unit testing, claiming only integration testing can truly detects defects in software.
In this talk, we will first define what unit testing and integration testing are, and their respective pros, cons and uses. Then, we will have a look at the unique challenges posed by integration testing. Finally, tools and techniques will be presented to somewhat remedy to that so that integration testing becomes a true asset in each software developer bag of tricks.
You've heard about Continuous Integration and Continuous Deilvery but how do you get code from your machine to production in a rapid, repeatable manner? Let a build pipeline do the work for you! Sam Brown will walk through the how, the when and the why of the various aspects of a Contiuous Delivery build pipeline and how you can get started tomorrow implementing changes to realize build automation. This talk will start with an example pipeline and go into depth with each section detailing the pros and cons of different steps and why you should include them in your build process.
Have you ever wondered what the best way would be to test emails? Or how you would go about testing a messaging queue?
Making sure your components are correctly interacting with each other is both a tester and developer’s concern. Join us to get a better understanding of what you should test and how, both manually and automated.
This session is the first ever in which we will have two units working together to give you a nuanced insight on all aspects of integration testing. We’ll start off exploring the world of integration testing, defining the terminology, and creating a general understanding of what phases and kinds of testing exist. Later on we’ll delve into integration test automation, ranging from database integration testing to selenium UI testing and even as far as LDAP integration testing.
We have a wide variety of demos prepared where we will show you how easy it is to test various components of your infrastructure. Some examples:
- Database testing (JPA)
- Arquillian, exploring container testing, EJB testing and more
- Email testing
- SOAP testing using SoapUI
- LDAP testing
- JMS testing
Continuous Load Testing with CloudTest and JenkinsSOASTA
Two key challenges to continuous load testing are provisioning a test system to handle the load and accessing load generators to drive the traffic.
In this webinar from SOASTA & CloudBees, you will learn how to:
Build realistic automated web performance tests and run them in Jenkins
Architect and launch a test environment that auto-provisions in the cloud
Manage a load generation grid to drive load tests in a lights-out mode
Establish a performance baseline in your daily Jenkins reports
The QA professional is certainly needed within a company. However, in many cases, unfortunately, there are companies that don’t adhere to this professional culture. Increasing the code quality becomes a major challenge for development teams in these cases. This presentation aims to give tips learned from mistakes of this attempt to try to improve the code quality and test execution time for a quick feedback.
Continuous Load Testing with CloudTest and JenkinsSOASTA
Two key challenges to continuous load testing are provisioning a test system to handle the load and accessing load generators to drive the traffic.
In this webinar from SOASTA & CloudBees, you will learn how to:
Build realistic automated web performance tests and run them in Jenkins
Architect and launch a test environment that auto-provisions in the cloud
Manage a load generation grid to drive load tests in a lights-out mode
Establish a performance baseline in your daily Jenkins reports
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...Applitools
** Full webinar recording: **
Two leading developers -- from Jira/ Atlassian and Pushpay -- shared their insights, tip, tricks, and best practices on how to maintain quality across the Dev-Test-Release cycle, without losing speed or coverage.
Talk 1: Reducing the Risk of Rapid Development and Continuous Delivery -- by David Corbett (Director of Engineering @ Pushpay)
In this talk, David showed us what goes on under the hood of Pushpay's development cycle.
He also talked about the ways in which Pushpay is empowering Dev and Test teams to be more autonomous, and prompting them to use advanced test automation tools & techniques, such as visual validation, in order to gain confidence in deploying many times each day.
Talk 2: Testing Hourglass at Jira Frontend -- by Alexey Shpakov (Sr. Developer - Jira Frontend @ Atlassian)
We often hear people talk about the testing pyramid.
In Jira Frontend, we talk about testing hourglass -- that means we expect our developers to be responsible for the whole lifecycle of the code -- starting from creating tests and finishing with running a 24/7 on-call.
In this talk, Alexey did a deep-dive into the various types of testing they have in Jira Frontend, and discussed the various tools that allow them to deliver Jira to customers in a low-risk manner.
5 Steps to Jump Start Your Test AutomationSauce Labs
With the acceleration of software creation and delivery, test activities must align to the new tempo. Developers need immediate feedback to be efficient and correct defects as those are introduced. The path to achieving this vision is to build a reliable and scalable continuous test solution.
All beginnings are hard. Having a well-defined plan outlining the approach for your organization to create test automation is key to ensure long term success. Join Diego Molina, Senior Software Engineer at Sauce Labs as he discusses:
The importance of setting up the team correctly from the start
Choosing the right Testing Framework for your organization
Identifying the right scenarios and workflows to test
Learning to avoid common pitfalls at the beginning of the transformation journey
This is an introduction to unit testing using various mocking frameworks. It covers why you should consider using a mocking framework, how to apply mocks in your unit testing, and a high level comparison of various tools for mocking/stub creation. The distinction between mocks and stubs is clearly defined.
SnowCamp - Adding search to a legacy applicationNicolas Fränkel
Most applications evolve to a point where they need to provide search capabilities. But updating an application is always a risk. Plus, sometimes, you don’t have access to the source code. The easiest way to access the data is by getting them directly from the database.
The initial load is the easiest step. However, how do you keep the search index in sync with the database? How do you keep the latency between the search store and the source of truth, so your users don’t have to wait for the next run of the batch to access the newest changes?
In this live coding session, we will show you how you can solve this issue by connecting Elasticsearch to the database with a touch of Hazelcast.
On dit que GitHub est le CV d'un développeur. Un rapide coup d'œil à votre historique de commit et les recruteurs savent tout de vous. Cette approche comporte quelques problèmes. La plupart des entreprises ne publient même pas leur code sous une licence Open Source. Si vous travaillez pour l'une d'entre elles, et si vous n'êtes pas un développeur Open Source les soirs et les week-ends, alors vous n'avez aucune chance.
Récemment, GitHub a permis un certain degré de personnalisation de son profil. Ainsi, même si votre historique de commit a plus de blanc que de vert, vous pouvez fournir un bon point d'entrée pour les employeurs potentiels. Mais ça ne vaut que l'effort que vous y mettez et les données perdent leur valeur rapidement. Pourtant, avec un peu de travail et l'aide d'outils d'automatisation (tels que GitHub Actions), vous pouvez présenter un profil toujours à jour.
Zero-downtime deployment on Kubernetes with HazelcastNicolas Fränkel
Kubernetes allows a lot. After discovering its features, it’s easy to think it can magically transform your application deployment process into a painless no-event. For Hello World applications, that is the case. Unfortunately, not many of us do deploy such applications day-to-day because we need to handle state. Though it would be much easier to have stateless apps, and despite our best efforts in this direction, state is found in (at least) two places: sessions and databases.
You need to think keeping the state while stopping and starting application nodes. In this talk, I’ll demo how to update a Spring Boot app deployed on a Kubernetes cluster with a non-trivial database schema change with the help of Hazelcast, while keeping the service up during the entire update process.
jLove - A Change-Data-Capture use-case: designing an evergreen cacheNicolas Fränkel
When one’s app is challenged with poor performances, it’s easy to set up a cache in front of one’s SQL database. It doesn’t fix the root cause (e.g. bad schema design, bad SQL query, etc.) but it gets the job done. If the app is the only component that writes to the underlying database, it’s a no-brainer to update the cache accordingly, so the cache is always up-to-date with the data in the database.
Things start to go sour when the app is not the only component writing to the DB. Among other sources of writes, there are batches, other apps (shared databases exist unfortunately), etc. One might think about a couple of ways to keep data in sync i.e. polling the DB every now and then, DB triggers, etc. Unfortunately, they all have issues that make them unreliable and/or fragile.
You might have read about Change-Data-Capture before. It’s been described by Martin Kleppmann as turning the database inside out: it means the DB can send change events (SELECT, DELETE and UPDATE) that one can register to. Just opposite to Event Sourcing that aggregates events to produce state, CDC is about getting events out of states. Once CDC is implemented, one can subscribe to its events and update the cache accordingly. However, CDC is quite in its early stage, and implementations are quite specific.
In this talk, I’ll describe an easy-to-setup architecture that leverages CDC to have an evergreen cache.
BigData conference - Introduction to stream processingNicolas Fränkel
While “software is eating the world”, those who are able to best manage the huge mass of data will emerge out on the top.
The batch processing model has been faithfully serving us for decades. However, it might have reached the end of its usefulness for all but some very specific use-cases. As the pace of businesses increases, most of the time, decision makers prefer slightly wrong data sooner, than 100% accurate data later. Stream processing – or data streaming – exactly matches this usage: instead of managing the entire bulk of data, manage pieces of them as soon as they become available.
In this talk, Nicolas will define the context in which the old batch processing model was born, the reasons that are behind the new stream processing one, how they compare, what are their pros and cons, and a list of existing technologies implementing the latter with their most prominent characteristics. He’ll conclude by describing in detail one possible use-case of data streaming that is not possible with batches: display in (near) real-time all trains in Switzerland and their position on a map. He’ll go through the all the requirements and the design. Finally, using an OpenData endpoint and the Hazelcast platform, he’ll try to impress attendees with a working demo implementation of it.
ADDO - Your own Kubernetes controller, not only in GoNicolas Fränkel
In Kubernetes, operators allow the API to be extended to your heart content. If one task requires too much YAML, it’s easy to create an operator to take care of the repetitive cruft, and only require a minimum amount of YAML.
On the other hand, since its beginnings, the Go language has been advertised as closer to the hardware, and is now ubiquitous in low-level programming. Kubernetes has been rewritten from Java to Go, and its whole ecosystem revolves around Go. For that reason, It’s only natural that Kubernetes provides a Go-based framework to create your own operator. While it makes sense, it requires organizations willing to go down this road to have Go developers, and/or train their teams in Go. While perfectly acceptable, this is not the only option. In fact, since Kubernetes is based on REST, why settle for Go and not use your own favorite language?
In this talk, I’ll describe what is an operator, how they work, how to design one, and finally demo a Java-based operator that is as good as a Go one.
TestCon Europe - Mutation Testing to the Rescue of Your TestsNicolas Fränkel
Unit testing ensures your production code is relevant. But what does ensure your testing code is relevant? Come discover mutation testing and make sure your never forget another assert again.
In the realm of testing, the code coverage metrics is the most often talked about. However, it doesn’t mean that the test has been useful or even that an assert has been coded. Mutation testing is a strategy to make sure that the test code is relevant.
In this talk, Nicolas will explain how Code Coverage is computed and what its inherent flaw is. Afterwards, he will describe how Mutation Testing work and how it helps pointing out code that is tested but leave out corner cases. He will also demo PIT, a Java production-grade framework that enables Mutation Testing.
OSCONF Jaipur - A Hitchhiker's Tour to Containerizing a Java applicationNicolas Fränkel
As “the Cloud” becomes more and more widespread, now is a good time to assess how you can containerize your Java application. I assume you’re able to write a a Dockerfile around the generated JAR. However, each time the application’s code will change, the whole image will need to be rebuilt. If you’re deploying to a local Kubernetes cluster environment, this increases that much the length of the feedback loop.
In this demo-based talk, I’ll present different ways to get your Java app in a container: Dockerfile, Jib, and Cloud Native Buildpacks. We will also have a look at what kind of Docker image they generate, how they layer the images, whether those images are compatible with skaffold, etc.
GeekcampSG 2020 - A Change-Data-Capture use-case: designing an evergreen cacheNicolas Fränkel
CDC is a brand new approach that "turns the database inside out": it allows to get events out of the database state. This can be leveraged to get a cache that is never stale.
JavaDay Istanbul - 3 improvements in your microservices architectureNicolas Fränkel
While a microservices architecture is more scalable than a monolith, it has a direct hit on performance.
To cope with that, one performance improvement is to set up a cache. It can be configured for database access, for REST calls or just to store session state across a cluster of server nodes. In this demo-based talk, I’ll show how Hazelcast In-Memory Data Grid can help you in each one of those areas and how to configure it. Hint: it’s much easier than one would expect.
At a point in the past, it was forecast that Java would die, but the JVM platform would be its legacy. And in fact, for a long time, the JVM has been tremendously successful. Wikipedia itself lists a bunch of languages that run on it, some of them close to Java e.g. Kotlin, some of them very remote e.g. Clojure.
But nowadays, the Cloud is becoming ubiquitous. Containerization is the way to go to alleviate some of the vendor lock-in issues. Kubernetes is a de facto platform. If a container needs to be killed for whatever reason (resource consumption, unhealthy, etc.), a new one needs to replace it as fast as possible. In that context, the JVM seems to be a dead-end: its startup time is huge in comparison to a native process. Likewise, it consumes a lot of memory that just increase the monthly bill.
What does that mean for us developers? Has all the time spent in learning the JVM ecosystem been invested with no hope of return over investment? Shall we need to invest even more time in new languages, frameworks, libraries, etc.? That is one possibility for sure. But we can also leverage our existing knowledge, and embrace the Cloud and containers ways with the help of some tools.
In this talk, I’ll create a simple URL shortener with a “standard” stack: Kotlin, JAX-RS and Hazelcast. Then, with the help of Quarkus and GraalVM, I’ll turn this application into a native executable with all Cloud/Container related work has been moved to the build process.
Devclub.lv - Introduction to stream processingNicolas Fränkel
While “software is eating the world”, those who are able to best manage the huge mass of data will emerge out on the top.
The batch processing model has been faithfully serving us for decades. However, it might have reached the end of its usefulness for all but some very specific use-cases. As the pace of businesses increases, most of the time, decision-makers prefer slightly wrong data sooner, than 100% accurate data later. Stream processing – or data streaming – exactly matches this usage: instead of managing the entire bulk of data, manage pieces of them as soon as they become available.
OSCONF Koshi - Zero downtime deployment with Kubernetes, Flyway and Spring BootNicolas Fränkel
Kubernetes allows a lot. After discovering its features, it’s easy to think it can magically transform your application deployment process into a painless no-event. For Hello World applications, that is the case. Unfortunately, not many of us do deploy such applications day-to-day. You need to think about application backward compatibility, possible rollback, database schema migration, etc. I believe the later is one of the biggest pain point. In this talk, I’ll demo how to update a Spring Boot app deployed on a Kubernetes cluster with a non-trivial database schema migration with the help of Flyway, while keeping the service up during the entire update process.
JOnConf - A CDC use-case: designing an Evergreen CacheNicolas Fränkel
When one’s app is challenged with poor performances, it’s easy to set up a cache in front of one’s SQL database. It doesn’t fix the root cause (e.g. bad schema design, bad SQL query, etc.) but it gets the job done. If the app is the only component that writes to the underlying database, it’s a no-brainer to update the cache accordingly, so the cache is always up-to-date with the data in the database.
Things start to go sour when the app is not the only component writing to the DB. Among other sources of writes, there are batches, other apps (shared databases exist unfortunately), etc. One might think about a couple of ways to keep data in sync i.e. polling the DB every now and then, DB triggers, etc. Unfortunately, they all have issues that make them unreliable and/or fragile.
You might have read about Change-Data-Capture before. It’s been described by Martin Kleppmann as turning the database inside out: it means the DB can send change events (SELECT, DELETE and UPDATE) that one can register to. Just opposite to Event Sourcing that aggregates events to produce state, CDC is about getting events out of states. Once CDC is implemented, one can subscribe to its events and update the cache accordingly. However, CDC is quite in its early stage, and implementations are quite specific.
In this talk, I’ll describe an easy-to-setup architecture that leverages CDC to have an evergreen cache.
London In-Memory Computing Meetup - A Change-Data-Capture use-case: designing...Nicolas Fränkel
When one’s app is challenged with poor performances, it’s easy to set up a cache in front of one’s SQL database. It doesn’t fix the root cause (e.g. bad schema design, bad SQL query, etc.) but it gets the job done. If the app is the only component that writes to the underlying database, it’s a no-brainer to update the cache accordingly, so the cache is always up-to-date with the data in the database.
Things start to go sour when the app is not the only component writing to the DB. Among other sources of writes, there are batches, other apps (shared databases exist, unfortunately), etc. One might think about a couple of ways to keep data in sync i.e. polling the DB every now and then, DB triggers, etc. Unfortunately, they all have issues that make them unreliable and/or fragile.
In this talk, I will describe an easy-to-setup architecture that leverages CDC to have an evergreen cache.
This talk will be about the reasons behind the new stream processing model, how it compare to the old batch model, what are their pros and cons, and a list of existing technologies implementing stream processing with their most prominent characteristics. It will contain details of one possible use-case of data streaming that is not possible with batches: display in (near) real-time all trains in Switzerland and their position on a map, beginning with an overview of all the requirements and the design. Finally, using an OpenData endpoint and the Hazelcast platform,showing a working demo implementation of it.
Java.IL - Your own Kubernetes controller, not only in Go!Nicolas Fränkel
In Kubernetes, operators allow the API to be extended to your heart content. If one task requires too much YAML, it’s easy to create an operator to take care of the repetitive cruft, and only require a minimum amount of YAML.
On the other hand, since its beginnings, the Go language has been advertised as closer to the hardware, and is now ubiquitous in low-level programming. Kubernetes has been rewritten from Java to Go, and its whole ecosystem revolves around Go. For that reason, It’s only natural that Kubernetes provides a Go-based framework to create your own operator. While it makes sense, it requires organizations willing to go down this road to have Go developers, and/or train their teams in Go. While perfectly acceptable, this is not the only option. In fact, since Kubernetes is based on REST, why settle for Go and not use your own favorite language?
In this talk, I’ll describe what is an operator, how they work, how to design one, and finally demo a Java-based operator that is as good as a Go one.
While “software is eating the world”, those who are able to best manage the huge mass of data will emerge out on the top.
The batch processing model has been faithfully serving us for decades. However, it might have reached the end of its usefulness for all but some very specific use-cases. As the pace of businesses increases, most of the time, decision makers prefer slightly wrong data sooner, than 100% accurate data later. Stream processing - or data streaming - exactly matches this usage: instead of managing the entire bulk of data, manage pieces of them as soon as they become available.
In this talk, I’ll define the context in which the old batch processing model was born, the reasons that are behind the new stream processing one, how they compare, what are their pros and cons, and a list of existing technologies implementing the latter with their most prominent characteristics. I’ll conclude by describing in detail one possible use-case of data streaming that is not possible with batches: display in (near) real-time all trains in Switzerland and their position on a map. I’ll go through the all the requirements and the design. Finally, using an OpenData endpoint and the Hazelcast platform, I’ll try to impress attendees with a working demo implementation of it.
London Java Community - An Experiment in Continuous Deployment of JVM applica...Nicolas Fränkel
A couple of years ago, continuous integration in the JVM ecosystem meant Jenkins. Since that time, a lot of other tools have been made available. But new tools don’t mean new features, just new ways. Besides that, what about continuous deployment? There’s no tool that allows deploying new versions of a JVM-based application without downtime. The only way to achieve zero downtime is to have multiple nodes deployed on a platform, and let that platform achieve that e.g. Kubernetes.
And yet, achieving true continuous deployment of bytecode on one single JVM instance is possible if one changes one’s way of looking at things. What if the compilation could be seen as changes? What if those changes could be stored in a data store, and a listener on this data store could stream those changes to the running production JVM via the Attach API?
In this talk, we'll demo exactly that using Hazelcast and Hazelcast Jet - but it’s possible to re-use the principles that will be shown using other streaming technologies.
OSCONF - Your own Kubernetes controller: not only in GoNicolas Fränkel
In Kubernetes, operators allow the API to be extended to your heart content. If one task requires too much YAML, it’s easy to create an operator to take care of the repetitive cruft, and only require a minimum amount of YAML.
On the other hand, since its beginnings, the Go language has been advertised as closer to the hardware, and is now ubiquitous in low-level programming. Kubernetes has been rewritten from Java to Go, and its whole ecosystem revolves around Go. For that reason, It’s only natural that Kubernetes provides a Go-based framework to create your own operator. While it makes sense, it requires organizations willing to go down this road to have Go developers, and/or train their teams in Go. While perfectly acceptable, this is not the only option. In fact, since Kubernetes is based on REST, why settle for Go and not use your own favourite language?
In this talk, I will describe what an operator is, how they work, how to design one, and finally demo a Java-based operator that is as good as a Go one.
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppGoogle
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-fusion-buddy-review
AI Fusion Buddy Review: Key Features
✅Create Stunning AI App Suite Fully Powered By Google's Latest AI technology, Gemini
✅Use Gemini to Build high-converting Converting Sales Video Scripts, ad copies, Trending Articles, blogs, etc.100% unique!
✅Create Ultra-HD graphics with a single keyword or phrase that commands 10x eyeballs!
✅Fully automated AI articles bulk generation!
✅Auto-post or schedule stunning AI content across all your accounts at once—WordPress, Facebook, LinkedIn, Blogger, and more.
✅With one keyword or URL, generate complete websites, landing pages, and more…
✅Automatically create & sell AI content, graphics, websites, landing pages, & all that gets you paid non-stop 24*7.
✅Pre-built High-Converting 100+ website Templates and 2000+ graphic templates logos, banners, and thumbnail images in Trending Niches.
✅Say goodbye to wasting time logging into multiple Chat GPT & AI Apps once & for all!
✅Save over $5000 per year and kick out dependency on third parties completely!
✅Brand New App: Not available anywhere else!
✅ Beginner-friendly!
✅ZERO upfront cost or any extra expenses
✅Risk-Free: 30-Day Money-Back Guarantee!
✅Commercial License included!
See My Other Reviews Article:
(1) AI Genie Review: https://sumonreview.com/ai-genie-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
#AIFusionBuddyReview,
#AIFusionBuddyFeatures,
#AIFusionBuddyPricing,
#AIFusionBuddyProsandCons,
#AIFusionBuddyTutorial,
#AIFusionBuddyUserExperience
#AIFusionBuddyforBeginners,
#AIFusionBuddyBenefits,
#AIFusionBuddyComparison,
#AIFusionBuddyInstallation,
#AIFusionBuddyRefundPolicy,
#AIFusionBuddyDemo,
#AIFusionBuddyMaintenanceFees,
#AIFusionBuddyNewbieFriendly,
#WhatIsAIFusionBuddy?,
#HowDoesAIFusionBuddyWorks
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeAftab Hussain
Understanding variable roles in code has been found to be helpful by students
in learning programming -- could variable roles help deep neural models in
performing coding tasks? We do an exploratory study.
- These are slides of the talk given at InteNSE'23: The 1st International Workshop on Interpretability and Robustness in Neural Software Engineering, co-located with the 45th International Conference on Software Engineering, ICSE 2023, Melbourne Australia
Navigating the Metaverse: A Journey into Virtual Evolution"Donna Lenk
Join us for an exploration of the Metaverse's evolution, where innovation meets imagination. Discover new dimensions of virtual events, engage with thought-provoking discussions, and witness the transformative power of digital realms."
Software Engineering, Software Consulting, Tech Lead, Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Transaction, Spring MVC, OpenShift Cloud Platform, Kafka, REST, SOAP, LLD & HLD.
Enterprise Resource Planning System includes various modules that reduce any business's workload. Additionally, it organizes the workflows, which drives towards enhancing productivity. Here are a detailed explanation of the ERP modules. Going through the points will help you understand how the software is changing the work dynamics.
To know more details here: https://blogs.nyggs.com/nyggs/enterprise-resource-planning-erp-system-modules/
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Crescat
Crescat is industry-trusted event management software, built by event professionals for event professionals. Founded in 2017, we have three key products tailored for the live event industry.
Crescat Event for concert promoters and event agencies. Crescat Venue for music venues, conference centers, wedding venues, concert halls and more. And Crescat Festival for festivals, conferences and complex events.
With a wide range of popular features such as event scheduling, shift management, volunteer and crew coordination, artist booking and much more, Crescat is designed for customisation and ease-of-use.
Over 125,000 events have been planned in Crescat and with hundreds of customers of all shapes and sizes, from boutique event agencies through to international concert promoters, Crescat is rigged for success. What's more, we highly value feedback from our users and we are constantly improving our software with updates, new features and improvements.
If you plan events, run a venue or produce festivals and you're looking for ways to make your life easier, then we have a solution for you. Try our software for free or schedule a no-obligation demo with one of our product specialists today at crescat.io
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
AI Genie Review: World’s First Open AI WordPress Website CreatorGoogle
AI Genie Review: World’s First Open AI WordPress Website Creator
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-genie-review
AI Genie Review: Key Features
✅Creates Limitless Real-Time Unique Content, auto-publishing Posts, Pages & Images directly from Chat GPT & Open AI on WordPress in any Niche
✅First & Only Google Bard Approved Software That Publishes 100% Original, SEO Friendly Content using Open AI
✅Publish Automated Posts and Pages using AI Genie directly on Your website
✅50 DFY Websites Included Without Adding Any Images, Content Or Doing Anything Yourself
✅Integrated Chat GPT Bot gives Instant Answers on Your Website to Visitors
✅Just Enter the title, and your Content for Pages and Posts will be ready on your website
✅Automatically insert visually appealing images into posts based on keywords and titles.
✅Choose the temperature of the content and control its randomness.
✅Control the length of the content to be generated.
✅Never Worry About Paying Huge Money Monthly To Top Content Creation Platforms
✅100% Easy-to-Use, Newbie-Friendly Technology
✅30-Days Money-Back Guarantee
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
#AIGenieApp #AIGenieBonus #AIGenieBonuses #AIGenieDemo #AIGenieDownload #AIGenieLegit #AIGenieLiveDemo #AIGenieOTO #AIGeniePreview #AIGenieReview #AIGenieReviewandBonus #AIGenieScamorLegit #AIGenieSoftware #AIGenieUpgrades #AIGenieUpsells #HowDoesAlGenie #HowtoBuyAIGenie #HowtoMakeMoneywithAIGenie #MakeMoneyOnline #MakeMoneywithAIGenie
Artificia Intellicence and XPath Extension FunctionsOctavian Nadolu
The purpose of this presentation is to provide an overview of how you can use AI from XSLT, XQuery, Schematron, or XML Refactoring operations, the potential benefits of using AI, and some of the challenges we face.
Mobile App Development Company In Noida | Drona InfotechDrona Infotech
Looking for a reliable mobile app development company in Noida? Look no further than Drona Infotech. We specialize in creating customized apps for your business needs.
Visit Us For : https://www.dronainfotech.com/mobile-application-development/
Utilocate offers a comprehensive solution for locate ticket management by automating and streamlining the entire process. By integrating with Geospatial Information Systems (GIS), it provides accurate mapping and visualization of utility locations, enhancing decision-making and reducing the risk of errors. The system's advanced data analytics tools help identify trends, predict potential issues, and optimize resource allocation, making the locate ticket management process smarter and more efficient. Additionally, automated ticket management ensures consistency and reduces human error, while real-time notifications keep all relevant personnel informed and ready to respond promptly.
The system's ability to streamline workflows and automate ticket routing significantly reduces the time taken to process each ticket, making the process faster and more efficient. Mobile access allows field technicians to update ticket information on the go, ensuring that the latest information is always available and accelerating the locate process. Overall, Utilocate not only enhances the efficiency and accuracy of locate ticket management but also improves safety by minimizing the risk of utility damage through precise and timely locates.
2. Me, myself and I
Developer & Architect as consultant
Wide range of businesses & customers
Teacher & Trainer
Speaker
Blogger
http://blog.frankel.ch/
(http://morevaadin.com/)
https://leanpub.com/integrationtest 2
4. Plan
Integration Testing
What is that?
Challenges
Solution hints
Testing with resource dependencies
Database
Web Services
Testing In-container
Spring & Spring MVC
JavaEE
https://leanpub.com/integrationtest 4
6. There are many different kinds of testing
Unit Testing
Mutation Testing
Integration Testing
GUI Testing
Performance Testing
Load Testing
Stress Testing
Endurance Testing
Security Testing
etc.
https://leanpub.com/integrationtest 6
7. Unit Testing vs. Integration Testing
Unit Testing
Testing a unit (i.e. a class) in
isolation
Integration Testing
Testing the collaboration of
multiple units
https://leanpub.com/integrationtest 7
"Savate fouetté figure 1" by Daniel - Photo Daniel.
8. https://leanpub.com/integrationtest 8
A concrete example
Let’s take an example
A prototype car
"2011 Nissan Leaf WAS 2011 1040" by Mariordo Mario Roberto Duran Ortiz - Own work
9. Unit Testing
Akin to testing each nut
and bolt separately
https://leanpub.com/integrationtest 9
10. Integration Testing
Akin to going on a test
drive
https://leanpub.com/integrationtest 10
"URE05e" by Marvin Raaijmakers - Own work.
11. Unit Testing + Integration Testing
Approaches are not
exclusive but
complementary
Would you take a prototype
car on test drive without
having tested only nuts and
bolts?
Would you manufacture a car
from a prototype having only
tested nuts and bolts but
without having tested it on
numerous test drives?
https://leanpub.com/integrationtest 11
12. System Under Test
The SUT is what get
tested
Techniques from Unit
Testing can be re-used
Dependency Injection
Test doubles
https://leanpub.com/integrationtest 12
13. Testing is about ROI
The larger the SUT
The more fragile the test
The less maintainable the test
The less the ROI
Thus, tests have to be
organized in a pyramidal
way
The bigger the SUT
The less the number of tests
Integration Testing
Test standard cases
Generally not error cases
https://leanpub.com/integrationtest 13
http://martinfowler.com/bliki/TestPyramid.html
14. Integration Testing Challenges
Brittle
Dependent on external
resources
Database(s)
etc.
Slow
Dependent on external
resources
Hard to diagnose
https://leanpub.com/integrationtest 14
15. How to cope
Separate Integration
Tests from Unit Tests
Fake required
infrastructure resources
Test in-container
https://leanpub.com/integrationtest 15
16. But IT are still slow?!
Separating UT & IT
doesn’t make IT run
faster
But you can uncover
errors from UT faster
Fail Fast
It will speed testing
https://leanpub.com/integrationtest 16
"Gepardjagt2 (Acinonyx jubatus)" by Malene Thyssen - Own work.
17. Integration Testing and build
Available tools
Ant
Maven
Gradle
etc.
https://leanpub.com/integrationtest 17
New Development Recently Finished on Bristol's City Centre by Brizzleboy
19. Reminder on Surefire
Bound to the test phase
Runs by default
*Test
Test*
*TestCase
https://leanpub.com/integrationtest 19
20. Failsafe
“Copy” of Surefire
Different defaults
*IT
IT*
*ITCase
One goal per lifecycle
phase
pre-integration-test
integration-test
post-integration-test
verify
Must be bound explicitly
https://leanpub.com/integrationtest 20
22. Continuous Integration
Needs a build configured
Suggestions
Unit Tests run at each commit
Integration Tests run “regularly”
Daily
Hourly
Depending on the context
https://leanpub.com/integrationtest 22
24. Infrastructure dependencies
Database
Filesystem
Time
Message Oriented
Middleware
Mail server
FTP server
etc.
https://leanpub.com/integrationtest 24
25. Mocks and infrastructure dependencies
To test your Service
Mock your DAO/repository
Mockito
To test your DAO/repository
Mock your database???
https://leanpub.com/integrationtest 25
26. Simple database use-case
Oracle database
Use an in-memory datasource
and hope for the best
Use Oracle Express and hope
for the best
Use a dedicated remote
schema for each developer
And your DBAs will hate you
https://leanpub.com/integrationtest 26
27. Reducing database gap risk
In-memory databases are easy to
setup
h2 is such a database
(successor of HSQL)
Compatibility modes for most
widespread DB
jdbc:h2:mem:test;MODE=Oracle
https://leanpub.com/integrationtest 27
28. Parameterizing properties
Use properties for tests
only
db.url=
db.driver=
db.username=
db.password=
And use your favorite
build tool
Maven
Resource filtering
Ant
Gradle
https://leanpub.com/integrationtest 28
29. Integration Testing with Web Services
Web Services also are an
infrastructure resource
Hosted on-site
Or outside
Different Web Services
types have different
solutions
RESTful
SOAP
https://leanpub.com/integrationtest 29
30. Faking RESTful WS
Require an HTTP server
Requirements
Easy setup
Standalone
Embeddable in tests
Spring MVC?
Requires a servlet container
(Not with Spring Boot)
Some code to write
https://leanpub.com/integrationtest 30
Author: Dwight Sipler from Stow, MA, USA
31. Spark to the rescue
Micro web framework
A la Sinatra
http://www.sparkjava.com/
Very few lines of code
Just wire to serve JSON files
https://leanpub.com/integrationtest 31
33. Faking SOAP web service
Possible to use Spark for SOAP
But unwieldy
https://leanpub.com/integrationtest 33
34. SOAPUI
SOAPUI is the framework to test SOAP WS
Has a GUI
Good documentation
Understands
Authentication
Headers
Etc.
Can be used to Fake SOAP WS
https://leanpub.com/integrationtest 34
35. SOAPUI usage
Get WSDL
Either online
Or from a file
Create MockService
Craft the adequate response
Run the service
Point the dependency to localhost
https://leanpub.com/integrationtest 35
36. Challenges to the previous scenario
Craft the adequate response?
More likely get one from the real WS
And tweak it
Running in an automated way
Save the project
Get the SOAPUI jar
Read the project and launch
https://leanpub.com/integrationtest 37
38. Faking Web Service in real-life
Use the same rules as for UT
Keep validation simple
Test one thing
One Assert
Or a set of related ones
Keep setup simple
Don’t put complex logic
Don’t put too much logic
Don’t put logic at all
Duplicate setup in each test
Up to a point
https://leanpub.com/integrationtest 39
Author: I, rolf B
40. Upping the ante
Testing collaboration is nice
Faking infrastructure dependencies is nice
But didn’t we forget the most important
dependency?
https://leanpub.com/integrationtest 41
41. The container!
“Proprietary” container
Spring
Application Server
Tomcat
JBoss
<Place your favorite one here>
https://leanpub.com/integrationtest 42
42. Spring
So far, we can test:
Beans which dependencies can be mocked (or not)
Service
Beans that depend on fake resources
Datasource
What about the configuration?
In Unit Tests, we set dependencies
The real configuration is not used
Ergo, not tested!
https://leanpub.com/integrationtest 43
43. Testing configuration
Configuration cannot be monolithic
Break down into fragments
Each fragment contains a set of either
Real beans
Fake beans
https://leanpub.com/integrationtest 44
Rudston Monolith May 2013 by Angela Findlay
44. Data source configuration fragment management example
Different configuration
fragments
Production JNDI fragment
Test in-memory fragment
https://leanpub.com/integrationtest 45
46. Fragment structure
1. Main fragment
Repository
Service
etc.
2. Prod DB fragment
3. Test DB fragment
https://leanpub.com/integrationtest 47
47. Tips
Prevent coupling
No fragments reference in fragments
Use top-level assembly instead
Tests
Application Context
Webapps
Pool exhaustion check
Set the maximum number of connections in the
pool to 1
Compile-time safety
Use JavaConfig
Not related to testing
https://leanpub.com/integrationtest 48
48. And now, how to test?
Get access to both
The entry point
And the “end” point
Spring Test to the rescue
Integration with common
Testing frameworks
JUnit
TestNG
https://leanpub.com/integrationtest 49
St Louis Gateway Arch 1916" by Dirk Beyer - Own work.
49. Favor TestNG
Extra grouping
Per layer
Per use-case
Name your own
Extra lifecycle hooks
Better parameterization
Data Provider
Ordering of test methods
https://leanpub.com/integrationtest 50
50. Spring TestNG integration
AbstractTestNGSpringContextTests
AbstractTransactionalTestNGSpringContextTests
Configurable context fragments
@ContextConfiguration
Inject any bean in the test class
If necessary, applicatonContext member from
superclass
https://leanpub.com/integrationtest 51
51. Sample TestNG test with Spring
@ContextConfiguration(
classes = { MainCfg.class, AnotherCfg.class })
public class OrderIT extends
AbstractTestNGSpringContextTests {
@Autowired
private OrderService orderService;
@Test
public void should_do_this_and_that() {
orderService.order();
Assert.assertThat(...)
}
https://leanpub.com/integrationtest 52
}
52. Testing with the DB (or other transactional resources)
Transactions
Bound to business
functionality
Implemented on Service layer
With DAO
Use explicit transaction
management
@Transactional
https://leanpub.com/integrationtest 53
53. Transaction management tip
Tests fail… sometimes
How to audit state?
By default, Spring rollbacks
transactions
General configuration
@TransactionConfiguration(
defaultRollback = false
)
Can be overridden on a per-method
basis
@Rollback(true)
https://leanpub.com/integrationtest 54
54. Sample Transaction management
@ContextConfiguration
@TransactionConfiguration(defaultRollback = false)
public class OverrideDefaultRollbackSpringTest extends
AbstractTransactionalTestNGSpringContextTests {
@Test
@Rollback(true)
public void transaction_will_be_rollbacked() { ... }
@Test
public void transaction_wont_be_rollbacked() {
...
}
}
https://leanpub.com/integrationtest 55
55. Spring MVC webapps Testing
Require a context hierachy
Parent as main context
Child as webapp context
@ContextHierarchy
Require a webapp configuration
@WebAppConfiguration
https://leanpub.com/integrationtest 56
56. Spring MVC test sample
@WebAppConfiguration
@ContextHierarchy({
@ContextConfiguration(classes = MainConfig.class),
@ContextConfiguration(classes = WebConfig.class)
})
public class SpringWebApplicationTest
extends AbstractTestNGSpringContextTests {
...
}
https://leanpub.com/integrationtest 57
57. Entry points for testing Spring webapps
At the HTML level
At the HTTP level
At the Controller level
Like standard Java testing
https://leanpub.com/integrationtest 58
"Lahntunnel Weilburg" by rupp.de - Own work.
58. Tools for testing webapps
HTML testing tools
Interact with HTML/CSS
Fill this field
Click on that button
HTTP testing tools
Send HTTP requests
Get HTTP responses
https://leanpub.com/integrationtest 59
60. Drawback of Testing with controllers as entry point
Bypass many URL-related
features
Interceptors
Spring Security
etc.
https://leanpub.com/integrationtest 61
Controller SCSI.JPG by Rosco
61. Spring Test to the rescue
Spring Test has a large
chunk dedicated to MVC
Since 3.2
Can test with URL as
entry-points
Fluent API with static
imports
https://leanpub.com/integrationtest 62
Coastguard Helicopter (8016050677)" by Paul Lucas from Leicestershire, UK - Coastguard Helicopter
62. Spring MVC Test overview
https://leanpub.com/integrationtest 63
63. MockMvc class responsibilities
Request builder
Configures the Fake request
Request matcher
Misc. assertions
Request handler
Do something
OOB logger
https://leanpub.com/integrationtest 64
64. Available configuration on Request Builder
HTTP method
GET
POST
etc.
HTTP related stuff
Headers
Parameters
Content
JavaEE related stuff
Request attributes
Session
etc.
https://leanpub.com/integrationtest 65
66. You can use constants in your @RequestMapping
@Controller
public class MyController {
public static final String PATH = "/customer/{id}";
@RequestMapping(PATH)
public String showCustomer() { ... }
https://leanpub.com/integrationtest 67
}
MockHttpServletRequestBuilder builder = get(PATH, 1L);
67. Some matchers
Checks result is a
Forward
Either exact
Or regexp
Redirect
Either exact
Or regexp
JSON payload
https://leanpub.com/integrationtest 68
a safety wax match box and matches by Aathavan jaffna
68. Some other matchers
Request class
Handler class
Controller
Content class
Cookie class
Status class
HTTP code
Flash class
(Attributes, not the techno)
View class
Model class
https://leanpub.com/integrationtest 69
"Ovejas en Patagonia - Argentina" by writtecarlosantonio
70. Integration Testing on Spring Pet Clinic
@WebAppConfiguration
@ContextHierarchy({
@ContextConfiguration("classpath:spring/business-config.xml"),
@ContextConfiguration("classpath:spring/mvc-core-config.xml")
})
@ActiveProfiles("jdbc")
public class PetControlIT extends AbstractTestNGSpringContextTests {
@Test
public void should_display_create_form() throws Exception {
WebApplicationContext wac =
(WebApplicationContext) applicationContext;
MockMvc mvc = MockMvcBuilders.webAppContextSetup(wac).build();
MockHttpServletRequestBuilder newPet =
get("/owners/{ownerId}/pets/new", 1);
mvc.perform(newPet)
.andExpect(view().name("pets/createOrUpdatePetForm"))
.andExpect(model().attributeExists("pet"));
}
}
https://leanpub.com/integrationtest 71
71. The JavaEE world
JavaEE has unique
challenges
CDI has no explicit wiring
You can @Veto you own
classes
But no compiled ones
Different application servers
Same specifications
Different implementations
https://leanpub.com/integrationtest 72
72. Deploy only what you want
Standalone API to deploy
only resources relevant
to the test
Just pick and choose
Maven Integration
Gradle too…
https://leanpub.com/integrationtest 73
75. Different application servers
Abstraction layer to
Download
Deploy applications
Test
Container adapters
TomEE
JBoss
Weld
etc.
Full Maven integration
https://leanpub.com/integrationtest 76
76. Arquillian Test sample
public class ArquillianSampleIT extends Arquillian {
@Inject
private MyService myService;
@Deployment
public static JavaArchive createDeployment() {
return ...;
}
@Test
public void should_handle_service() {
Object value = myService.handle();
Assert.assertThat(...);
}
}
https://leanpub.com/integrationtest 77
skinparam dpi 150
class A
class B
package SUT {
class C
class D
}
class E
class F
A .right.> B
B .down.> C
C .right.> D
D ..> E
E .right.> F
hide empty members
skinparam dpi 150
package "Test Config" <<Rect>> {
class "<bean\nclass='o.a.t.j.p.DataSource'>" as testdb
}
package "Prod Config" <<Rect>> {
class "<jee:jndi-lookup\njndi-name='jdbc/MyDS' />" as jndidb
}
package "Main Config" <<Rect>> {
class Service
class Repository
class "id=datasource" as dbbean
}
Service --> "1" Repository
Repository --> "1" dbbean
testdb -up-|> dbbean
jndidb -up-|> dbbean
hide circle
hide empty members