Welcome to Software Testing Unleashed. The podcast for testers, developers and test automation engineers And all the people in the software development process who want create great amazing quality software. My today's episode was recorded at Testvorus A Great testing conference In Poland! The days were full packed with great quality content. I had a great time discussing and chatting With Polish and international software community.
If you haven't been here should definitely go to one of the next Test Warriors conferences. You find a link in the show notes. My guest today is Konstantin Deltov. He's working in software testing for nearly twenty years and has a huge technical background including C-Sharp, Java, JavaScript TypeScript & Python. so he combines testing and developing. And that also what we talked about.
We talked about design patterns in test automation and why they should be applied to Test Automation Code not just two productive source code. So take care of your test automation code and now enjoy the episode! And I can be like, you know... I can smile and answer honestly a lot of things. Yeah yeah that's great! You have your speech tomorrow in the program?
Yes yes i will speak about test design patterns not playwrights but in general it is kind of an infinite topic because when they start they need to move somewhere. They need understand what to do and data structures and design pattern are very important to understand how to work with that. Yeah, very important topic and it's a very good to have one episode without AI! True true I'm also little bit tired even if we need to be like you know in...in a good shape.
We need to understand How To Work With AI? You still need to Understand some basics of some coursing. yeah That's true. And yeah i read your abstract In the program. It is all about design patterns. So just let us grab insights into this topic. Why do we need them? Okay, yeah that's part. it will be some kind of spoiler but anyway. so there are four things for me. its first of all is a kind of proven solutions. yes like we don't need to invent some wheels.
Yes We already know That we have these design patterns and you can use. Second, it enables open principles. Without open principles our code will look like spaghetti code and I liked spaghetti but not only for eating yes or only as a dish. third one i believe uh It's important to have some common language with your teammates. okay you can tell two team mates oh You have a problem? And of course, one of the most important things.
design patterns support extensibility of our test automation solutions. So today we have a small one maybe some prototype but in future it might be very big solution that should live even if like as an example. I leave this designer with these solutions. so... Okay, so very important thing if you want to create a good test automation framework and want to scale it in the future. And have maintainable code base which you can use easily for your future too yeah? Yeah correct
So what are... In your opinion that most important design patterns we can using test automation? Oh, good question. Of course everyone who starts in Test Automation they basically learn page object because it's probably the most common design pattern. but I believe there are other design patterns.
as an example tomorrow i will be talking about Gencov-IV Design Patterns that were like published in nineteen ninety four It was already many decades ago But its still valid today and uh, creation of design patterns. Uh this five are important maybe not each time but some of them you still can use. and of course there other design patterns principles like as an example dependency in inversion principle which is implemented by dependency injection.
I believe This one also important so i cannot tell. Okay. Is this one important? This is not, it always depends on like current situation what we want to do and achieve. Yeah so maybe you can talk about two or three of them more in detail What they are really behind because the people at a podcast tomorrow In your speech. So okay Maybe starting with page objects Or something Like that. Yes yes yes So what's the problem? When talking about design patterns? We need some problems.
design pattern results. So what is the problem if we will not use PageObjects? Yes, We'll just write all selectors and all metons inside of our tests And we might reuse these things. It means that it will duplicate our code. And in PageObobjects there's a design pattern that encapsulates our screen or web page to some subclasses. yes If you need to split on smaller parts And this is probably the most common way when you build UI test automation framework to use page object design pattern.
Doesn't matter what programming language, what test automation frameworks. so it's just a common thing. So that important On my opinion I also like builder design pattern. So when we separate object creation from object representation, it's like you know, rebuild a burger so we can build cheeseburger or we can built gumburger. sorry guys probably I hope you have eaten. and yes And You Can Have Just This Constructor In Order To Build What You Want. It Looks Very Beautiful.
As an example, I'm not a big fan of BDD approaches like spec flow or like cucumber. But when you use builder design pattern it looks very close to that and your tests become very readable. Also one my favorite design patterns is facade. This design pattern acts as reception. You come to some place, but you don't know where to go. You need to initialize similar classes like builders and REST API requests in a similar way. You don't want to repeat it each time inside of the test.
So you just create one class, façade like reception. and from this reception façad where do we want? We can go to the bus or restaurant. so the same analogy for IPI is an example users, customers I don't know orders... Of course, that's not all I like but probably the most three. Yeah yeah and it helps to make better maintainable code. yes true so what i hear out of that is to treat the test automation code Real code which is this.
Yes, it's also important to have a good written code space there? And I believe you should always like share the knowledge and show your teammates or developers. It's common job. You don't need just create it and over complicate. sometimes when especially you learn something new, like your design pattern. You are trying to implement it but always need to ask yourself if its suitable here because sometimes we want overcomplicates or overdesigned.
Are there any designs patterns which useful in when we do test automation because of the architecture, or our test cases and assertions. Is there other some which are more appropriate for test automation than normal code? Yes! For sure... I mean they're both appropriate to test automation and normal code but probably ...for test automation you don't use all design patterns As I said, so all creation design patterns single tone factory method abstract factory builder and the last one prototype.
But yeah in modern languages probably we don't need to prototype because we can copy objects already from under the hood some of they useful. also let me think Yes, it's not Gov design pattern called pull object. Let's imagine we need to create a lot of objects. web drivers yes like really need to Create Web Drivers in parallel.
and each time you create web drivers And each time the close web driver so this memory leg jumps You know, creating it each time we just can create a pool of this web drivers and take from the pool back to the pool. And then clean up this book in the end. so very simple. It sounds very simple but when people don't know you just need to shout at them yeah maybe that's also part because Sometimes a test automation engineer is grown out of normal tester and not the developer.
And they are really aware about this design pattern so that it's important for them to learn that. Yes, yes! It's important to have horizons because when we just join you start maybe junior automation QA even if I don't like to split but let's call it Junior Automation QA And what you do usually, just copy paste. Yes there are like your senior colleagues and they provide some frameworks or templates but of course we need to learn object oriented programming if it's required.
so as I said that data structures is needed for design patterns. And my point is, I'm not planning to show all of the design patterns that exist. Yes! My point is to show it's important and still important even in an era of artificial intelligence. You also mentioned in your abstract some more principles like dry and kiss. Can you explain that for our audience too? Yes, yes the most important principle is do not repeat yourself dry. so drive principle.
it's about encapsulation a page object as an example. we don't repeat finding of elements using web driver methods in order to manage our web browser, yes. We just encapsulated the same page object and we do not repeat ourselves. so you might have also some assertions that we need to repeat. So maybe it's a good thing to move somewhere for helpers or database calls. All of this stuff looks like spaghetti code. It is about don't-repeat principle. Keep it simple, a kiss.
Yes so we still need to remember that we do not design production project. yes We designed test for this project and don't have to create test-for-test. That's something I already mentioned. Do not overcomplicate. So if you want to use design patterns only if required You're gonna need it. Yes, also there is principle trying to remember this. a very good rehearsal for your speech tomorrow. True thank you Richard and you are going to need.
so do not push anything like you don't need at the moment. So just design what we need in these moments. Of course, you need to think about extensible test automation framework. But don't create some things or helpers that are not going use today. so just create it as a framework but do no implementation if needed. Great! So important principles we have to know and You mentioned before the AI stuff We must make one more question. Yes for sure. I knew.
maybe creation of test automation code out with AI or with code in general, is AI capable of this design patterns? Yes if we will tell them to use it. So IA is built based on prompts and its about context. so you always need add some context. And if you will not give this context, of course AI will not do it. But what we should remember? We still need to verify how it was done. so maybe it's over complicated or It wasn't such expected as we want. I have like very good examples.
So one month ago i was performing online workshop for Ukrainian people. yes and i was talking about a generation of test automation framework from the scratch for playwright with charger pts. At that moment, they actually didn't release this MCP agents. Now it's like bomb everyone is talking about. I even was written article about it. so and yeah when i Was preparing to the session? It was great. But then i started this session.
one month later he started over complicated paid chat GPT, but even in this situation it started to overcomplicate. so I needed to redesign myself. In order to show you guys sorry that is not correct i told the participants. yes we don't need to use a lot of if and if. That's an example when we need to follow. But of course AI become more powerful, I don't know. let see... We still need to control it! Yeah i think that is a very important thing.
actually we have taken in with our code here When I am now test automation engineer and start scripting coding into this area programming knowledge, but I don't know really this design patterns or what which are good sources where i can learn this work and maybe see in the internet. Do you have any recommendation there? Okay yes of course. first is his book. Yes! It was released today World of Twitch.
People don't like to read books But still believe that books are important And this book definitely is very good. There are a lot of sites, Refactor and Guru as an example A lot of online even free videos on YouTube the channel. so to start Are there any special books? Do you have a special book in mind? Genko for Design Tutoring.
This one Yes. Also You can watch Of course Linky Dean learning Udemy Refactoring guru website, they have very beautiful pictures and explanation on different languages. And yeah I believe it's a very good start of how we were doing when i was younger or so. We just met with the colleagues in office once per week. We are preparing some presentations And like trying to show and then resolve some practical tasks with this design pattern.
So that's how we were training, so maybe you need to find also some colleagues who will push you? Yeah! Maybe a small community in the organization can build and they learn from each other... Yes as an example In Metzower work we built actually Thanks to my HR, so I was talking to them alone and we built QA Guild inside of our organization. And it was like first guild in our organization.
but we were trying to spread some bubbles... Spread some knowledge and break some bubbles inside the organization because each team can work differently and use different approaches. Great. So there are no excuses not to use design patterns anymore? I mean, you know people who write on JavaScript probably want to argue with me but i still believe even in javascript and python is important. maybe not all of them But they're some that we need to use definitely.
so In other case your code will look like spaghetti. Let's eat spaghetti in Italy, so... Yeah that good idea! Costa thank you very much for participating here the interview and to share your knowledge uh and your inspiration on this topic. I think we have to think about all these patterns in the automation stuff more To make better codes there. So Thank You For Your Input There And i wish you All The Best For Your Speech Tomorrow. Thank you Richard, thanks a lot. Good night!
