Robot Framework notes

So, I had a chance to try Robot Framework for testing our project. In this post I’ll collect some quick notes and impressions from using the tool.

Good

  • The structure of tests is quite intuitive and straightforward.
  • GUI and the test cases style can be good for testers not familiar with programming (but someone still has to program keywords).

Not good

  • Too GUI based as for developers. Integration with IDE would be handier. Although there are plugins for IDE’s, but I still have to use Robot Framework GUI and the IDE together.
  • Extremely slow application startup, scrolling, test case tree navigation, etc. (V 1.2.3)
  • Have to periodically close/reopen (V 1.2.3).
    • When it doesn’t print results in bottom-right part.
    • When git repository is updated.
  • Insufficient logging/debugging. When test fails or exception is thrown, it becomes a programmer problem to put enough information to exception/log/console.
  • “If it doesn’t work – close it and open again”. Just like Windows.

Personal summary

  • I found it adding unnecessary complexity as an additional GUI tool instead of being an additional library/framework.
  • In case you’re choosing a test framework for your project: good alternative as for me is py.test. It is more programmer-friendly having the same level of integration with Selenium, better integration with IDE; keywords is a nice abstraction, but py.test fixtures are not worse. Both have to have a proper code architecture and structure; then test suites can be good structured and intuitive. If in your project you already use Robot, this paragraph is not relevant.
  • GUI application is very-very slow and full of bugs. In newer versions some issues are fixed. V1.4 doesn’t have the scroll issue, V1.3 doesn’t have to be restarted after every test.

Results of working one iteration (3 weeks) as a tester

  • Installed RobotFramework, Ride for RobotFramework, the test project in local environment (on Ubuntu 14.04).
  • Researched the Ride updates. Current used version is 1.2.x; V1.4 has issue with long start (freezes on Loading window for three minutes); v1.3 is more stable than 1.2.
  • Researched current test project architecture; created a library (class) for working with web driver elements.
  • Researched the possibility to use polling instead of sleep(), including the proof of concept on some test cases.
  • StackOverflow question: Send a keyword to another keyword as a parameter
  • StackOverflow question #2: Send a non-serializable parameter to a keyword

TODO

Submit a bug to Ride Github.

PyCharm notes

Most of the notes should be applicable to the latest PyCharm version, but by historical reasons in the office I use PyCharm 3.4, so some of the notes might be related to it.

Auto-expanding import blocks

To make the import blocks expanded by default go to File -> Settings -> Editor -> Code Folding  and uncheck the Imports  check-box.

Explanation: by default the import section in the beginning of Python files is collapsed and for me having it expanded is much more convenient. Because modifying the import section is a common task that is often done manually. And clicking on a small expand/collapse icon is a bit annoying.

Adding a virtual environment (virtualenv) interpreter

Navigate to File -> Settings -> Project Interpreter , click the cog icon in the top-right corner and select Add Local . In the appeared file selection window navigate to your virtual environment directory select a Python executable (for example python2.7), which usually sits in the bin subfolder.

Android development, VirtualBox and KVM

Few times already in the past couple years I tried doing some development for Android, but most of the time I decided to postpone that for another piece of undefined time.

The reason was that I always had issues with setting up the virtual device for debugging. And without debugging there is no development.

So, what was the problem? I always used a VirtualBox machine for development, having Windows as host and Ubuntu as guest. But to run AVD (Android Virtual Device), Linux uses KVM infrastructure; and according to StackOverflow, KVM can’t be run together with VirtualBox.

Although, KVM can be emulated, but then AVD is extremely slow (which I observed on the previous computer).

helloworldrealdevice

Solution? I pulled from the shelf one of my old Android phones (not to kill the tablet accidentally) and configured it to be a debugging device instead of AVD. Bingo 🙂

Virtualbox ‘error in supR3HardenedWinReSpawn’ on Windows 8

I have recently bought a desktop PC with Windows 8 on-board, and one of the first programs I installed was Virtualbox.

But unfortunately I’ve got a famous error ‘VirtualBox – Error in supR3HardenedWinReSpawn’ when running any virtual machine. In my case it was NtCreateFile error.

vb-error

Forums said that the error was introduced somewhere at version 4.3.14 and had to be fixed in later builds (current build is 4.3.28), but in the latest version I still observe the error.

Solution that worked for for me was uninstalling Windows update KB3045999 (to do that, go to Control Panel -> Installed Updates, find patch KB3045999, right click it, choose Uninstall).

Unfortunately, after some time Windows installed the update again, so I had to turn the automatic updates off.

What I tried and what did NOT help:

  • Playing with VirtualBox settings.
  • Downgrading to VirtualBox 4.2.* where some security features are not present yet.

Hope this helps someone.

Even better solution would be to use Linux 🙂

‘Unstage’ a file in git

I usually use a mix of command line and IDE GUI to run git commands. And today while trying to click Git Commit I accidentally clicked Git Add  for the whole folder including my IDE .idea sub-folder which I don’t need in my repository.

So I had to ‘unstage’ the content of the .idea sub-folder.

The operation is opposite to git add  and is called git reset. The parameter is the file (or directory) which has to be ‘unstaged’.

git reset <file>

In my case it was:

git reset .idea

Helpful links

 

Setting up WordPress. Super-simple-google-analytics and _setDomainName.

So, I use WordPress CMS to run this blog and super-simple-google-analytics plugin to collect some analytics.

And because the plugin is really super simple, it lacks some settings. In my case I want to use a sub-domain feature of Google analytics ‘_setDomainName’ to point Google Analytics to my main website.

My solution is maybe too straightforward, but it is super simple as well, and it works. So, to add a required feature, open the super-simple-google-analytics plugin settings, find line ‘_gaq.push([\’_setAccount\’, \’UA-%1$s-%2$s\’]); ‘ and the following line after it:

_gaq.push([\'_setDomainName\', \'your-domain.com\']);

 

Then click Update File and you’re done!

Oh, yes it works only for asynchronous loading of Google Analytics.

Now some pictures to illustrate this:

1. Link to the plugins page. I use multi-sites configured in my wordpress, but in single-site version it should not be very different:

super-simple-ga-menu

2. In the plugin list find the Super Simple GA plugin and choose to edit it’s code:

super-simple-ga-edit-plugin-link

3. Make the changes:

super-simple-ga-editor

Devoxx 2014: ‘Three hours to build a Java EE application’ workshop

OK, I was late for the workshop because of talking to people presenting their projects outside. But it seems that I’ve got the main idea of the workshop:

If you use Windows and something doesn’t work – reboot.

Even more general idea:

If something doesn’t work, then let me guess: you’re using Windows.

git aliases

Basics of git aliases

Use git config alias.* , Luke. Or edit your .gitconfig file.

An example will be a shortcut for git branch – br:

git config alias.br branch

Or add the following to your .gitconfig (~/.gitconfig  in Linux):

[alias]
br = branch

Global/local aliases

Aliases can be applied on a global level (for the whole operating system) or locally – for the current repo.

To create a local alias you may use git config alias.*  command:

git config alias.br branch

To do the same on a global level you can modify your global configuration file (usually ~/.gitconfig ) as it was shown above or run git config with –global modifier:

git config --global alias.br branch

Some useful aliases

git config alias.st status
git config alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)\<%an\>%Creset' --abbrev-commit --date=relative"

Here st will be a shortcut for status and lg will output nicely formatted commit history.

Resources