Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to integrate RED with Robotframework Maven Plugin #20

Closed
MRDcoder opened this issue May 21, 2016 · 17 comments
Closed

How to integrate RED with Robotframework Maven Plugin #20

MRDcoder opened this issue May 21, 2016 · 17 comments
Labels

Comments

@MRDcoder
Copy link

Hi Team,

It’s really nice plug-in for robot framework. I have installed it on eclipse mars and while i tried to open my robot test suite it’s giving below error

(For some issues i am not able to upload image of error, please find text below)

Title: Runtime environment error
Content: unable to provide valid RED runtime environment. Check Python/Robot installation and set in preferences.

I am working on java implementation of robot with robot maven plug-in. Can anyone please help me to resolve this issue?

@MRDcoder
Copy link
Author

Also, i can't execute because no runtime environment is present. Is there any way to do it with maven plugin?

@michalanglart
Copy link
Collaborator

Hi,

It seems that you're seeing this error because RED is not able to locate python installation with RF installation. It is needed for various reasons. Please go to eclipse preferences and then in Robot Framework / Installed frameworks add your local directory where python is installed (or jython)

@MRDcoder
Copy link
Author

Hi @michalanglart
Actually i am using robotframework maven plugin which does not need to install anything extra(python,jython etc) to run robot framework in java. (http://robotframework.org/MavenPlugin/)

Please let me know how i can use RED for it now

@michalanglart
Copy link
Collaborator

Hello,

I didn't understood you correctly in previous comments. I gave it a thought once again, but I don't have good news.

It is currently not possible to make it work without actually having python interpreter installed (I will always refer to language itself when writing "python" and CPython when referring to its standard interpreter) and robot framework installed in it. RED needs that because it starts background server using this interpreter and communicates with this server all the time in order to for example generate libraries specifications. This interpreter can be one of following: CPython, Jython, IronPython or PyPy.

On the other hand this maven plugin downloads a single jar from maven repository which contains both the jython code and RF code, so you don't need to install anything (beside Java to run jython from this jar).

In order to make it possible RED should provide a way to point which jar file contains jython interpreter (it is located in your local maven repository) , but this is not possible at the moment.

We we'll discuss it with team and investigate issue further.

Cheers!

@adam-wypych
Copy link
Contributor

@mhshaikh: Can I ask you simple question: What kind of IDE do You use, when you write RF tests? As far as I know RIDE do not support Maven Plugin itself and I do not see this kind of support in any other RF IDE tool.

Anyway for me introduce Maven Plugin support for RED, will be equal to answer questions:

  1. where libraries are defined and robot version - in red.xml or pom.xml? I do not like personally, if someone required for me to manage configuration in multiple files;
  2. should we override current Maven RF Plugin configuration defined in pom.xml file - since we use listener and SuiteVisitator API to support Run\Debug and Autodiscover libraries - disable this because of user configuration, will be equal to really blind tool; For SuiteVisitator as I see Maven pom parameter even not exists, so we will be need to wrote RF parameter to file and use argumentFile.

As I see main reason for introduce Maven RF Plugin, was to introduce currently exists test cases to Maven build phase, since Authors wrote: it's a non-invasive way of introducing acceptance test driven development to your existing projects quickly.

The issue with pure robotframework*.jar download by Maven is that is not start as Jython or Python interpreter, but as RobotFramework tool with options to run, verify or generate libdoc. Therefore it will be not work with RED. The only possibility to use it is to create some kind of wrapper (currently custom script is not supported) for it with specific name like jython.exe or python.exe - I made such one by using http://launch4j.sourceforge.net/ it works when I set main class as org.python.util.jython.

@MRDcoder
Copy link
Author

Hi @adam-wypych : I am using eclipse as a IDE for RF tests. Yes, RIDE does not support Maven plugin.

  1. I guess it should be on pom.xml because most likely if we are doing it with maven then we will modify pom.xml and won't do anything in red.xml

I really appreciate your efforts to understand my issue. I also agree that we can have some wrapper between Maven jar and RED plugin. But to be frank i don't know how to do it. I will look into link provided by you and help from your side will be appreciated:).

@adam-wypych
Copy link
Contributor

Hi,

@mhshaikh Are You using windows or linux?

@adam-wypych adam-wypych changed the title Runtime environment error on eclipse mars How to integrate RED with Maven Plugin May 23, 2016
@adam-wypych adam-wypych changed the title How to integrate RED with Maven Plugin How to integrate RED with Robotframework Maven Plugin May 23, 2016
@MRDcoder
Copy link
Author

Windows

@adam-wypych
Copy link
Contributor

Ok I will try to prepare simple FAQ with description how to create such wrapper.

@MRDcoder
Copy link
Author

Thank you so much Adam

@adam-wypych
Copy link
Contributor

adam-wypych commented May 23, 2016

  1. Download from https://sourceforge.net/projects/launch4j/files/launch4j-3/3.8/ applicable for Your OS package - I am using launch4j-3.8-win32.zip (it is standalone version, which requires only unzip)
  2. Run launch4j.exe GUI application
  3. In Basic tab set Output file: to be jython.exe application, the location i.e. You desktop directory and switch on Dont't wrap the jar, launch only option.
    1
  4. In Classpath tab switch on Custom classpath and set Main class: to org.python.util.jython. In Edit item: please put robotframework*.jar and press Accept button. Please repeat this still and add also %RF_JAR% variable.
    2
    3
  5. In Header tab just switch Header type from GUI to Console.
    4
  6. In JRE tab please put in Min JRE version value 1.7.0.
    5
  7. After this in main menu please press Build wrapper - this option \ tools icon:
    tool
    . The application will ask you for save configuration, it is required - the name of configuration and place where it will be located is optional.
  8. If everything was done ok you will be able to see in Log text area information about Successfully created file.
    6

The created jython.exe file has to two possibilities to set robotframework*.jar location:

  1. via already set variable %RF_JAR% you can set it in System Variables
  2. using jar located in the same directory where jython.exe file is present

The last test before integration with RED - is to test if executable file was compiled ok and will work, for this I executed in command line set RF_JAR=D:\userdata\wypych\Desktop>set RF_JAR=C:\Users\wypych\.m2\repository\org\robotframework\robotframework\3.0\robotframework-3.0.jar and after jython.exe -m robot.run --version if You will see information like: Robot Framework 3.0 (Jython 2.7.0 on java1.*) it means that You can integrate jython.exe with RED.

After this You can just integrate jython.exe with RED for do this please:

  1. put jython.exe file to bin directory it could be anywhere, but it must be in bin - i.e. I put it in C:\bin\.
  2. I chose option to copy robotframework*.jar to this bin directory instead of set RF_JAR environment variable :)
  3. run eclipse.exe or RED.exe depends on which RED version You are using plugin / product
  4. go to Window -> Preferences -> Robot Framework -> Installed frameworks preference
  5. Click Add... button and select Your bin directory
  6. if everything will be ok, you should see information about Robot Framework *.* version.
  7. when you will create RED project or execute Clean\Build You should see in Robot Standard libraries standard libraries like i.e. BultIn with information about keywords, which they contains.

I hope it helps :)

@adam-wypych
Copy link
Contributor

Hi,

Any feedback?

@MRDcoder
Copy link
Author

I will try and let you know

@MRDcoder
Copy link
Author

Thank you so much @adam-wypych
Its working. I will explore RED more and will get back to this good community in case of any issue.

@adam-wypych
Copy link
Contributor

@mhshaikh: Thanks for feedback :) If is ok for You, I will close this issue and in case of any other problem You can create new ticket.

@MRDcoder
Copy link
Author

yeah sure.

@gpaulissen
Copy link

I did have some difficulties using this approach and so I created another solution. Please have a look at https://github.com/gpaulissen/jython/blob/master/BLOG.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants