08-Oleg-Šelajev.txt

Delightful Integration Testing with Oleg Šelajev
Jim Grisanzio with Oleg Šelajev
Duke’s Corner Podcast — August 30, 2022

Duke’s Corner Podcast with Java developer and JavaOne 2022 speaker Oleg Šelajev from Tartu, Estonia. Oleg works in developer relations at AtomicJar. He’s also a Java Champion and a regular conference speaker. In this conversation Oleg previews his upcoming session at JavaOne — Delightful Integration Tests with Test Containers.

https://dukescorner.libsyn.com/delightful-integration-testing-with-oleg-elajev

Transcript:

(00:00:00):
Hey, it’s Jim.

(00:00:00):
Welcome back to Duke’s Corner.

(00:00:02):
And we’ve got now the third speaker profile for Java 1.

(00:00:07):
And this is with Oleg Šelajev, a friend of mine from Tartu, Estonia.

(00:00:11):
Oleg works at Atomic Jar, which is a startup, and he specializes in integration testing.

(00:00:19):
And yeah, so we just talk about his session, talk a little bit about Java 1.

(00:00:25):
And got a few more interviews, three, four more to come in terms of previews for Java 1.

(00:00:31):
And we will see you there and enjoy the conversation with Oleg.

(00:00:35):
See you.

(00:00:41):
Oleg, Oleg Šelajev, welcome to Duke’s Corner.

(00:00:45):
Hi, Jim.

(00:00:46):
Glad to be here.

(00:00:47):
it’s good to see you i haven’t i guess i saw you last in um it was probably atlanta

(00:00:53):
or maybe it was stockholm i’m not sure one of the other it was devnexus most

(00:00:58):
probably devnexus yeah okay well now we’re talking because um doing a little bit of

(00:01:04):
a sort of a preview with java one because i see you on the speaker list uh java one

(00:01:08):
is back that’s really cool um and be great to get everybody back together again and

(00:01:14):
get that

(00:01:15):
you know, feel of the conference for so many years that ran and you’re doing a session.

(00:01:21):
So let’s talk a little bit about your session and then a little bit about Java 1

(00:01:25):
and then a little bit about the community maybe and then wrap it up.

(00:01:29):
So I hear you’re doing a session on integration tests.

(00:01:33):
Let’s start there.

(00:01:34):
What’s up with that?

(00:01:36):
Yeah,

(00:01:36):
so I work at Atomic Jar,

(00:01:39):
which is the startup by the maintainers of the Test Containers Libraries,

(00:01:43):
which is the libraries to simplify and enhance your integration tests.

(00:01:48):
And my session is Delightful Integration Test with Test Containers,

(00:01:53):
which is an introductory session where we’re going to talk about Test Containers Libraries,

(00:01:58):
what they give you as a developer,

(00:02:00):
and how you can write your tests differently using them.

(00:02:05):
In short, Test Containers sort of integrates.

(00:02:08):
On one hand,

(00:02:09):
it integrates with the Docker API and allows you to run anything that is runnable

(00:02:16):
in a Docker container.

(00:02:17):
For the integration task specifically,

(00:02:19):
you want to run the technologies that your application depends on,

(00:02:22):
like your database,

(00:02:24):
maybe your Kafka, Elasticsearch, your other message brokers, maybe even cloud technologies, right?

(00:02:31):
So you want to run your application during the tests with the real technologies

(00:02:37):
it’s gonna use in production because it will increase the reliability and

(00:02:42):
trustworthiness of your tests.

(00:02:44):
So test containers give you the flexible programmatic API to control,

(00:02:47):
create,

(00:02:48):
and configure those third-party components that you need for your test runs.

(00:02:54):
And on the other hand,

(00:02:55):
Test Containers integrates with your application frameworks,

(00:02:59):
Spring Boot,

(00:03:00):
Micronaut,

(00:03:00):
Quarkus,

(00:03:01):
you name it,

(00:03:02):
and with your test libraries,

(00:03:04):
JUnit,

(00:03:05):
Spock.

(00:03:06):
So it gives you the full flexibility over the control of those third-party services

(00:03:12):
that you need and ties them into the lifecycle of your tasks or your application.

(00:03:18):
So it seamlessly connects those two things.

(00:03:24):
And being code first, it doesn’t require you to specify the configuration somewhere external.

(00:03:33):
So you just write your test as you would write your normal unit tests,

(00:03:37):
and you run it the same way from your ID,

(00:03:40):
from your command line,

(00:03:41):
in your CI environment,

(00:03:43):
right?

(00:03:44):
But your application will run and test,

(00:03:46):
like the test will run in the context of the actual technologies,

(00:03:50):
which is a superior way to test applications.

(00:03:54):
And I think specifically the more modern kind of sort of

(00:04:01):
The way we write applications nowadays,

(00:04:03):
microservices very often depend on a ton of technologies and contain maybe less

(00:04:11):
intricate business logic in itself.

(00:04:14):
So we’re going to talk about that on the session.

(00:04:17):
So why the first word of the title is delightful?

(00:04:21):
I mean, from your description, it sounds like a very comprehensive

(00:04:26):
um you know a piece of technology but um which is great but you know why delightful

(00:04:31):
that’s an interesting turn of phrase juxtaposed with the concept of doing

(00:04:36):
integration tests

(00:04:38):
Yeah,

(00:04:40):
so when I was looking on how to describe the tasks that you get with test containers,

(00:04:48):
the important bits there,

(00:04:49):
and I think this is what I would like to tell the audience,

(00:04:52):
well,

(00:04:53):
what I would like them to take away with them after the session,

(00:04:56):
is that Test Containers allows you to create those very reliable,

(00:05:02):
repeatable,

(00:05:03):
and easily maintainable tests,

(00:05:06):
right?

(00:05:07):
Very often people have this connotation that,

(00:05:09):
oh,

(00:05:09):
integration tasks have to be slow,

(00:05:11):
they have to be hard to maintain,

(00:05:12):
there is probably like a wallpaper size of YAML somewhere to describe things,

(00:05:18):
and they’re fragile,

(00:05:20):
and,

(00:05:20):
you know,

(00:05:22):
With test containers, that is not the case, right?

(00:05:24):
Test containers brings all that configuration into your IDE,

(00:05:28):
into your code,

(00:05:28):
where you as a developer know exactly what you’re doing.

(00:05:32):
Even if you don’t know what you’re doing, you type dot, right?

(00:05:35):
And your IDE suggests you what you can do with that.

(00:05:38):
So they are comprehensive.

(00:05:41):
A lot of teams and projects come back to us and say that,

(00:05:45):
oh,

(00:05:45):
they started doing integration tests more and they started relying on them much more.

(00:05:50):
So it’s a very good practice for your project and your delivery pipelines.

(00:05:56):
But on the other end,

(00:05:58):
the developer experience of writing and maintaining tests like that is very,

(00:06:02):
very lightweight.

(00:06:03):
And it feels like those tests are exactly, they look and feel like unit tests.

(00:06:09):
They’re lightweight.

(00:06:10):
They run fast.

(00:06:11):
There is not a lot of configuration.

(00:06:15):
You can run it from your ID easily.

(00:06:17):
So you know how to work with them as a developer.

(00:06:20):
So I think this combination of being able to trust your tests more and actually

(00:06:26):
liking and enjoying working with them will make this very delightful developer experience.

(00:06:31):
I see.

(00:06:32):
Cool.

(00:06:32):
All right.

(00:06:32):
Well, that’s great.

(00:06:35):
I think developers are always looking for things that are going to make them more

(00:06:40):
efficient so they can write better code and better applications and stuff.

(00:06:44):
But when things come along that just are…

(00:06:48):
wow cool really interesting that’s very useful i’m gonna love this you know that

(00:06:53):
kind of thing so that’s what i’m looking for um and so that’s why i kind of when i

(00:06:58):
saw the word delightful i said oh okay this must be interesting um so yeah i hope

(00:07:03):
it’s going to be interesting and people will people will love it and write tests

(00:07:07):
more

(00:07:08):
so well that just gets me to ask another question about who’s going to use this is

(00:07:13):
this all developers or people or developers that are really focusing more on test

(00:07:18):
um you know is it or is you know it’s really all developers in this space are going

(00:07:25):
to use this i i have a i have a firm belief that

(00:07:31):
more and better quality tests are one of the sure ways to improve the quality of

(00:07:37):
software in general,

(00:07:39):
right?

(00:07:40):
We know that having better test suits improves the quality of software, right?

(00:07:46):
But so I would say all developers should write tests and

(00:07:53):
The more and better tests you write, the happier you will be as a developer.

(00:07:57):
So what was it?

(00:07:59):
What makes us tick or something like that?

(00:08:01):
Autonomy, mastery, purpose.

(00:08:04):
As a developer, I’m the happiest when I know what I’m doing.

(00:08:09):
And of course, there is the business requirements and everything.

(00:08:11):
That’s the meat of the job to describe that to your computer.

(00:08:16):
But also, I want to know that I’m not stepping on anyone’s toes.

(00:08:19):
How do I know that?

(00:08:20):
I’m just running the tests.

(00:08:22):
If test pass, it means I didn’t break anyone else’s job.

(00:08:28):
I want to know that the things that I’m doing will work.

(00:08:31):
How do I know that?

(00:08:32):
I run the tests, and I am happy seeing that green check marks.

(00:08:36):
Ding, ding, ding, ding, ding.

(00:08:39):
And I know that after a while,

(00:08:42):
when I write the tests and I can run them,

(00:08:46):
I know that everyone else on my team also can run them.

(00:08:49):
So it will make their lives also easier.

(00:08:52):
So more tests will make the developers happier.

(00:08:55):
And I think a happy developer is a productive developer.

(00:09:00):
The brain doesn’t work when you are unhappy.

(00:09:05):
When you are struggling and you’re down and you’re like, oh, my God, I need to do this task again.

(00:09:10):
I’m changing this.

(00:09:13):
Will it ever work?

(00:09:15):
Am I even doing the right thing?

(00:09:18):
That’s not a recipe to have productive developers and productive teams.

(00:09:22):
When you are swinging there in the code,

(00:09:25):
changing things,

(00:09:26):
refactoring on the fly,

(00:09:28):
leaving the code better than it was before,

(00:09:30):
knowing that you confidently can do this because you have this safety net of good tests,

(00:09:39):
then we’re talking about productive teams.

(00:09:41):
So I think everyone should test.

(00:09:43):
Test more.

(00:09:44):
Write those tests.

(00:09:45):
You don’t have to do TDD.

(00:09:47):
You can write tests at whatever moment of time you want.

(00:09:52):
uh what i think it will be better and you will say thank you to your past self when

(00:09:57):
you when you open the project again and they’re like oh there are lots of tests

(00:10:01):
right excellent one of the reasons why i asked the question is um working with

(00:10:07):
developers like i have for so many years and also scientists i i’ve done a lot of

(00:10:12):
work with in the um you know biotechnology and the pharmaceutical industry and

(00:10:19):
this concept that technical people have through their training, basically a scientific method.

(00:10:24):
I mean, you don’t know something’s going to work unless you test it in some way.

(00:10:28):
And the whole scientific method really is a test.

(00:10:31):
It’s just a methodology of testing something.

(00:10:34):
And when I started working with engineers, that same mentality was there as well.

(00:10:38):
I used to work in Solaris at Sun and also Oracle.

(00:10:44):
Testing was always top of mind.

(00:10:46):
It was a discussion in almost every meeting.

(00:10:48):
Does it work?

(00:10:49):
How do you document that?

(00:10:50):
Can you prove it?

(00:10:51):
Who are you breaking?

(00:10:54):
Like, do you know that it works?

(00:10:55):
Have you seen?

(00:10:56):
And also, just writing random tests is not always great.

(00:11:01):
You will never trust a test that you haven’t seen failing because it might not test the right things.

(00:11:10):
Oh, I see.

(00:11:10):
I see.

(00:11:11):
Interesting.

(00:11:11):
Yeah.

(00:11:12):
Right?

(00:11:13):
Well, this is your normal workflow.

(00:11:15):
You receive an issue.

(00:11:16):
You write a test.

(00:11:17):
You repeat.

(00:11:18):
You reproduce the problem with the test.

(00:11:21):
You see it fail,

(00:11:22):
then you change something in the code,

(00:11:24):
and you see the impact of the change flipping the switch on the test for the

(00:11:28):
particular functionality.

(00:11:31):
And then you can run the whole suite to verify that this change that you did only

(00:11:37):
affects those particular use cases.

(00:11:40):
And then it’s good.

(00:11:43):
And I think it’s, yeah, exactly.

(00:11:45):
It’s a little bit like the scientific method.

(00:11:48):
So is this,

(00:11:49):
you know,

(00:11:49):
when you got into,

(00:11:51):
you know,

(00:11:51):
when you were younger,

(00:11:52):
sort of looking at careers and stuff,

(00:11:54):
and you decided to become a developer,

(00:11:56):
was this mindset of,

(00:11:58):
you know,

(00:11:59):
so did you have a developer mindset before you got into it?

(00:12:02):
Or is this something you learned along the way?

(00:12:05):
Yeah, I learned it on the way.

(00:12:07):
And I accidentally fell into IT and computer science.

(00:12:13):
I didn’t know what to do after school.

(00:12:14):
And when I went to the university, I just picked one at random.

(00:12:19):
As a child, I loved computers, so I didn’t really understand what I will be doing.

(00:12:24):
But I felt like this sounds cool and I can apply myself there.

(00:12:29):
And then it just started rolling.

(00:12:32):
And then eventually I discovered to myself the actual… Well, my first language was Java.

(00:12:40):
It was back in 2000-somethings.

(00:12:43):
I think I started with Java 5, so I never experienced the world without collections.

(00:12:47):
Lucky me.

(00:12:49):
But yeah, and then eventually I discovered the larger ecosystem of community.

(00:12:54):
I think in 2011, my first conference ever was Java 1, which absolutely blew my mind.

(00:13:01):
Yeah, I was going to ask you because Java 1 is back now, so you’re going to go back to Java 1.

(00:13:05):
I mean, what was your previous experience?

(00:13:08):
I think Java 1 is, I have a very special place in my heart for Java 1.

(00:13:13):
As I said, it was my first, right?

(00:13:15):
And I come from Estonia.

(00:13:17):
It’s a small country.

(00:13:18):
We’re like not super tiny, but like the density of population is not very high, right?

(00:13:24):
And like a few dozens of people is a lot of people, right?

(00:13:28):
And like maybe hundreds is already like a very good gathering.

(00:13:32):
Java 1 back then was…

(00:13:35):
massive it’s a crazy big show everyone who was everyone uh anyone in the java

(00:13:41):
community was there there were like always there were like personal heroes i’m

(00:13:45):
looking forward to meeting uh and seeing my friends again at this year’s one and

(00:13:51):
they were like

(00:13:53):
people discuss things at a totally different level, right?

(00:13:57):
I was an ordinary developer.

(00:13:59):
I was developing my project and my product, and we were doing cool things back then.

(00:14:04):
But it’s a very different scale, right?

(00:14:08):
When you talk to someone, you talk to, I don’t know, Java platform architects,

(00:14:12):
And they discuss things that will touch the professional lives of every Java developer in the world.

(00:14:21):
It is just absolutely crazy feeling of how connected the world is and the ecosystem

(00:14:27):
and the community and how you can become a part of that.

(00:14:31):
So I think

(00:14:34):
it influenced me very, very much.

(00:14:37):
And I think that’s what kickstarted my wish to be more in the open source community, more visible.

(00:14:44):
Maybe that,

(00:14:45):
oh,

(00:14:45):
maybe I can research something and then go and tell and educate other people about

(00:14:53):
what I’ve learned,

(00:14:54):
right?

(00:14:55):
So it was life-changing for me.

(00:14:57):
So I’m super looking forward to coming to Gen 1.

(00:15:02):
So the community concept in general also struck you.

(00:15:06):
Not only that conference specifically,

(00:15:08):
that technology specifically,

(00:15:09):
Java 1,

(00:15:10):
but the greater concept of contributing to an open source community.

(00:15:16):
Oh, absolutely.

(00:15:18):
Right.

(00:15:18):
So I think we are in a unique position in the world.

(00:15:23):
Well, I mean, among the other industries, right?

(00:15:26):
Where with a fairly…

(00:15:29):
pointed narrow effort, you can influence and change for the better lives of very, very many people.

(00:15:36):
And you don’t necessarily need to know those people personally.

(00:15:40):
You can improve Maven and 70% of Java developers in the world can be using your code.

(00:15:51):
And that’s a lot of developers.

(00:15:53):
That’s a lot of developers.

(00:15:54):
That’s a big, big impact.

(00:15:57):
That’s like millions of people.

(00:15:59):
As a developer working on your particular projects within the team,

(00:16:04):
or even if you have experience a little bit between different projects or different companies,

(00:16:10):
you might not realize the scale

(00:16:14):
right uh the scale of this uh very easily i’m not come on there are like what was

(00:16:19):
the saying what’s what’s the number now there is like around nine million java

(00:16:23):
developers in the world oh i i don’t know the number but i think it’s over 20 or

(00:16:28):
something so but like it’s it’s it’s a big number for me estonia is 1.3 million

(00:16:33):
total population oh wow okay so so it is

(00:16:39):
Like it’s completely different scale, right?

(00:16:44):
And it feels good to contribute to the community.

(00:16:49):
It feels good to know that you are helping people.

(00:16:52):
And I think what they were trying to say is I think conferences are a very good way

(00:17:01):
into that to get a feel of that,

(00:17:05):
feel like you belong and you are a part of something.

(00:17:08):
And yeah, everyone should experience that on a regular basis.

(00:17:17):
I mean,

(00:17:18):
even I love it,

(00:17:19):
even though I don’t write code,

(00:17:20):
I’ve been sort of involved with developers for a long,

(00:17:22):
long time.

(00:17:23):
And open source to me is a very powerful concept because it’s based on contribution,

(00:17:30):
what you can contribute and the amount of connections that you can make in a

(00:17:34):
relatively short amount of time as opposed to in your job.

(00:17:38):
Your job in your company tends to be a little bit more hierarchical,

(00:17:43):
and you don’t necessarily have connections to millions of people inside your company.

(00:17:48):
Usually your company is a lot smaller than millions of people.

(00:17:51):
Whereas an open source project,

(00:17:52):
you know,

(00:17:53):
the bigger ones are,

(00:17:54):
you know,

(00:17:55):
connected globally and,

(00:17:57):
you know,

(00:17:58):
have huge,

(00:17:58):
huge massive scale.

(00:18:00):
See, I’m looking forward to it too.

(00:18:02):
Yeah.

(00:18:03):
Even the small ones, right?

(00:18:04):
Like it’s very, very important.

(00:18:06):
And it doesn’t have, your contribution doesn’t have to be code, right?

(00:18:11):
You can, you can, well, tests are also sort of code, right?

(00:18:15):
So, but you can, you can contribute test cases or you can, you can, you can try new features.

(00:18:21):
You can send feedback.

(00:18:22):
You can,

(00:18:23):
you can maybe do a little bit of effort to,

(00:18:25):
I don’t know,

(00:18:26):
test your code with new Maven or even like simpler test your code,

(00:18:30):
test your applications on newer Java versions.

(00:18:33):
If you see something that is not right, talk to the maintainers.

(00:18:39):
That is a very big part of what makes the projects alive and what makes projects move forward.

(00:18:46):
It’s very hard to do something in a vacuum because the community, we are so diverse.

(00:18:52):
We come from different backgrounds.

(00:18:54):
We use different technologies.

(00:18:57):
Our point of view on how we develop is very different as well.

(00:19:02):
And then it helps.

(00:19:05):
Every little bit helps.

(00:19:06):
Documentation, reading Java docs or documentation samples, quick starts, all that.

(00:19:13):
Maintainers will absolutely thank you for all and any contributions like that.

(00:19:20):
One of the points I make when I talk to people about contributions is it is the

(00:19:24):
fastest way to get attention.

(00:19:27):
I mean,

(00:19:28):
because you just said it,

(00:19:30):
maintainers will love you for that because,

(00:19:32):
I mean,

(00:19:32):
you’re contributing something of value,

(00:19:34):
right?

(00:19:34):
And so, wow, that’s something that we can use, the whole community can use.

(00:19:38):
And by definition, you’re tied to that, right?

(00:19:41):
And so, it’s just a very, very powerful concept.

(00:19:44):
And yeah.

(00:19:46):
so uh all right well so let’s wrap it up here anything any final thoughts on on

(00:19:51):
going to the conference or your session it’s it’s it it’s an introductory session

(00:19:56):
um you mentioned so there’s leads me to believe there’s a lot more there than just

(00:20:02):
that session right so people can dig into more afterwards

(00:20:06):
Yes, absolutely.

(00:20:07):
So Test Containers provides you with a very flexible way of describing those environments.

(00:20:12):
And you can do very cool things from not just the basic tests for a small

(00:20:18):
application with a database,

(00:20:19):
but you can do complex hierarchies.

(00:20:22):
You can do sort of complex topologies of those components with networks and everything.

(00:20:28):
You can do chaos engineering on top of that.

(00:20:31):
You can inject a toxic proxy component.

(00:20:34):
For example,

(00:20:35):
we have a module for that that will slow down or cut network to your dependencies,

(00:20:42):
and you can test how your application will work if it doesn’t have access to the

(00:20:47):
database in a timely fashion.

(00:20:49):
There are modules to run a Kubernetes cluster,

(00:20:56):
so you can test if you’re writing stuff for Kubernetes,

(00:20:58):
like operators or something,

(00:21:00):
you can do that.

(00:21:00):
It’s a nicely…

(00:21:06):
isolated building block that integrates with other things and and that gives you

(00:21:11):
the flexibility so as a developer you can build abstractions on top of that for

(00:21:15):
your team uh which which is great so there are levels of how deep you want to go

(00:21:20):
with integration tasks with test containers and this session that java 1 will be as

(00:21:25):
you mentioned and more on the introductory side so even if you are a beginner and

(00:21:30):
even if you don’t feel like you are an experienced uh developer you

(00:21:34):
doing tests with test containers for many,

(00:21:36):
many years,

(00:21:37):
you should come and you would learn necessary things to kickstart your kind of

(00:21:43):
journey there.

(00:21:44):
And yeah, that journey never ends.

(00:21:48):
You will get the taste of better tests and then you will be like, how could I live without this?

(00:21:55):
You will love it.

(00:21:56):
Excellent.

(00:21:57):
All right, Java 1, October 17th through 20th in Las Vegas.

(00:22:02):
We’ll see you guys there.

(00:22:03):
Oleg, be good to see you there live outside of Zoom.

(00:22:06):
Yeah, it’d be great.

(00:22:07):
And catch you later.

(00:22:09):
Yeah, be there.

(00:22:09):
If you have a chance, try it.

(00:22:12):
Talk to you soon.

(00:22:13):
Talk to you soon.

(00:22:13):
Thank you.