This sounds awesome. If you have time to give detailed feedback, we
could create a Wiki page describing this procedure.
> On my current implementation, so far, I’ve been able to run
> RobotFramework tests against a simple C# Dll, having created a Python
> module that calls that Dll’s methods via the custom keywords.
This is also really cool, and a generic example would be great ;)
It might just be that the subprocess module is not compatible with
IronPython, in which case the rundemo.py should be rewritten for IPY.
If the only thing not working is the PIPE attribute (which is just
used for output redirection), this would be relatively easy task.
>
> I also tried running the demo using pybot (updated to point to
> IronPython files) and the suggested workflow:
> ipy rundemo.py selenium start
> ipy rundemo.py demoapp start
> pybot --variable BROWSER:Firefox --outputdir firefox login_tests
> pybot --variable BROWSER:IE --outputdir ie login_tests
> ipy rundemo.py demoapp stop
> ipy rundemo.py selenium stop
The tasks that fail (selenium start and demoapp start) just start
those applications using Python's subprocess module but you may just
open two separate command prompts for starting the applications.
The command to start Selenium Server would be:
java -jar <Python installation
dir>\site-packages\SeleniumLibrary\lib\selenium-server.jar
The command to start the demo application is:
python <demo-dir>\demoapp\server.py start
Once you have these two commands running, executing the test with your
pybot script (from a third prompt) as you already tried should work.
hth,
__j
First of all thanks for the report on using Robot on IronPython. As
Janne already commented, we are highly interested to hear experiences
about it. Although we cannot put too much resources on the IronPython
support, we try to fix at least the simple problems. On Monday I did,
for example, notice using Unicode didn't work due to an IronPython bug
and already implemented an initial workaround for it (not yet
committed).
2010/11/15 WilliamK <willia...@firsthelpline.com>:
>
> I also tried running the demo using pybot (updated to point to
> IronPython files) and the suggested workflow:
> ipy rundemo.py selenium start
> ipy rundemo.py demoapp start
> pybot --variable BROWSER:Firefox --outputdir firefox login_tests
> pybot --variable BROWSER:IE --outputdir ie login_tests
> ipy rundemo.py demoapp stop
> ipy rundemo.py selenium stop
>
> This resulted in the same error about the pipe attribute. The
> difference is that it went further, proceeding to 'ipy rundemo.py
> demoapp start' and running all the login tests but they all fail with
> a message saying "Could not connect to Selenium Server in 40 seconds.
> Please make sure Selenium Server is running."
Above you try to start up the Selenium Server and the demo application
with IronPython but then run tests using normal Python. You should do
it just the other way round, starting first the Selenium Server and
the demo application with Python:
python rundemo.py selenium start
python rundemo.py demoapp start
Then you should be able to run the tests with:
ipy path/to/robot/runner.py login_tests
Alternatively, you can try to search is it possible to install a fully
working subprocess module for IronPython.
Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org
Could you run the test with `--loglevel debug` so that the traceback
of the failure is also logged?
Btw, yesterday when creating SeleniumLibrary 2.5 release I actually
tested running the demo with IronPython and they run fine. There was
one problem (fixed before the release) but it was in the new code
related to taking screenshots automatically. Perhaps you could also
try installing the new version and see does it work for you.
>> Alternatively, you can try to search is it possible to install a fully
>> working subprocess module for IronPython.
>>
>
> I have. There is this article: http://www.ironpython.info/index.php/Launching_Sub-Processes.
[snip]
> If I run 'ipy rundemo.py login_tests', I get error:
It seems getting subprocess setup with IronPython isn't too easy.
Hopefully a fully working version is included into IronPython in the
future.
> Still in env2, moving on, I can try running the main steps separately
> instead of the top rundemo.py.
> Starting the Selenium server can be done independently calling command
> 'java -jar ...\...\selenium-server.jar' as mentioned by Janne.
Yes, you can start the server also like this.
> But the issue is then starting the demo. I would like to do that with
> IronPython.
> If I try 'ipy server.py start', I get the following:
>
> Demo application starting on port 7272
> Traceback (most recent call last):
> File "server.py", line 81, in <module>
> File "server.py", line 65, in start_server
> File "C:\Program Files\IronPython 2.7\Lib\SocketServer.py", line
> 408, in __init__
> File "C:\Program Files\IronPython 2.7\Lib\BaseHTTPServer.py", line
> 109, in server_bind
> ValueError: IPv4 address 0.0.0.0 and IPv6 address ::0 are unspecified
> addresses that cannot be used
> as a target address.
> Parameter name: hostNameOrAddress
This appears to be an IronPython bug and I reported it [1]. I also
already added a workaround for it into the SeleniumLibrary demo code
[2], and you can do the same simple change into your local version.
[1] http://ironpython.codeplex.com/workitem/29477
[2] http://code.google.com/p/robotframework-seleniumlibrary/source/detail?r=88440f0c8524d4de83a88dc7d05a6e480b34fb0d
> It appears that I would need to find/create an IronPython-specific web
> server solution for the tests if I wanted to go the "start selenium
> server - start demo" route.
> That's what I'm researching at the moment.
Notice that you need this demo server only for the demo itself. You
don't need it if plan to use IronPython/RobotFramework/SeleniumLibrary
combination for testing some real application.
> In the meantime, I welcome any suggestions.
Hope this has helped.
Great!
> [Note: like at work, I had to recreate the expected Python registry
> entries (copied from a Python installation on another machine) but
> pointing to my IronPython installation.
> This is for the cases where I used a windows installer that tries to
> detect a Python installation (e.g SeleniumLibrary installer).]
You could consider installing RF and SeleniumLibrary using the source
distribution. Just open the archives and run `ipy setup.py install
--no-compile` inside them. The `--no-compile` option prevents you from
getting errors when compiling files to bytecode fails -- that's not
fully supported on IronPython -- although those errors wouldn't really
matter.
> Here is a sample processing batch file for the tests:
>
> ----------------------------------------------------------------------
>
> start java -jar "C:\Program Files\IronPython 2.6 for .NET 4.0\Lib\site-
> packages\SeleniumLibrary\lib\selenium-server.jar"
>
> start ipy C:\Robot\demoapp\server.py start
>
> cd C:\Robot\DbTests
> ipy "C:\Program Files\IronPython 2.6 for .NET 4.0\Lib\site-packages
> \robot\runner.py" Database_Access.html
>
> ipy C:\Robot\demoapp\server.py stop
> ----------------------------------------------------------------------
>
> Since runner.py calls pythonpathsetter.py which references the env var
> PYTHONPATH, I've set PYTHONPATH to "C:\Program Files\IronPython 2.6
> for .NET 4.0".
> I will document all this.
Looks good.
> I guess I'll have to check my work machine's environment to figure out
> what could be different from my home machine's.
> In any case, if I keep getting errors, I'll make sure I use --loglevel
> debug for a better output.
Yeah, it would be nice to know why tests fail on that environment.
> Eventually, I will do without server.py.
>
> Question: how do you stop the Selenium server programmatically using a
> java command?
The server can be stopped using the Selenium RC API directly. That's
how `rundemo.py` stops is so `ipy rundemo.py selenium stop` should
actually work. Alternatively you can create a simple Python script
with contents `import SeleniumLibrary;
SeleniumLibrary.shut_down_selenium_server()` or even close the server
with a keyword as part of your test execution.