Transcript for:
Getting Started with Robot Framework

Hello everyone, welcome you all. My name is Pawan. So from this video, I'm going to start new series on Selenium with Python using robot framework. So as part of this video, I'm going to cover the introduction part of robot framework, that is what is robot framework and how this robot framework is different from other framework, which are all that already there in the market. And we'll discuss that. And after that, I will also show you how to set up robot framework, what are the prerequisites we need to have. and how to set up robot framework so we'll see that also as part of this video now let's get started so first of all let us understand what exactly robot framework is so robot framework is a generic test automation framework for acceptance testing so we have number of frameworks available right so we have unit testing frameworks available functional testing and tdd bdd there are ultimate there are multiple frameworks are available in the market so robot framework is especially designed for acceptance testing. So normally who will perform acceptance testing? Right. So acceptance testing normally done by the customers or users, right? So they should able to automate their test cases, but they don't have any programming background or they don't have any technical stuff, right? So even though those people can easily write or implement their test cases using robot framework. So that's how the robot framework is designed. So especially this particular framework. is support acceptance tested event development like we have a TDD framework tested event development we have a BDD framework behavioral driven framework and this is a DD framework which is acceptance tested event development framework and basically it is internally users keyword driven testing approach so in the keyword driven testing approach means we have certain number of keywords and we use those keywords to perform operation for example I want to open a browser simply there will be one keyword called open browser then we need to pass a url so that keyword automatically opens the url on the browser so similarly there are number of keywords will be provided by robot framework we need to just understand how to use those keywords so it utilize the keyword driven testing approach internally and it is also provided number of libraries robot framework is also provided number of other libraries which are already implemented using either python and java so both the languages it is supported and if you want to create a new library so if you want to create a new keywords we can also still create our new keywords by using existing keywords so that is also flexibility we have in robot framework and if you want to work with the robot framework we don't require much programming skill very basic skill is required but if you still want to write your advanced level keywords we need to know the either Python programming or Java programming depend on which language you are using so especially as part of these particular videos I am going to focus on Python language so selenium with Python using framework robot framework so this is a very basic understanding of robot framework now if you just see normal ceiling with Python script and the ceiling with Python along with the robot framework script it will be difference like this so if you want to just write us now automation script for ceiling with Python you need to know little bit scripting here like Python scripting you need to know so we need to create the driver and open the url we need to know certain number of methods also which are provided by selenium so until unless you know these methods you don't know exactly how we can work with those methods how we can interact with the browser how we can perform the operations we cannot do that until unless we know those methods and little bit programming but when you come to the robot framework if i just observe here just we use some keywords let's see if we want to open the browser we say driver.get and we need to pass some url then if you want to provide some username and password we need to first identify this element find that element and then we need to pass a value but here we just use some keywords let's say open browser which is a predefined keyword in robot framework just we need to pass a url as an input and we need to also specify the which browser we are going to launch now in the spatula browser this url will be launched who is do this this is done by open browser keyword and if you want to pass some input to the text Normally, we will identify this element, find element by name, dot, send keys and we pass some value. But if you come to the robot framework, again, we use certain keywords like input text is one of the keywords and we need to pass locator name is equal to username is a locator, Mercury is some value and input text name is equal to password and Mercury is a value. And if you want to click on some element, just say click element. So if I just read this particular step, everybody can easily understand what are the operations I have performed. But if I see this particular code. even if the non-technical guide they cannot understand what exactly the script is right by reading this script robot framework script you can easily understand what are the steps we have created and how it is going to execute So that is a very easiness and flexibility we have in robot framework. So robot framework will just have a simple keywords which we need to know those keywords and we can perform operations and we can also create our own keywords if you are required if you want to create our own keywords by using existing keywords. So that's these keywords are coming from a robot framework. Now so how exactly robot framework works. So normally robot framework contains multiple libraries. if you just look at here okay so these are all built-in libraries selenium library db library daytime there are so many other libraries are available inside the robot framework so this robot framework is provided all kinds of libraries and these libraries are implemented either in java or python so they use certain number of programming to implement these libraries now what we need to do is we have to install robot framework once we have installed robot framework We will get all these libraries and we need to also specially download add these libraries into our project So if you just install robot framework and by default, we don't get these libraries But we need to install these libraries into our robot framework now suppose if I say selenium, right? So selenium webdriver is a kind of a library selenium library means which contains a webdriver So whatever methods are there in the webdriver at the bottom, so all the methods we will get inside the selenium library and it will provide number of keywords so even the keywords also internally uses webdriver script so how this is going to work is so in the if i just go to my previous slide so if you just go to my previous slide okay here what i'm saying is here this is a script we have created if i just use selenium with python but how this keyword will know how we need to execute this right so normally open browser means this is a keyword internally how this keyword works is it is going to execute this particular statement okay so instead of writing the direct code we are just using this keyword and these keywords will call the particular script which is already created inside the libraries so that's how the things will happen so how it is going to work so here let me just show you how it is going to work so here first we will have ID so let's say this is ID means here we will write a robot script robot automation script Using some keywords. So when I run the script, it will just go and talk to the library So we have whatever libraries we have there is implementation is there So again, this is again implemented web driver using cylinder web driver and those web driver methods will talk to the browser Okay. Now here robot framework ID is there so we can use right as an editor is there and Suppose if you want to use pyjama as an ID, we need to install in teleport plugin because this plugin will provide you a certain number of features to work with the robot framework it can identify all the files from the robot framework okay right is direct editor is available and especially this is designed for robot framework and if I want to still use pie charm if you want to write the script in pie charm we need to additionally install in teleboard plug-in inside the pie charm and then it can easily understand the robot framework files so this is the architecture of how exactly robot framework works now Let us see just right so now we'll see the setup map. So now we have understood what exactly robot framework is. Now we will see how we can set up robot framework. So to set up the robot framework we need to have multiple things. So first the prerequisite we need to have Python installation because internally robot framework uses lot of things. It should need Python, it need Selenium robot framework. and all these things it requires so first we need to install python okay so how we can install python so just go into this particular website and www.python.org downloads you can just download one download option and this is again free and open source and just download latest 3.6.3 i'm using in our videos and once you download this file you will get one exe file and once you run that exe file you will get the screen install now Then click on the next and it will take some process set it process take some time and after that you are set up with This access one. So this just very simple step you need to go and do that So first we need to go to Python official website If you just go to Python and the first website will be Python dot o RG So from this website, we need to download so just go to download section and here you will see Python 3.7.4 Just click on this. It will download one exe file then you just need to click on the cxc file it will go through two to three steps and it will finish it So already installed this python my system. Let me just show you so once you done the installation of python Now you will see a new folder under c drive program files under Program files, you will see x84 not program files. Yeah program files x86 You can see python 3.6.4. I currently have so these are the different files You can see and inside the script also you can see a lot of other files. Okay, so once you install is your python you need to also configure the path so just copy the path till script folder now just right click on this pc go to properties now once you go to properties advanced system settings and here click on environment variables now here select path variable click on edit now here we need to add so click on the new and paste it over here so i think this path i already added earlier if not you can still have that particular path okay so this is how we need to add scripts because whatever the files are there inside this script we can execute these things from anywhere so once you have added this then okay and okay and then okay just close all the windows so after after doing this then you can just check whether your python is properly installed or not so just open your command prompt as an administrator and then you can just type one command here so in the command prompt you can just type one command called python iphone version so this command will give you the version of the python you have installed so once you have installed the python you will also get one another package called pip so that also into uh you will also you should also get along with the installation so pp is very useful package By using that pip we can install some other plugins or packages which are required for python Okay, so pip is also by default come with the python now. I can verify pip version also pip iphone iphone version pip iphone iphone I'll say version so this will also give you pip version and pip is also installed along with the python So these are the first prerequisite we need to have so I have installed python on my windows Then we need to install PyChamp ID. So we need to install PyChamp ID. So totally we have installed multiple softwares guys Okay, so let me also copy this. What are the softwares which we need to install? Let's see one by one Okay, so I'll just say okay. So these are the softwares which we need to install. Let me just put that into Notepad and we will cross check one by one. So first we need to install Python So I have shown you how to install Python. Just install our file. Go to click on this exe file. It will go installation and configure the path in the script folder. Then you can verify the Python version here in the command prompt. So after that, so Python installation is done. The next one is we need to install PyChamp IDE. So the PyChamp IDE is very popular IDE for Python. So we need to also download this. Now next, go to next slide. So here jetbrains.com. This is official website for PyChamp. So, they will provide a lot of other softwares we just go to download uh pycharm okay just type download pycharm it will go to official website of jet brains and from this we can download so here there are two versions are available professional community so professional version we cannot and this just trial version is available after some time trial will be over we need to go for community edition and this is for pure python development and free and open source So once you click on this one, it will download one exe file now just start installing that exe file If you just go here in the screens, I have downloaded and then once you start exe file, you will get this screen So welcome to pychamp community edition and then click on the next now It will show you the default path where the pychamp is going to install then click on the next now it will show you the Another screen installation option. So here just select 64-bit launcher by default then click on the next and it will show you one more screen here jet brains and click on install So once you click on this install, then it will start installing your pie jump ID So here it will take some time after that. You will get this particular screen So completion completing pie jump community edition setup So if you want to run your pie job You can just select this mark and click on the finish and then it will launch one more window like this So here it will show you that theme which theme you want to interest it so you can just you can go for this one or you can go for light one so select one of the theme and then click on skip remaining and set to defaults or click on next feature plugins then it will go to the next screen like this and here it will ask you to create a new project first time so once you click on the new project it will show you the location where you want to create a new project so by default it will take your workspace location this is a workspace location we can say and whatever projects you are going to create in future also going to store in the same location so we need to just specify your project name and then click on the create So once you click on the create now your pie jump will window will be open like this and now your project is created like this So this is how we need to install pi jump id. It's very very simple. Okay Now the next one is we have done with Installation python and also pi jump id. So now we need to you we need to install these three packages install selenium robot framework Robot framework selenium library. So these three things are need to install and if you have a python already then only we can install these things Okay Now how we can install this first of all means to install selenium then robot framework then robot framework selenium library So we need to install a selenium robot framework. The selenium is option Okay So if you want to write normal Python with selenium script General way we can do this or if you want to use only robot framework, then you can go for these two or enough okay so i'll show you now how to install selenium how to install robot framework how to install robot framework selenium library so here if you install only robot framework it will just provide a kind of infrastructure okay but if you want to automate our web-based applications we need selenium library so that we need to download separately that we need to install separately so along with the python and pycharm pi de we need to also install these three packages selenium robot framework Robot framework selenium library. Okay. Now I will show you all three how we can do this in the next screen selenium robot framework Robot framework selenium library. So these are the three things we need to install now go to your command prompt and as I said Prerequisite we need to have Python and also we need to have a pip So these are the two prerequisites to install these three packages now Once we have a prerequisite are met then we need to start installing selenium. So just type one command call pip install selenium so this particular command will install selenium packages and suppose if you want to uninstall your selenium just type pip uninstall selenium so these are the commands so once the installation is done the next thing is we need to install robot framework so if you want to install robot framework again pip install robot framework so this will automatically install the newer version of robot framework pip install robot framework after installation is successful and if you want to see whether the Framework is properly installed or not the version number all these things you can simply say pip showed robot framework So this command will give you robot framework information What's the name of the library and version number summary other other details will be populated So pip install robot framework then pip show robot framework So pip show robot framework just for giving the information about the framework. Okay that's it so here there are multiple options also there to install robot framework so the first option pip install robot framework will completely install robot framework newer version and suppose if you already have the robot framework in your system if you want to upgrade that into latest version then you need to execute directly pip install iphone upgrade then specify robot framework so this is just for upgrade if you already have if you want to go for next level or next version then you need to use pip install iphone iphone upgrade robot framework and Suppose if you want to install specific version of robot framework Then you can install this pip install robot framework and equal to here you need to specify the version number Okay, so this is the another command suppose if you want to uninstall the existing robot framework Just say uninstall pip uninstall robot framework. So this will uninstall your robot framework now There are few commands are there pip list. So this will give you water all Packages we have installed on top of Python. Okay, and you can also use pip show robot framework here I have used and you can also use pip check robot framework This will also give the same information now if I just execute pip list command it will give you okay It will give you all the if I yes pip list command it will give you whether this robot framework install or not Okay, so I already executed this commands. So let me show you just open your command prompt. I already opened just type here pip list okay if i just click pip list it will give you what are the packages you already installed so you can see here robot framework which is already installed selenium is already installed here okay so this command is very useful now so far with this we have also installed robot framework so we have done with selenium we have done with the robot framework now we need to install robot framework selenium library so there's a last one robot framework selenium library so from the same command prompt execute pip install robot framework iPhone selenium library pip install Robot framework iPhone selenium library. So this will download and install robot framework selenium library So this is a command pip install robot framework iPhone selenium library Suppose if you don't want to have this library can still uninstall it so uninstall robot framework iPhone selenium library So this will uninstall your robot frame so these are the list of items which we need to have to work with the robot framework now In PyChamp IDE also, we need to add these packages. We already installed Python, PyChamp is also there, and we also installed all these packages. But these packages are already there in Python now. We have just installed. But in PyChamp IDE, we don't know about these packages. We need to add these packages, Selenium, robot framework, robot framework, Selenium library. These three libraries, we need to add into PyChamp. okay then only we can work with the robot framework within the pycharm we have just installed them but uh pycharm doesn't know where where these plugins are available where these packages are available so that's the reason now in the pycharm we need to set these three libraries now i will how we can set now i have done people's command to see all the stuff now go to again pycharm and in the pycharm if you just go to pycharm this is my pycharm window now this is our project okay this is your project inside the project just hold on okay just a moment let me just open my pie jump one more time so I have pie charm window I have pie chan pie chan icon on my desktop okay let me just open this okay so once my pychamp is launched i'll show you where exactly this option so first we need to select the project okay and then we need to go to the settings and here you can see so this is my pychamp so it is just launching my pychamp so once it is launched you need to uh this is our project okay this is our project so here uh it is also giving the menu here actually so just hold on yes so now i can see the menu right just a moment let me show you the menus all right so this is my piechamp so we need to just select your project and go to file now you can see settings option okay go to the settings so inside the settings you will see this window so just need to go to plugins so inside the plugins we need to so not in plugins we need to select the project test project okay so here you will see two options project interpreter project structure so just select this your project and just go to project interpreter now here you can see all the libraries already I have added here so PPC robot framework robot framework same library selenium so these three already there here but I have already previously added so there's a reason you can see here but in your case we need to go to add them so how we can add it just click on the plus button here now here search for the library whichever you want just type selenium then it will come see them so it comes under the blue color so that I already installed so select the selenium Then you will see here install package So once you click on the install package that package will be installed in pi jump within the pi jump Okay, and similarly if I have a robot framework, I'll say robot framework. So now it will show you robot framework So once you install package that will be installed in your pi jump now similarly robot framework iPhone selenium library is also there So selenium library, so this is a one you don't go for a version. So this robot framework iPhone selenium library So this I have already installed. So these three plugins should be part of your PyCharm Okay, and once you click on install package and plugins we need to install one after another then after that your PyCharm should be Restarted okay, and after restarting then you can see those plugins are part of your settings Those packages are part of your project interpreter and you can see all the packages list here So now you are ready to start your robot framework test cases and one more thing we need to do here so we have done these things and next one is We need the Intelibot at the Red Cilium Library plugin. So why we need this is whenever you are creating the files, like robot related files, robot framework test cases in your PyCharm, your PyCharm cannot identify those files. Suppose normally when I create our test case in robot framework, we'll say.robot is extension. The file name should be end with the.robot is extension. So that kind of extensions cannot be identified by PyCharm. so to do this we need to install intilibot cilium library plugin so where we can do this this is again go to settings and here and not project settings so in the project test project settings you can see project inter inter interpreter here we have just added packages but we need to go to plugins now so inside the plugins just we need to go to marketplace and here you need to search for this let's say intilibot plugin and say intilibot so there are two plugins are displayed and this intel about is a very old one and it is having some issues no one is using now now we need to go for this one intel about it that cm library patched so i already selected and click on install then i already installed it actually so if i select this i i'm not getting install option here because you already installed so once you click on install and close this window your intelligent your python will be restarted and then this plugin will be added to your Python and this plugin is required to identify the robot or framework files and it also it will give you auto sessions whenever you are typing some keywords you are not remember those keywords every time right if I just type one or two characters it should be populate and it will give you the suggestions even those things also we will get automatically when you install this particular plugin within the Python so this plugin is also required so finally how we have how many things we have installed So first we need to install python then we need to install python ide Then we need to install selenium robot framework robot framework selenium library These are the packages which we need to install through command prompt and after that go for pyjama.pyte once again Then we need to add these three packages along with this. We need to also add intellibot intellibot plugin intellibot with selenium plugin selenium library plugin which we need to add so these are the stuff which we need to have in your pie jump and then we are ready to start writing your test cases in robot framework okay so this is all about the setup okay so in the next video we will see how we can write very basic test cases using robot framework okay so thanks for watching this video guys