Resource Files in Robot Framework

  • 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 Demo and then select the New Resource
selecting-new-resource-from-project

Enter the resource name as Userdefinedkeywords and select the TXT format and then click on Ok button
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 ${var1} and give the value as 4

selecting-new-scalar-variable-from-resource

craeting-new-scalar-variable-var1

Create another scalar variable as ${cmp2} and pass the value as ten only.

creating-another-onrscalar-variable

And define a keyword by right-clicking on the Userdefinedkeywords file and select the new user define keyword, and give the name as Comparevariables and click ok.
selecting-user-defined-keywords
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 show 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

Developer Tools in Robot Framework

0 results
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions