Python Tutorial for Robot Framework test library developers available

2,387 views
Skip to first unread message

Janne Härkönen

unread,
Aug 14, 2009, 8:39:46 AM8/14/09
to robotframework-users
Hello,

We have started writing a short tutorial that introduces
Python programming language to people interested in
implementing test libraries for Robot Framework.

The tutorial can be found from:

http://code.google.com/p/robotframework/wiki/PythonTutorial

This is a work in progress; all comments are very much appreciated.

best regards,
__janne

Antakar Donvar

unread,
Oct 4, 2016, 7:09:12 AM10/4/16
to robotframework-users
The links to the tutorial and examples - all are dead.:
https://code.google.com/archive/p/robotframework/wikis/PythonTutorial.wiki

Is there up to date location for these materials?

Tatu Aalto

unread,
Oct 4, 2016, 10:43:17 AM10/4/16
to ant...@gmail.com, robotframework-users

Ugh

Have you looked at http://robotframework.org/

The user guide has lot of information on that topic too http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#creating-test-libraries

-Tatu
Send from my mobile


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Pekka Klärck

unread,
Oct 5, 2016, 4:09:06 AM10/5/16
to ant...@gmail.com, robotframework-users
2016-10-04 12:27 GMT+03:00 Antakar Donvar <ant...@gmail.com>:
> The links to the tutorial and examples - all are dead.:
> https://code.google.com/archive/p/robotframework/wikis/PythonTutorial.wiki
>
> Is there up to date location for these materials?

This tutorial hasn't been properly migrated from Google Code to
GitHub. The contents are still under the main project and you can find
them here:
https://github.com/robotframework/robotframework/tree/master/doc/python

The initial plan was to recreate the tutorial as an independent
project on GitHub, but nowadays I think it would be better to just
delete the tutorial altogether. The main reason I think it should be
removed is that there are so many good Python tutorials available that
us having our own doesn't give much benefits. We also have a separate
demo project at https://bitbucket.org/robotframework/robotdemo that
has a better test library example. Finally, the tutorial itself is
outdated with references to outdated Dive Into Python book and not
discussing Python 3 at all. In other words, updating the tutorial
would pretty much mean rewriting it altogether and at least I don't
really have time for that.

What do others think, would a separate Robot Framework specific Python
tutorial give some real benefits? Do you think it would be so good
idea that you'd be willing to write it yourself based on the old
tutorial or from scratch? If we don't have a separate Python tutorial,
should we list good Python references somewhere (where?) or can we
just expect that people wind them via python.org or their favorite
search engine?

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

Tatu Aalto

unread,
Oct 7, 2016, 1:29:07 AM10/7/16
to Pekka Klärck, robotframework-users, Antakar Donvar

Ugh

I think, and my opinion should not count that much because I don't need the tutorial, once you understand what is a library keyword, the problem you are trying to solve turns into a problem how to solve the problem in Python. And what is a library keyword is well explained in the user guide. Also there are plenty of good books for Python, which explains the Python world well.

But I remember, when Python and Robot Framework was new for me, how scary that world did look like. All that installation, pip and many more things made it really hard to understand what all this is about. But now days there are plenty of good blog posts to ease the pain starting first time with Robot Framework.

Perhaps the best solution would be have a links to these external resources?

-Tatu
Send from my mobile

Tset Noitamotua

unread,
Oct 18, 2016, 8:05:12 AM10/18/16
to robotframework-users, pekka....@gmail.com, ant...@gmail.com
In short: I think it's worth to have a Python tutorial dedicated to Robot Framework.

My journey with Robot Framework and Python begun in combination with Sikuli [1] approx two years ago. I went through Mike's Cognition blog [2] and started a rewrite on my own [3]. Also started with a SikuliX library for RF [4] one year ago but dropped development and further learning because of other duties. I was new to programming and never heard about Python before I got in touch with RF and test automation. I think I have read RF's Python tutorial, too. But Mike's blog [2] was what really opened my eyes. What's really great about the Sikuli thing in combination with RF is that the code you write becomes visual. You see the code you write in action. That (in my opinion) really helps to better understand what's happening behind the scenes and thus helps to learn programming in sense of developing a library for RF. When you don't see what the code is doing (line by line like in a debugger) it might be a bit too abstract and hard to understand for someone who's new to programming.

My suggestion is to have a Python tutorial which takes Mike's Cognition blog as an example and shows how to build a library which magically moves mouse cursor and makes inputs on a GUI application (e.g. calculator).

Actually this is often the first thing software testers (without programming skills) in companies out there are confronted with when it comes to discussions about test automation. Managers want to see robots do that "stupid" clicking. And although management often believe to understand GUI automation is what test automation is about - which is a great mistake! - it's a good starting point for learning both programming and test automation.

In contrast to Mike's example it might be better to use some Python alternative for image comparison instead of Sikuli to avoid having a Java dependency. Although Sikuli is well document and relatively easy to start with it would add unnecessary complexity to a beginner tutorial because it's not very easy to set up from RF point of view (requires Java VM, Jython and/or, remote library etc.). May be Pillow [5] is a better option(?)

I really think it's worth to have a Python tutorial dedicated to Robot Framework. Why? Who are the users of RF? Who are the users who try out RF for the first time? I guess many of the first time users are like me testers with limited programming skills looking for a solution which helps them to automate their manual, tedious and repetetiv tasks which by their colleagues are blamed to be the bottleneck in the development process. They are looking for an easy solution which their managment often don't want to pay money for. And deep in their mind they have the promises from commercial test tools providers that make them falsely believe that one can successfully do test automation without programming skills - (which btw is totally bullshit!).

So if you want to make this first time users stick to RF you don't want to send them away for a programming tutorial. Because they don't want to learn prgramming or at least believe that they don't need or have to as they might believe that there are tools that enable them to succeed without programming. Instead you should make clear that there is no successful test automation without at least minimal programming skills and at the same time show them how easy it is to learn that bare minimum with a dedicated tutorial. This tutorial should focus on test automation in first place not on programming in general. Programming should serve as a neccessary but natural helping tool (Werkzeug) not more not less. 

Cheers
Tset

To post to this group, send email to robotframe...@googlegroups.com.

Stefan S

unread,
Oct 18, 2016, 10:10:45 AM10/18/16
to robotframework-users
I agree with you in the point that GUI automation is a good way to impress managers. :D
But I do not thing this is a good way to teach library writing, since GUI automation from my point of view is really  really complicated.
I have some python skills and I'm writing python robot libraries for the xml based interface of our products and I'm far far away from 
being able to write a GUI Library in python.

I think for that "impress manager" scenario it would be best to stick to a good guide using an existing Library like Autoit Library or the like.

For learning writing a library (python) this guide should aim for a lower hanging fruit like, like,.... a tutorial app, maybe a CLI script with parameters
and return values.   I assume this is a more common task... OK I had a trainee who was really surprised when I showed him Windows 7 has a Command prompt and programs can have command line parameters..... When I noticed he used a GUI Automation tool (Ranorex) to setup a serial terminal. :)

bye

Tset Noitamotua

unread,
Oct 18, 2016, 11:53:13 AM10/18/16
to robotframework-users
Hi Stefan, have you tried Sikuli in combination with RF? The most difficult and tricky part is the setup. And Sikuli approach is kind of different than normal GUI automation (e.g. Selenium) because you don't have to bother about element locators (e.g. xpath or css) and the underlying technology of the SUT (system under test) you just work with images / screenshots of your GUI. I am very sure you are less far away from  being able to write a GUI Library (at least with Sikuli) than you believe. Just try it ;-)))

As I did my first POC (proof of concept) with Sikuli + RF I could not believe my self what I achived, too. I really though now I will become god of GUI automation because actually I could automate anything which is running on some kind of display - without even knowing which technology is under the hood. The POC was for an application which is running as a plugin in a fat client (IBM Lotus Notes) that is provided as as Citrix XenApp. Manual regression tests execution for that took 14 man-days. Even our IBM support had no clue how to automate that sh*** at least not without sending an army of consultants and engineers. Nobody would want to pay that. Guess you can image how I felt. IBM experts could not help us but I - a tester with practical no programming skills - did it! I found a possible way one could go. Of course implementing all the existing regression tests would be a pain in the ass and a maintenace nightmare but it was better than nothing. And I was really proud of my solutioin. I am not about to show off. Just want to point out what is possible and how easy it actually is to learn it. Btw. the end of that story is - the mentioned application is about to be dropped soon.

The tutorial's purpose should not be to impress management - i did not meant that, sorry if it sound like that. It should help to utilize Python for writing own test libraries. And as childer learn most visually I think it's a good approach for adults, too. And if you think GUI automation is a supreme discipline than OK, Then one could say if you master a tutorial about creating a GUI library then chances are good that are ready for creating any other library :)))

I am not telling that test automation projects should focus on GUI test! In real project automated GUI test should be a test pyramid's peak, meaning that you should have more API tests than GUI tests and even more UNIT tests:


                   /\
               /        \
            /              \
          /  GUI tests  \
       -------------------------
      /      API tests      \
    --------------------------------
  /         UNIT tests         \
---------------------------------------


Cheers
Tset

David

unread,
Oct 19, 2016, 12:19:44 PM10/19/16
to robotframework-users
Probably interesting to note that if someone made a well maintained or at least nicely usable Sikuli library for RF, you wouldn't need to go through all that trouble Tset. I think I recall some existing ones before but that might have been yours, if one searches around.

I wrapped Sikuli for RF before too, but I found their Java interface more appealing than their Jython one that had more setup work to do. Frankly, it was easy to deploy for Java over a remote library with RF. My library has since been obsolete with Sikuli X though, and there's a better Java remote library to use with than when I started. https://github.com/daluu/simplesikuli

I also agree with Stefan, if you want to showcase GUI automation in a tutorial for RF, you go with what's more mainstream. Image recognition isn't quite as common, and easier to understand really (take screenshot, crop it, find that cropped screenshot on screen and act on it - click, type, or check if it exists on screen), the implementation details may be another thing, but that's not the point for the tutorial/user. The more common/popular GUI automation is by object identification via various identifiers and for that AutoItLibrary is the standard for RF, with something like this https://github.com/Omenia/robotframework-whitelibrary as alternative.

And then the Selenium2Library is equally good for tutorial because most UIs these days are web based UI. Check QA job listings and more ask for Selenium experience than QTP, desktop UI automation, etc. let alone expertise with AutoIt or Sikuli (which is rare). So a tutorial with Selenium2Library covers the most widest in audience interest/coverage.

Tset Noitamotua

unread,
Oct 21, 2016, 5:05:50 AM10/21/16
to robotframework-users
As I mentioned Sikuli might be not the best option because of it's tricky set up in combination with RF but there are some pure Python alternatives (e.g. Pillow). You are right - Image recognition isn't very common in test automation. If you have an exotic SUT it might be your last resort, though and it opens possibilities which one just can't automate with the same ease or at all with Selenium. And what is a big plus - you can automate a whole End-2-End process across multiple technologies. Thus I would not tell of image comparison based automation completly. It has some sexy sides,too ;)

What speeks against a tutorial which shows how to write his own lib for Senenium Python bindings is that this would require to confront somebody who is probably new to programming at all with at least five (5) technologies, namely RF, Python, Selenium, HTML, Xpath. And then there is  CSS and JavaScript, too. For an image based lib you would just need RF, Python and an image comparison API or tool like Pillow (or Sikuli).

But I guess I see what the main problem is which we should talk about first before talking about a potential tutorial. 

If at all then who should a tutorial be made for? Who is the majority of guys who are comming across RF from Google or other search engines vs. what is the desired target group (@Pekke)?

I did a lilttle research on my PC. Seems that I came across RF somewhere in the beginning of 2013 (I bookmarked Pekke's website in May 2013). Some robot files indicate that I have tried RF the first time in May 2014 - one year later! And then another half year later (end of 2014 / beginning of 2015) I gave it another more serious try because I had to try to automate something (see my last reply - Silikuli POC) that just was not automatable with the  skills I had at that time and neither our IBM Consultants or any other opens source or commercial testing tool which my boss would spend money for. And I realized that it worked - and acutally it worked better than I expected. So it took me 1,5 years to give RF a serious try. Why? Because I was afraid to touch it thinking that it is to technical. Today I don't want to have any other (not even a commercial) tool Because RF just rocks and it's damn easy to learn and to get started with. And if it had a cool tutorial wich is technology independent from SUT's point of view (thus it must be image based!) than I wouldn't have been in charge of manual testing any more much earlier (I started as manual tester QA in May 2012). 

One more plus for a image based lib tutorial: people are searching for automation solution when they have an exotic SUT not a simple HTML - there are tons of specialized test tools for specific technologies and so for web, too. With a tutorial for web you would be among hundred or even more tutorials - so nothing special. With an image based approach you can state to all QA in the world - you can automate anything (croassplattform, crosstech. , end-2.end, etc.) and you don't need any other testing tool - never again ;))))

Cheers
Tset

David

unread,
Oct 21, 2016, 9:08:33 PM10/21/16
to robotframework-users
The power and sexiness of RF in my point of view is its ability to integrate various test tooling together to test a system. This includes tech platforms (.NET, Java, Python, Perl, PHP, etc.) and various test tools (e.g. web, desktop, mobile, CLI). Yes, a tool like Sikuli will showcase a RF test design that will work across UI/endpoints. However, you generally want the best tool optimized for the given endpoint. e.g. you use Selenium for web UIs, not Sikuli, and resort to Sikuli for things you can't natively do with Selenium. Likewise, there are mobile tools (Appium) for mobile testing over using a general one like Sikuli.

Aside from a library developer tutorial, a real tutorial for RF that showcases integration across multiple tech platforms (use of remote libraries with say maybe some custom simple demo library), and various tools (Selenium2Library, one of the available mobile libraries (forget if there was one called AppiumLibrary, just search online), use of SSHLibrary or operating system keyword calls, a SikuliLibrary if one already exists, AutoItLibrary for desktop UI), with an RF test case that showcases interaction between multiple endpoints (e.g. do something on web UI, validate the change on mobile app UI, and vice versa between desktop UI, web UI, mobile app UI, etc.). That will wow a person considering RF, to see its power that few other frameworks can compare, and still easy to develop for. That is one such tutorial we are currently missing.

Your viewpoint about a Sikuli library developer tutorial is akin to https://en.wikipedia.org/wiki/Law_of_the_instrument, let's not be overly ecstatic to use Sikuli for everything. It can become bad habit, and end up with an over reliance on it. What if under certain circumstances, it doesn't work?

As for target audience, hard to say, but one can get an idea browsing this forum and other RF user forums (on LinkedIn, Facebook, Google+), and see what most people post about (questions, comments). That tells you how most people are using it.

Pekka Klärck

unread,
Oct 24, 2016, 5:26:37 PM10/24/16
to Wladislaw Wagner, robotframework-users
2016-10-21 12:05 GMT+03:00 Tset Noitamotua <wagner.w...@gmail.com>:
> What speeks against a tutorial which shows how to write his own lib for
> Senenium Python bindings is that this would require to confront somebody who
> is probably new to programming at all with at least five (5) technologies,
> namely RF, Python, Selenium, HTML, Xpath. And then there is CSS and
> JavaScript, too. For an image based lib you would just need RF, Python and
> an image comparison API or tool like Pillow (or Sikuli).

I agree web testing is somewhat complex domain to introduce someone to
writing test libraries for Robot, but I don't think image based
testing a la Sikuli is much or any easier. I'm actually pretty happy
with this existing demo project:
https://bitbucket.org/robotframework/robotdemo

Regardless what kind of tutorials or demos we have related to creating
libraries, it's a different discussion to agree do we need a separate
Python tutorial. My current thinking is that we don't need one, but
listing links to good general Python resources would be great. What
Python tutorials, books, online courses etc. have people on this list
found useful?

Stefan S

unread,
Oct 25, 2016, 4:38:40 AM10/25/16
to robotframework-users
I agree we do not need yet an other "Learn Python" guide and maintain it.

Links... https://www.codecademy.com/learn/python I like the "Hop in and start" without sign up first
and www.google.com with "python [add problem here]" 

And of cause the best way to learn any thing you need a problem to solve, which is a highly personal thing.

The robotdemo project is nice, it would be nicer if it were linked like here RobotFrameworkUserGuide creating-test-library

bye

Tatu Aalto

unread,
Oct 25, 2016, 4:44:19 AM10/25/16
to stefansc...@gmail.com, robotframework-users

Ugh

If recall correctly, I did read something from the Python beginners guide: https://wiki.python.org/moin/BeginnersGuide

Also Dive In To Python was also useful for me: http://www.diveintopython.net/

-Tatu
Send from my mobile

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages