2

I have done a great deal of Mobile Automation on Appium, Frank, EggPlant, Xamarin, Xcode UITesting and Xcode UIAutomation. Recently a third party started supplying Ruby with Calabash scripts. I started to look at this option and found the following article: http://qualitytesting.tumblr.com/post/156318324159/ruby-projects

I was particularly drawn to the following comments in the article:

The biggest problem with Ruby is its potential to be abused. I think that this is a particularly prevelant problem when using it as a test framework language because lots of testers do not have any formal programming training behind them and are often not knowledgeable about object-oriented principles or maintainable architectural patterns. Testers are often hired on their edge case ability rather than their programming ability, and are often hired by hiring managers without sufficient programming knowledge to assess their programming ability, hence why it is so dangerous to use Ruby.

And this section:

The trouble with Ruby’s lack of rules is compounded by it being an interpreted language. You don’t really know whether it works until you run it, which is laborious - the feedback loop is very slow in comparison to compiled languages. Even if it runs, it’s not necessarily doing anything. IDEs can help you and give you syntax errors up front, but with such loose constraints on the use of the language, there is no end to the potential for misuse and spaghetti code.

And finally:

There is no protocol/contract/promise in Ruby. There is no guarantee that the var that you think is a string isn’t actually an array, or any other type of object. It is dangerous to put a tester on a framework that doesn’t have your back, considering that culturally, testers are generally held to lower standards for programming than developers, and their code is often taken less seriously and held to a lower bar than production code. Culture may be to blame for this, but it is a problem nonetheless. Add this to any concerns your business has about the value of UI tests; using Ruby or Python is a good way to further destabilise and devalue your UI tests

The article then suggests sticking to ruby for scripts rather than larger projects. Since Test Automation often becomes project like in its size, this might be a concern.

So my question would be, is Ruby a dangerous language to use for Test Automation and am I safer sticking with more statically typed languages? Or is Ruby fine to use and this article has missed the point?

5
  • 4
    All this article is saying is that it's dangerous to hire unexperienced coders for important projects. Tests could compile and run just fine with C# or Java but still not test anything at all. Jan 25, 2017 at 9:44
  • I think it might be saying that its easier to end up with spaghetti code using ruby compared with strongly typed languages if you have less strict developers. My main fear (having read up some more this morning) is actually the lack of the comprehensive intellisense benefits you get from strongly typed languages (using IDEs like xcode/ellipse/android studio). With page object pattern I love being able to have an instance of a page object and then type the 'dot' and see all the actions that can be performed. Can Ruby IDE's offer this (Rubymine might be able to but only to a limited degree)?
    – Charlie S
    Jan 25, 2017 at 10:42
  • * statically typed (not strongly typed)
    – Charlie S
    Jan 25, 2017 at 10:57
  • 3
    The article is just FUD. I've programmed in both the statically typed world and the dynamic, and they both work fine if the programmer is any good. And no language can save a bad programmer. Jan 25, 2017 at 12:53
  • My "fear" is quite a lot of people seem to share this fear of dynamically typed languages, for example: stackoverflow.com/questions/42934/…
    – Charlie S
    Jan 25, 2017 at 13:35

2 Answers 2

0

That is only the opinion of that author. He states that

  • Ruby has potential to be abused
  • Testers don't have programming any formal programming training
  • Ruby is an interpreted language and thus slow
  • Ruby has potential for misuse and spaghetti code
  • Weak typing is bad

Potential: yes and Abuse should always be a concern, with any language

Spagetti code can be written in any language, but few languages alow such terse, elegant and daindy code as Ruby while being the most readable language I know.

I recently read this blog post about Ruby Unit testing and it states that "Testing Is Important… and Opinionated" which says it all.

This blog is also very interesting, it states that unit testing in Ruby is better than interfaces like in Java.

In my opinion Ruby is one of the languages where unit testing is encouraged and used the most. Statically typing is to pleasure the compiler, dynamic typing is to pleasure the developer is a saying I picked up from somewhere, books are written about this subject and everyone has his own opinion so no more about this one.

Ruby is't slow, for a start, the time to code is drasticly lower than compiled languages which IMHO is most of the time more important than execution time of scripst that are executed in a matter of seconds and webpages that are returned in microseconds. Interpreted languages execution speed are slower than compiled languages: True, but once there is need for more speed you can call in compiled stuff through gems or micro services. If you reach your one million user cap you have more resources to play with, many big webservices started out using Ruby and Rails and moved on to other languages for parts of their service as the need rised.

In my organisation we both use Ruby and Java, Ruby being ideal for automation scripts, system management, makeshift solutions, scripts that need to be changed and configured a lot, small web app's and interaction with the web in general. Dev's do their own testing. Agile and Scrum methods are used.

Java is used for longtime development, bigger groups and these devs often use little testing and oldschool waterfall methods.

Devs are often good in the first and bad in the second or vice versa.

So it all depends and is very opiniated, I would say go ahead and try and make your own opinion.

5
0

I've realised my confusion on whether ruby is appropriate for large automation projects is actually part of the far wider Dynamic vs Statically typed debate. And really Ruby could have been replaced with JavaScript, etc.

For the reasons mentioned in the video below from the experts at Head First, I am deciding to stick with statically typed languages for UI automation testing, since dynamically typed languages (like JavaScript and Ruby) have the benefit of flexibility, but also the risk of flexibility:

https://www.youtube.com/watch?v=lPuQkC6HRPk

Calabash-Ruby combination has become popular in the test automation world (possibly due to the ease of learning ruby if you are new to coding). I realise this answer may well be marked down due to its view that Calabash-Ruby duo is not a preferred choice for large scale automation testing projects. This is simply my view and others may disagree. If you do downvote, please do leave comments on why so we can hopefully educate the debate further. I'm definitely open to accepting calabash-ruby if it is a sensible choice (and not just the easiest choice).

4
  • You cannot compare Ruby and Javascript. They both are dynamic, but Javascript is weakly typed and Ruby strongly typed. Ruby will raise an exception if you try to calculate 1 + '1', Javascript will happily return "11". For 1 - '1', JS returns 0. This makes it real hard to find bugs IMHO. Jan 25, 2017 at 15:48
  • Agreed that JavaScript is more dangerous, but dynamic languages still miss many things at compile time & don't seem to lend themselves as well to page object design pattern.
    – Charlie S
    Jan 25, 2017 at 16:40
  • It looks like you already made up your mind : Ruby isn't for you and your needs, it's perfectly fine this way! It doesn't mean it's not possible to write clean, efficient, complete and readable tests with Ruby, though. Jan 25, 2017 at 16:49
  • 1
    Absolutely agree Eric - clean, efficient, complete and readable tests are possible in Ruby. I think its just a static vs dynamic preference and after looking into it a lot today, think i am just more of a static kinda guy :-)
    – Charlie S
    Jan 25, 2017 at 17:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.