Fundamentals of Automated Testing - The "WHY?" | Qambar Raza | Skillshare

Fundamentals of Automated Testing - The "WHY?"

Qambar Raza, Learn automated testing

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
4 Lessons (19m)
    • 1. Intro to the class

      0:37
    • 2. Why and when do we automate ?

      2:54
    • 3. Software Test Levels

      6:53
    • 4. Writing your first test

      8:41

About This Class

Learn to write your first test with the understanding of why you should write one !

Most of the training courses that are out there just dive into definitions and implementations without the understanding of WHY. Those courses can get you a job but not the understanding of the reasoning behind it.

So I decided to design this course to talk about the WHY.

You will learn

  • what is automation
  • when should you automate
  • why should you automate
  • what are you testing
  • how to write a test

Apart from this class, I am happy to do one to one session with you if you need further help, so please don't hesitate to contact me.

As a teacher who is passionate about automation, I want you to succeed !

Transcripts

1. Intro to the class: Hi, guys. My name, Miss Come Broza. And I'm a Pittsburgh. Destiny. I'm designing this course to help you understand and answer these questions. So first question is, what is order Very distant. Why do we do it? And how do we write Alphas test? Uh, and I will be sharing some available examples something from the current news things that are happening around us, which is related to testing and also the experience that I've gained working for a large media corporation. Thank you. 2. Why and when do we automate ?: So in this video we will be asking a cushion. That is, why do we automate what's the reason behind automation and when do we choose or information or other techniques. So let's take an example off a log in form. So you have a log, inform it to feels user name and password. Um I mean, ah, human contest it every time you make a change to the cold are in the logging area. You can ask a manual tester to very fight a good. So you have hired a manual tester. You asking him to, uh, do the same job again and again? So you asking him to repeat the process every time you make a change of the code? There is a problem with that, But what happens over time is the way our brain is designed. Ah, us being humans, we get bored. So do you do that? Boredom? We'd start losing accuracy so our brain basically tries to find shockers so they they may test the form really accurately are the first time. But because it's working the the first time in the second time in the third time there is a chance off losing the accuracy and because ah ah, human human is involved in this process. They make the medic tea breaks. So, uh, the time to test it after the court has been committed, a good has been changed May very so it wouldn't be consistent. So we have talked about time we have talked about Ah, accuracy. And third thing is because you have hired of resource, there's a cost. So basically, if you automate your saving a cost because you don't have to hire someone to repeat the same thing again and again. And whenever we see, whenever we used the term we repeat, So it is a key. What? This is the magic word over here. So wherever you see a scenario like this thing needs to be repeated. That is where you automate stuff. So why do we automate the cost benefits? Because you're not hiring. So she only writing a good once, and you're running it again and again. The court would be accurate because you have it in the court. You're not changing the court for a test. It will run exactly the same way as it ran the first time. And it isn't big tea breaks. And that is why you automate. Thank you 3. Software Test Levels: in this video, we will understand what us offer test levels, and we'll also learn to ask yourself this very important question. What are you testing? If you understand the gist off this basic question, you will become a very good suffered Essar. So let's get started. Any piece of software goes to various little toff testing before you can ensure that it is a quality product. When we talk about suffered a lot when you talk about suffered s levels, they're basically related to the software development lifecycle, where testing is being connected. Now let's look at the some of the benefits off software test levels before we actually dive into them. So the number one benefit is they help you identify the missing areas. Um, So, for example, if you're writing a small function, which is an ad function, you may be testing that small function on its own, but you might not be testing it apart off Ah model. So sometimes, when you have, when the function on its own is working, it doesn't mean that it would work as a part of the whole larger system, so that that's an interesting thing. So we need to take a test. That's a test, that piece of cord separately, like as a part of the function. And we also want to identify that as a whole. The system is working properly, so the other gap that you can identify, if you understand this offer less levels. Second is it prevents overlaps. So when you're working in large teams and they're working on a same project, basically they would be contributing to the same gold depository, right? As I have seen from my experience that many teams basically, um, started duplicating court without that without them realising on it on their own. This is because they want to ensure quality, so they're doing the right thing. They want to make sure that the software is being built with quality. But what happens is ah, because they just, uh, contributed to the repository without thinking What what are they actually testing? They just ended up writing the same at the example I gave earlier in the first example, we where I didn't go to test a simple ad function. Now, if you talk about testing is as a part off a bigger system, I actually again testing the same ad function or are protesting something else. So what I retesting that is the question that I would ask. And the software death levels basically help you answer that question. Um, and it tired, Which is very obvious because you have suffered that's levels. You will be able to organize your cold better. So, for example, you have a type of past which does a small bits of the court. You will put them in one folder, and you can find them easily and in any project, because it would become It's a standard. Then if you have a test which are testing, ah, bigger part of the system you would find in a separate folder with named Level. So if you move on to, like, what are these levels? So these are the basic levels off software testing. So number one is the unit tests. This is a very well known level like that. Mostly, Ah, the developers or testers never argue on this level because this this is like, understood, well, industry level ourselves so as the example that I gave earlier it waas like a simple ad function. So if you have one and you want to add it to two, and you have it in a function like add function, which takes two parameters one into and give the answer tree. You're just testing that unit of the court. So that's just, um I guess a small piece of those offer now when we go on a higher level. So ah, we talked about how this piece of court integrates with other pieces off the gold. So, uh, in here you're basically testing just one ad function. What about a certain model? So you have, ah, more deal. Which is Ah, basic arithmetic on another model, which is, think off a scientific calculator over here, By the way. So basic pragmatic and another one is the scientific notification, for example, you want to do a power power notification, uh, fly about power notion. So if in here in this example, you have one ah, plus two to the power to so to do devour two is four. So one plus four is equal to five. But and that would be your integration does because this is one more deal. You're testing the behavior of one more deal with when you integrated with another model. Then when you talk about Ah, you. I test, I guess, In the U, it is It's very easy to understand that, uh, it is ability to the user interface. So when somebody is actually in pressing the button one on a user interface, does it actually press the button one in the under the hood or not? So sometimes what happens is like, if the like think of it as a wrong wiring within your house. So one off Monday was actually had this issue where the heating connection for their first floor waas ah, connected to the ground floor and the ground floor heating connection was connected to the first floor. So whenever they need to turn on the heating in the red room, they had to come down says and I have done on the heating and that that actually happens so you can actually prevent that kind of behavior with you rightists in terms off calculator. So if you have a calculator, you and your pressing the button one, you can make sure that when you're president, 11 actually appears on the screen. And, uh, similarly, when you do, the whole journey, which is one plus two, is a goto tree. You can assert that journey as well. Based on that. So that would be the U A. Test level example. You can find the definitions online. I would give you more practical examples. Uh, and I mean, this was actually help you get on board with automation. Ah, because this is coming from experience rather than ah, book definition. Thank you. 4. Writing your first test: Congratulations on making it this far. Now that you understand, why the automate what is automation? Uh, what are we testing? What are the different levels off software testing, and how do they relate to the software delivery life cycle? It is time to write our first test. So let's get started. In order to write our first test, we will pick any for work. Um, which is suitable for writing test s so that we can get a basic idea off What is on automation test in terms off implementation. Um, because these skills are transferable. So you, if you learn to write a test on, for example, javascript, you will be able to write test on Jabba's Scholar are any other language. You will basically need to learn the Centex, but the concepts for writing and test would be same. So it over here, I'm going to search for Cyprus. The documentation, um and I would say for the word installed and here I confined. The first thing is installing Cyprus. So to install Cypress, you need it. And PM you can easily find how to install and PM on Google. It's, um, like and PM in stroll and it will give you the information about, uh what do you need to download? So get on PM And here you can just download it. Isa Finally, I already have got environment my system, so I'm not going to install it. So in order to use told Cyprus we need to run this. Come on. And PM is the note package manager. So, um, I can read it on the terminal, or I could use Ah, visual editor. So in my case, I'm using visual studio Code Regency. I've created a folder, have created a full called sculpture and this school share folder. Ah is where you're gonna be working here. Uh, so on my right does a folder. I'm going to NPM install Cyprus. Save deaf. What this will do is is going to install the cypress foreign work on my local, so you will see some folders appearing on the left hand side As soon as the installation is complete. The next stage is basically once the dust have been installed, people. Ah, run the cypress from Ah, the Doctor of Aid is the store. So I I think there's some sort off. Yes. So this is a short skirt so you could run it by N. P X Cyprus Open. And this building, Uh, and the Cyprus it will give you some folder structure. And that is where you will find all the ah test. So now, as against you, the norm ordeals as ah folder has appeared and you can see there's Cyprus here, which means that we have got Cyprus on our local numbering two MPX cypress open. So this is a bit Bravia doing environmental set up. Um ID. You only need to do it once when you are basically ah, setting up the framework. But once a framework set up, you can Ah, right as been does as you want so we can see that this window has opened. It shows me all the integration tests in the integration test bowler and some examples and they're coming from this new liquidity for the gold cypress in here. There are many examples off indication dust. Um, for this example, I'm just going to delete them so that but they're good for you to have a look at, um so my four days empty Now I can do anything in here, So let's look good writing your first us. So in writing your first as it tells you to create a new file in cypress slash integration . And we can do that over here. So I'm going to create a new file on this. Would be that the patient is example simple. Underscore this practice. Yes. Let's just call it simple. Get rid of the example for them because we don't need it. So in the samples back, ah, we will write our first us now remember, Ah, a test has three different elements. How close is that Describe block. Another is the statement Ben Heard is expect on a station. Describe basically describes the your test suite. So I will describe breast sweet as basic is sick or IT medics. It's a ah second argument as a function. So I'm going to provide that, uh, only that segment of it today, Ben. Inside this described there can be many. It's basically ah, your 1st 2nd best card for 15 and reach. It is basically a function or the body off the test. So you need to define like what? What is What are you testing over here? So I'm basically testing if, um three is equal Cool tree and the body of the death would be this in this body of it casts. We do some sort of a section, and a station has been using for expect statement, So expect something but to be, um, equal. I saw that it uses what equal? Yeah, equal something in expect. We basically have Gooding's. So one is the actual and other is that, But let's create these two are variables like actual physical to create, like expected physical Do Tree 100. We have written our first breast. Let's see if you can actually run this. So in Cyprus, you can see the U. S. If I click over here, it will open the chrome browser and it will run this desk for me. It says that there's an issue with parsing the file, so I have forgotten to put the equal to red eye fix accord. It does. It detected that that's pecked at the desert viewed and ah, it's green. That means that death has paused. So, for example, if my tests was not correct, for example, if I said tree is equal to ah, the actual is nine, so nine is able to treat and is not equal to treat. So the decision for Phil So that is how you write your first s. Thank you.