The Features of Ride Editor

The ride is a testing editor for robot framework, going further we will write test cases in the ride. To open the Ride editor we have run the below command

ride.py

Unfortunately, I am getting an error while opening the ride editor and hence I am using the following command to open the ride editor.

python.exe  -c "from robotide import main; main()"

Once you enter the above command in the command prompt, the ride editor page will open

ride-editor-forpython-37

In this section, we are going to discuss the Options and Features which are available in the Ride editor IDE. These Options and Features will help us to test our projects.

Creating a New Project:

Go to File and click on the New project as shown in the below image

go-to-file-and-select-new-project

Once you click on the New Project, the following dialog box will appear

new-project-page

Enter the name of the project and the created path is the path, where the file is getting saved. If required you can change the location of the file. The project can be saved either Folder or a Directory.

We can also save the project file like ROBOT, TXT, TSV or HTML.

I am creating a Directory by the name called Demo in my framework directory

creating-demo-project

The Name of the project has shown on the left side and on the right side we can see the three tabs Edit, Text edit and Run.

The Edit has a lot of options on UI as shown in the below image, in this section we can add data required to run our test cases and also we can import the Library, Resources, and Variables and also we can add scalar, List and Dict.

edit-page-ride-editor

The details added in the Edit tab can be seen in the Text Edit tab, we can also write the code here.

test-edit-section

If there is any change added in the Text edit, it will be seen in the edit section and hence both Edit and Text edit are dependent on each other and any changes done will be seen on both.

Once the test cases are ready, we can use the third Tab Run.

run-tab

The Run UI is as shown above and it will come with options like Start, Stop, Pause, Debug, Continue and Next, step over. You can also create a Report, Log for the test cases.

I have successfully created the new project Demo if you right-click on the Demo, you will get different options, To create Test cases, first, we have to create New Suite.

different-options-to-create-test-cases

Create a New Suite, Demo1 and click ok.

creating-new-suite

Right-click on the demo1 test suite and select the New Test Case

creating-new-test-case

The New Test Case will appear as shown below, I am creating the new test case by the name First Test Case and click on ok.

creating-new-test-case

Once the test case is saved, the test case page will appear as shown below

test-case-page

The Test case has options like Documentation, Setup, Teardown, Tags, Timeout and Template. There is an Edit button across each option, by clicking on it, a screen will appear, wherein you can enter the details for each option.

Documentation : The documentation is used to add the details about the test cases, which may help for future references.

Setup and Teardown : If there is a setup assigned to the test case, this will execute before the test case execution and the test setup that will be executed after the test case is done for teardown.

Tags : The tags are used for tagging the test cases, this can be used to include or exclude specific test cases. We can also specify the critical test cases over here.

Timeout: This can be used to set a timeout on the test cases.

Template: The Template is having the keywords to be used for the test cases, it is mostly used for the data-driven test case. The high-level user-defined keywords are specified in the template and test cases are used to pass data to the keyword.

The Robot framework test cases are keyword-based and we can write the test cases by using the built-in keywords or by importing from the library. We can also create user-defined keywords, variables, etc.

The Search keyword option can be used to search keywords

search-keyword

To get the list of all the keywords which are available, just enter Ctrl+Alt+Space, In the tabular column, you will get the keywords that are available.

in-built-keywords

in-built-keywords

The following example demonstrates creating a simple test case

First, open the command prompt and then type below command to open the Ride editor

python.exe -c "from robotide import main; main()"

And the next step is to create a new directory, I have already created a test case by the name first test case, now open the test case and enter the test case.

Search for the should be equal keyword by pressing Ctrl+Alt+Space button simultaneously

should-be-equal-keyword

And pass the two integer values 4 and 4 in the next column

passing-integer-arguments

Whenever we write the test case in the script format the same thing will be reflected in the text editor as well.

text-editor-page

Now press Run button and select the First Test Case, on the left side corner and then click on the start.

run-the-test-case

As soon as you press the start button, the editor will ask to save the changes and run the test cases, press yes.

The output of the test case will be displayed as shown below

output-of-the-test-case

You can see that the above test case, 1 passed and 0 failed, and the robot framework also provides the detailed log and the detailed report

deatiled-report-and-detailed-log

Just click on the log option on the top of the UI

select-log-t-see-in-detail

The complete log report is as shown below

log-report-one

If you click on the + Suite demo1 option in the below, you will see the complete details of the demo1

suite-of-demo1

complete-details-of-suite-demo1

In the same way, if you click on the + Test, you will see the details of the First Test Case

complete-detials-of-first-test-case

The Robot framework also provides which keyword we have used in the test case.

Consider another test case which contains wrong arguments for should be equal keyword

second-test-case

If we run the above test case, if the test case is wrong then the output is highlighted and showed as 1 failed.

failed-test-case

And if you open the log report

demo-log-test-statics

And the Test Execution log is, therefore when the test case fails then the log color will be changed to red.

test-execution-log

Importing Libraries in Robot Framework

Library: The test library provides the actual testing capabilities to the robot framework by providing the keywords. There are several standard libraries that are bundled with the framework, they are Internal library and External library.

The libraries are mainly used externally in test data, but they can be also used in custom test libraries if there is a need. Especially the built-in library is often useful when there is a need to interact with the framework.

We can import the external libraries such as Selenium Library, Excel library, and Database library into the robot framework either by

  • Cloning/Downloading library from the GitHub or
  • By using the pip

Installing the Selenium Library

To install the selenium library into the robot framework Navigate to the link SeleniumLibrary

The GitHub page will open, click on the clone/download and then select the download the Zip.

select-download-zip-option

Once you click on Download Zip and select the path to save the selenium master file

save-the-selenium-library-master-folder

Once the file completes it's downloading, go to the file location and extract the file from the Zip format. Open the extracted file, you can see the selenium setup file.

selenium-setup-file

Open the Python file location and then save the extracted selenium library-master file inside the python 37 folders.

saving-selenium-master-file-inside-the-python37-folder

Now, right-click on the link path and copy the address of the setup file

copy-the-link-address-of-seleniumlibrary-master

Now, open the command prompt and directed to the setup folder and then, pass the command as setup.py install

passing-the-command-as-setup-install

Now you have successfully installed selenium library

finished-installing-selenium

Now open the Ride editor through command prompt and open the project and click on the Library which is present at the right corner, the library page will open, now add the name of the library as SeleniumLibrary and click on ok.

importing-selenium-library

If the library is installed successfully it will be displayed on the page as shown below

successfully-imported-selenium-library

If you have not saved the selenium file inside the python folder, you cannot import the selenium library successfully, while importing the selenium library, it will be displayed in red color.

While importing the library, if you made any spelling mistake also, the file will be displayed in red color only.

spelling-mistake-while-importing-library

Creating Web-Based Automation Test Case

We have successfully installed Selenium library, by using the selenium library let us create a web-based test case:

The steps to create a web-based test case is as follow :

First, open the Ride editor, and then right-click on the project and select the New Suite

select-new-suite

Create a new test suite as WebAutomation and click on ok

create-new-test-suite-as-web-automation

Right-click on Web Automation and create a new test case as OpenBrowser and click on the Ok button.

creating-new-test-case-as-open-browser

Open the WebAutomation and import the selenium library in that

importing-selenium-library-into-web-automation

We have successfully imported Selenium Library into Web Automation. Open test case and check for the keyword open browser, it will show you the necessary things to create an open browser such as URL and then the Browser.

url-and-browser

If you scroll down, the keyword show you what kind of browsers it will support for

supporting-browser-for-open-source

Now, pass the arguments as www.google.com and the browser like chrome

pass-the-arguments-for-keywords

Select the test case and click on the Run button and then click on the Start, we will get an error while executing the test case.

got-an-error-while-executing-web-automation-test-case

Open the log report and then open the test page, you will find the error message as

Message:
WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

error-message

Copy the link address and paste in the browser, the chrome driver page will open

chrome-driver-page

Click on the downloads, there you will get all the versions of chrome, before downloading, first check which version of chrome you are using.

For that just right click on the three dots(:) on the right upper corner of the windows and then select the help and then click on about google chrome

help-about-chrome

Currently, I am using 77.0 version

about-google-chrome

Go back to the chrome driver download page, it says that if you are using the google 77 version then download the ChromeDriver 77.0.3865.40

Click on the link and download, the index page will open, select the win32

select-thewin32-in-the-index-page

Once it completes downloading, extract the file from the zip format and then copy and paste it inside the script file of the python37

pasted-chrome-drive-inside-the-script-folder

Go back to the test case and Run the Web Automation test case, it will successfully open the web browser.

successfully-open-the-browser

The Next thing is, we have to close the browser, for that, open the test script and select the keyword as the close browser.

select-the-keyword-as-close-browser

Run the test case again.

log-report-for-open-and-closing-browser

Installing Excel Library

To install the Excel Library, copy the given link pip install robotframework-excellibrary and paste it into the command prompt.

installing-excel-library

But when I run the above command in the command prompt, I got the following error

error-while-installing-excellirary

    ERROR: Command errored out with exit status 1:
     command: 'c:usersuserappdatalocalprogramspythonpython37python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\User\AppData\Local\Temp\pip-install-nhlb8x5h\robotframework-excellibrary\setup.py'"'"'; __file__='"'"'C:\Users\User\AppData\Local\Temp\pip-install-nhlb8x5h\robotframework-excellibrary\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:UsersUserAppDataLocalTemppip-install-nhlb8x5h
obotframework-excellibrarypip-egg-info'
         cwd: C:UsersUserAppDataLocalTemppip-install-nhlb8x5h
obotframework-excellibrary
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:UsersUserAppDataLocalTemppip-install-nhlb8x5h
obotframework-excellibrarysetup.py", line 23, in <module>
        execfile(join(dirname(__file__), 'ExcelLibrary', 'version.py'))
    NameError: name 'execfile' is not defined
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

To install the excellibrary through GitHub, navigate to the given link https://github.com/NaviNet/robotframework-excellibrary

Click on Clone/Download and then click on Downloadzip

downlaod-the-exceli-library-zip-file

Save the Zip file inside the python37 folder

excel-libary-inside-the-pythpn37

Now, extract the zip file inside the python folder only

extracted-excel-zip-file

Now, open the excel library folder, you will see the setup file, right-click on the link and open the command prompt.

open-the-command-prompt-from-the-excel-setup-file-location

Resource Files

  • The Resource files provide a mechanism for sharing user keywords and variables
  • It is easy to create these resources
  • The resources can be imported by using the settings in the settings table

Now, open the Ride editor and right-click on the project and then select the new resource

creating-new-resource

Once the resource has been created successfully then it will be displayed on the left side corner.

once-the-userdefined-function-has-created

Now, right-click on the Resource and create a scalar variable and give the value as 10

craeting-new-scalar-variable-var1

Create another one scalar variable as cmp2 and pass the value as 10 only.

creating-another-onrscalar-variable

And define a keyword by right-clicking on the Userdefinedkeywords Resource and select the new user define keyword, and give the name as Comparevariables and click ok.

compare-variables-keyword

And find the keyword should be equal as integer and pass the new scalar variables

passing-new-scalar-variables

Create a new test case as TC06 and then try to use the keyword Comparevariables, it will not shown any keywords, this is because we have not imported the resources file over here.

new-test-case-06

Click on Save all, and then open the test suite and click on the Resource, the resource page will open and select the browser and select the userdefinedkeywords.txt file and click ok

userdefinedkeyword-path

create-resource-click-ok

You can see the userdefinedkeyword is displayed in the test suite

successfully-imported-userdefined-keyword

Now, open the TC06 test case and try to find the Comparevariable keyword by pressing ctrl+alt+space, you will find the keyword

successfully-added-the-keyword

Now select the test case and click on the Run and then click on the start button, the output is:

the-report-output

The Log report is

demo-log-report

The Test execution log report

test-execution-log-resource

Executing Test Case in Ride through Command line

We can also execute the test cases through the command line.

Open the command prompt and open the ride editor

Next, open the project and then open the test suite, in the test suite page you will the address path of the project saved.

path-of the-project

Copy the address link and open the command prompt and directed to the project directory and then pass the command as the robot name of the test suite

name-of-the-test-suite

Once you press Enter the test case will be displayed on the command prompt

exdcuting-test-case-through-command-line

Of we do not want to run the complete test suite, you can also run the particular test case by using the following command

robot -t testname

And the below link provided you with the various command-line options

https://github.com/robotframework/robotframework/blob/master/doc/userguide/src/Appendices/CommandLineOptions.rst#id7

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions