Robot framework and Protractor for angular JS testing

5,344 views
Skip to first unread message

Milind Moghe

unread,
Apr 28, 2014, 6:07:32 PM4/28/14
to robotframe...@googlegroups.com
Hi All,
I am fairly new to Robot framework and evaluating the framework for end to end testing for multiple components,integration tests, Web service testing etc. I am trying to find out if this framework can give me common platform for executing all kinds of test cases (not unit, component test cases). I am stuck at one place where I want to do UI testing but the team already have selected protractor as tool for end to end testing. (Protractor is a Node.js program, and runs end to end tests that are also written in JavaScript and run with node. Protractor uses WebDriver to control browsers and simulate user actions)(more details on https://docs.angularjs.org/guide/e2e-testing). These are the jasmine tests and takes care of everything.

If I want to use this framework, I have to go away from jasmine tests?

Thanks
Milind


Tatu Aalto

unread,
Apr 29, 2014, 1:53:36 AM4/29/14
to mmo...@gmail.com, robotframework-users

Ugh

I do not have an answer to your question, but if you do not get an answer the easiest way is to build a small proof of concept.

And as usual the business needs define what you tools one needs to use. If you are building end to end these where also the non coders must understand what the text case is doing, then I would go for the RF. If only a coder writes, reads and maintains the test then I would go for the protractor which seems to be more like a coding tool.

So gather your requirements, make small PoC and choose the right tool for the requirements.

-Tatu

--
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-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

mr

unread,
Apr 29, 2014, 4:37:12 AM4/29/14
to robotframe...@googlegroups.com
I think a disadvantage of Protractor could be that you have to know JavaScript to implement the test cases. You do not have to expect this when you use Selenium2Library for example.

Ed Manlove

unread,
May 14, 2014, 9:02:30 AM5/14/14
to robotframe...@googlegroups.com
Milind - Jasmine and Robot Framework are two different testing framework; Jasmine being Javascript based and Robot Framework being text based with natural language keywords. This being the case jasmine tests, for all practical purposes, don't work with Robot Framework. This doesn't mean you can't use both, you just can't use them as a single conjoined test environment.
 
I'm involved in an upcoming project that plans on using AngularJS so I have been looking into the question of how can one test angular through Robot Framework. As you mention Protractor is the tool for end-to-end testing of angular apps and is built on top of WebDriverJS. Researching the protractor library I see that Protractor adds the following to WebDriverJS

- additional locators
    by.binding
    by.select    deprecated (use by.model instead)
    by.selectedOption
    by.input    deprecated (use by.model instead)
    by.model
    by.buttonText
    by.partialButtonText
    by.textArea    deprecated (use by.model instead)
    by.repeater
        .row
        .col
    by.cssContainingText
- calls to element may be chained to find elements within a parent
- element.all
- delegates some WebDriverJS calls (getCurrentUrl, getPageSource, getTitle) to WebDriverJS but add wait
- adds waitForAngular function
- wraps webdriver.WebElement with waitForAngular function

To me, what would be most useful to have within the Selenium2Library would be the following Protractor features

- additional locators
    by.binding
    by.model
    by.repeater
        .row
        .col
- adds waitForAngular function

I've just started to look into how these can be implemented with the Selenium2Library and will pass along my thoughts about how this may be done. Also I welcome any feedback, ideas, suggestions from anyone currently or will be doing angular testing.

Ed

milmoe

unread,
May 14, 2014, 1:15:19 PM5/14/14
to robotframe...@googlegroups.com
Thanks a lot for your response.

I was not aware of what I am going to lose if I don't use protractor for UI testing. Your response helped me a lot.

I see that protractor makes your life easy to test the angular UI. But I am trying to understand if selenium and RF combination makes this testing harder or impossible??

What I understood from your response is that selenium supports the locator functionality of anuglar js but there are no keywords implemented in RF selenium library.

Am I making any sense at all:)?

Milind

Ed Manlove

unread,
May 14, 2014, 4:44:51 PM5/14/14
to robotframe...@googlegroups.com
To answer the question of how hard depends on what programing language knowledge you have. Again Protractor is written in Javascript so some level of javascript understanding is necessary if you use Protractor.

Although both Protractor and Robot Framework/Selenium2Library sit upon selenium, they're connected through different language bindings: Protractor through javascript or WebDriverJS and Robot Framework/Selenium2Library through WebDriverPython. Looking at how Protractor implements, through WebDriverJS, both by.binding and by.model it should be fairly easy to port over to WebDriverPython and thus Selenium2Library/Robot Framework. A jQuery/sizzle locator stratergy was added to Selenium2Library in one of its recent releases and my initial guess is the implementation of by.binding and by.model using WebDriverPython will be similar. by.repeator is a little more involved and I am reviewing the protractor code now. This should be possible without too much difficulty; I just want to get the implementation from a usability standpoint right.

There are slight differences in that WebDriverJS is implemented through non-blocking api calls [1] and uses a common technique, called promises, to handle expected, delayed results from those non-blocking calls. Protractor takes advantage of this to implement its waiting for angular actions to complete [2] to make dealing with angular delays and test timing easier. Since WebDriverPython does not have promises some other method will need to be to deal with the time. Selenium2Library has various methods for dealing with timing and waiting for elements but I have not yet tried anything.

Just as Tatu mentioned I was thinking that using Protractor's internal tests or at least testapp, the website they test on, would be a good test environment to test any angular additions to Selenium2Library.

Ed

[1] http://code.google.com/p/selenium/wiki/WebDriverJs#Understanding_the_API
[2] https://github.com/angular/protractor/blob/master/docs/control-flow.md
--

David

unread,
May 14, 2014, 7:49:50 PM5/14/14
to robotframe...@googlegroups.com
Just wanted to add some thoughts to this discussion:

  • There is also an option to just run Protractor jasmine tests through RF (user keyword calls using shell execute from OperatingSystem library like Run keywords or SSH library). This way you can get some reuse of existing tests when using RF for additional/other tests that might want to involve/include the jasmine tests. This approach however isn't very integrated or smooth, but is a last resort option if you did want to be able to integrate at some level with RF.

  • If you have developmental support from developers or a good QA lead/architect to maintain the automation framework/support, rather than look to using Selenium2Library as replacement for Protractor, jasmine tests, etc. you can instead opt to create a wrapper test remote library for RF using node.js calling Protractor to do things the jasmine tests do but outside the context of the jasmine tests. A good way to get code reuse here is to re-architect the jasmine tests, if possible, to go through a wrapper library layer to invoke Protractor calls (to then do assertions against, etc.) and thus this single wrapper library can be used by both jasmine tests and RF tests through the node.js remote library server, which is a similar analogy of Selenium page objects that can be used with some xUnit test framework or used outside like regular application code (for say non-testing purposes). There are a few implementations of a node.js remote library server that you can use with a wrapper library to Protractor, etc.:


This might be a good situation/scenario to see fruition of a possible ProtractorLibrary for RF implemented with node.js remote server. 
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

milmoe

unread,
May 15, 2014, 11:15:04 AM5/15/14
to robotframe...@googlegroups.com
Hi David,

We are kind of thinking to go with the first option as a fallback plan...

Thanks for the input.

Milind

Gaurav Deore

unread,
Mar 15, 2017, 6:57:56 AM3/15/17
to robotframework-users, mmo...@gmail.com
Hi Guys,

What I understood by reading last all replies. Protractor is separate tool, which supports JavaScript oriented automation testing and good to integrate with jasmine framework rather than to go with Robot Framework. And it needs more java-script programming skills.

On other side, I have question, can't we do same automation testing with integration of Robot Framework and Angular JS lib (https://pypi.python.org/pypi/robotframework-angularjs)?

Will it be feasible to go with above option since RF is having ready well explained reports and have plug-in for CI environment as well, supports many minimum required browsers? 

Are there any hard challenges where it would not allow to automate test case?

Appreciate your inputs on this!

-- Gauravv

Monica Raj

unread,
May 19, 2020, 9:15:26 AM5/19/20
to robotframework-users
Hi All , 

I have read through the discussion here and I have a few questions similar to this 

We have an well developed protractor test suite that automates an angular JS application . We have another application which is a desktop application that communicates to this web application.
We have choosen robotframework with appiumlibrary for this desktop automation

Is there a way that I can integrate the protractor test suite with my robot framework ?

My concern is that we already a working and fully in place protractor test cases which we would like to reuse by integrating the same with robot framework..
Please let me know your thoughts about this.

Tatu Aalto

unread,
May 22, 2020, 1:16:11 AM5/22/20
to monica...@gmail.com, robotframework-users
Hi

It's hard to say what would be best solution (or are any of them good) for your case, but here are some pointers. 
1) Remote library interface
Robot Framework supports other programming language by offering remote library API [1]. It could be possible to call the relevant parts from existing code with Remote library API. There is also remote server for JavaScript [2] available.
2) Using process library
Robot Framework offers Process [3] library which allows you to start processes. Perhaps it's possible to run required parts as command line commands.
3) Something else?
Most likely yes, have you seen AngularJS[4] library?

--
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-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/d5cbab5a-0a98-47f8-ac18-fd0f00d8e573%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages