Blackbox automation testing should be part of any successful software development organization. Unit testing is great, but to cover the largest area of your software with the least effort you need to have blackbox automation testing. Not only that, but you also need to have an automation testing framework.
[responsive_video]http://www.youtube.com/watch?v=ERmJO7R2CRs[/responsive_video]
[blank_space height='3em']
Full transcript:
John: Hey, John Sonmez from simpleprogrammer.com and if you’ve been following my blog of following my videos, you probably know that I'm pretty passionate about automated testing, what I call Blackbox Automated Testing or BAT testing. In this video, I'm going to talk to you about why automated testing is really important. In fact, I think it’s more important than unit testing, and talk about why you actually need to create a framework for doing this.
Let’s recap real quick here just to make sure that you understand what Blackbox Automated Testing or BAT testing is. Blackbox Automated Testing is the term I use for what’s usually called automation testing or customer acceptance testing, automated customer acceptance testing, whatever you want to call it. Basically, for web applications or for any application, it’s where you’re testing an application programmatically through the same user interface that the user would use.
There are tools out there for doing this. Probably, the most popular one for web development is called Selenium. What this does, Selenium does is it’s actually a browser driver. It drives the browser. It clicks on items inside the browser. It acts just like the user but you can program it so that you can program the browser. You can program scripts to automatically click things, fill in things, check things, just like a user would.
Now, there’s a huge value in this kind of testing. Really, the biggest value from this comes from your ability to leverage. When you write a unit test, you write a lot of code to cover a small amount of production codes. There’s a lot of unit test code. It’s reversed leverage. In general, you might write 2 or 3 times as much unit test code as you actually do production code to thoroughly test that production code, or to run through that production code.
The opposite is true with Blackbox Automated Test. You might write a very small amount of code to test a huge amount on the system, so you get a big surface area of testing. Now, the reason why I say this is so important is because I don’t know about you, but most organizations I have worked with or consulted for do not have very adequate test coverage. They mean to even if they’re doing unit testing or even if they’re doing test driven development, but it just turns out that it doesn’t quite work that way.
For those organizations, the best thing they could do is get more coverage. It’s more important to get more coverage, that’s the most important thing is to cover more areas of the application than it is to be as they are low level as possible. That’s why for them, I say, “Hey, unit testing is great. Do unit testing. Keep doing that. Fine.” But it’s more important to do this Blackbox Automated Testing because it’s going to get you more coverage faster. Those tests are going to be more valuable to you at this point.
Now, if you already had 100% unit test coverage or whatever, it’s not going to be quite as valuable. I still think that it’s extremely valuable. Don’t get me wrong. Here’s the thing though. If I’ve convinced you that you need to have Blackbox Automated Test, one of the big problems or one of the big arguments against them is that they’re so difficult to maintain. This is a common scenario that happens when developers create automated test or QA, right? They create these tests. The UI changes a little bit. The button changed or workflow changed and the application. All of a sudden, hundreds or thousands of tests break. They all have to be manually updated and fixed, and everyone says, “Yeah. That’s the problem with automation, is it costs us so much time.”
Well, the reason why that happens is because you have to treat your automation effort just like your production application. You need a framework. This is where an automation framework comes into play. What an automation framework is it’s basically, think of it as an application to test your application, right? You’re going to create a framework that’s going to mirror your application, that’s going to basically have all of the functionality of your application, and there is going to be an abstraction layer from something like Selenium.
You’re going to write tests, the tests are going to use to the framework, right? The framework has that abstraction layer. It knows about your application, it knows about Selenium. The test just defines what needs to be done. Then that framework that uses Selenium and it automates your application. Now, your tests become really simple. Your tests become actually plain English test, may just a few lines of code. Most of the work is being done in the framework.
Now, when something breaks or changes, let’s say the UI changes, a button name changes, you test will break, don’t get me wrong, but you fix it in one place in the framework and you say, “Oh, the log-in button now has this ID.” Now, those 50 tests that were using the log-in button, they all work because you just fixed that one spot in the framework. That’s why it’s really, really important to have an automation testing framework.
I have actually created some courses on this. If you go to Pluralsight, you can search for Selenium. Actually, if you search for Selenium, you’ll probably find I have a course on creating the automated testing framework with Selenium. It goes over the basics. I’ll show you how to do that with WordPress. I also do some consulting on this. If your company is looking for someone, I can write the automation framework for you that’s true, I do do that, but the best way that I help a lot of people out is to show them how to do it or coach them how to do it, and then help them understand how to get this going. I’ve done this for a lot of different companies now, and I can really help you to get started. Just shoot me an e-mail if you’re interested in that.
I would definitely encourage that you need to have automated test and you can make it easier on yourself if you’re willing to invest a little bit in creating a framework. It’s going to make it maintainable. It’s going to make your test easy to read and easy to maintain. It’s going to make it so that the QA and even business people, the way that I design framework can actually write those tests and understand those tests.
Well, hopefully, this video has been helpful to you. If you wouldn’t mind helping me out, subscribe to this channel if you like this video. Up vote it. Give me some comments if you have something to say about this and share this video to your friends. Thanks a lot for watching and I will talk to you again next week. Take care.