Blog

Get your webtests in FitNesse with Xebium

01 Jun, 2011

In the first installment on Xebium, Cirilo explained the ideas behind this FitNesse fixture:


Xebium creates a simple way to use Selenium IDE (low learning curve) and FitNesse (ease of maintenance) to it’s fullest when it comes to maintaining a web application test suites.

Xebium is using the same keywords as Selenium IDE. This has the huge advantage that no person should learn another DSL. Since tests are stated this way, they can be copied between Selenium IDE and FitNesse without a hassle (the FitNesse formatter for Selenium IDE is rather trivial). And to be honest: as long as there are XPath and Regular Expressions in the code, it makes no sense to come up with a substitute for verifyText.

Copy test output directly in SeIDE
So now it is possible to move our Selenium IDE test case in a FitNesse page. Nice. It’s easier to set up tests, since FitNesse is quite flexible in that. On the other hand, just playing back you recorded tests is not the most flexible way to work. There can be a huge maintenance burden on this. It would be a shame not to use the full power of FitNesse in this case. Scenario tables for example can make a nice abstraction where some common action, like logging in, only have to be defined (and maintained) in one place. By moving the login code out of the test and into a scenario, we add another level of indirection. The tests themselves become more readable, as they only state the business requirement and the low level details are directly editable by the tester. This is a lot more flexible than creating Selenium fixtures for every scenario.

| log in user | user | with password | password |
| open | http://example.com/login |
| type | name-field | @user |
| type | password-field | @password |
| click | login |

and in your tests, instead of repeating the above, just mention:

| script |
| log in user | john | with password | secret |
| ensure | do | verifyText | on | #userid | with | John |

Sure, we’re back at creating our own DSL, but we do it 100% in FitNesse. Selenium commands can be added where needed (e.g. assertions). No Java (fixture) code, no developers required to change one line because the templates have changed and, foremost, detailed feedback.
But FitNesse can help out even more. Consider data driven testing. Selenium has (by default) no option for that. Using the same scenario table fixture it’s easy to test logins for a bunch of users.
But we claimed you can copy stuff from FitNesse to Selenium IDE as well and that’s getting harder when you move everything inro scenarios. To overcome this issue the formatter in Selenium IDE can parse tab separated data as well. So after a test has run, the output as provided by FitNesse can be copied back. This is a useful aid for analyzing failed tests.
Copy tests from SeIDE to FitNesse
I tend to make my Xebium commands easely available. First of all the fixture needs to be imported. After that the fixture can be assigned as library:

| import |
| com.xebia.incubator.xebium |
| library |
| selenium driver fixture |

A note for Windows users, though. When performing a lot of tests, Windows tends to run out of sockets. There is a way to configure your machine to work around those silly limitations (at your own risk!).

guest
16 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Stewart
Stewart
10 years ago

Hi There,
A point to out for is that if you have a ‘|’ in some text, such as in the page title, this needs to be converted to wiki syntax ‘!-|-!’ in order for FitNesse not to interpret it as a table column separator.
It would be a really nice touch if the Xebium formatter plugin for Selenium IDE did this automatically.
See this URL for more info: http://old.nabble.com/escape-|-%28vertical-bar%29-in-fitnesse-wiki-td22298159.html
Thanks!

Stewart
Stewart
10 years ago

Hi Again,
Is the syntax purely limited to what Selenium IDE can provide?
I’ve been using this reference: http://seleniumhq.org/docs/02_selenium_ide.html
Two areas I’ve been having trouble with, in the context of testing a webapp is not vulnerable to XSS, is (1) verifying javascript alerts, (2) verifying an absence of somthing, perhaps something like | ensure | not | verifyText | on | #userid | with | John |
Do you have any tips for this situation?
Regards,
Stewart
PS. Is there a good Xebium forum to use, for this kind of stuff?

Arjan Molenaar
10 years ago

Hi,
You’re right, all commands that are available in Selenium IDE can be executed by Xebium.
Regarding your question, you can so something like
| reject | do | verifyText | on |#userid | with | John |
(instead of ensure, use reject). This does not translate back as well when copying tests from FitNesse to SeleniumIDE, but it’s the easiest way.
Regards,
Arjan

Jan Helwich
Jan Helwich
10 years ago
Reply to  Arjan Molenaar

Hi!
We are having troubles getting the copying back working. It doesn’t work on Win and Linux as well and also not with the examples given in the template.
Any idea why? Any trick to use or thing we must do?
Thanks and best regards
Jan

Stewart
Stewart
10 years ago
Reply to  Arjan Molenaar

That’s excellent. I can test XSS vulnerability with | reject | do | verifyElementPresent | on | //div[@id=’id’]/ul/li/script | to make sure that a tag has not been rendered, but escaped.

Rajendra
Rajendra
10 years ago

Hi,
Is there any way to record and run the double click functionality using Xebium? Please share it.
As our project requirement is to have a test script for double click functionality, which cannot be achieved using Xebium. But Selenium supports the double click functionality.
Thanks in Advance,
Waiting for your reply,
Rajendra

Rajendra
Rajendra
10 years ago

HI,
I could not execute the double click functionality using Xebium test scripts.
Can anybody help me out?
Thanks in advance,
Rajendra

Phalguni
Phalguni
9 years ago

How can we handle double click in xebium.

Rahul
Rahul
9 years ago

Hi,
Is there a forum to post issues such as installation issues for Xebium? I can’t seem to find such a thing. I am having trouble running the mvn -Pfitnesse test command, for installation. Any advice would be appreciated on places to go for help.
Thanks,
Rahul

Karanbir
Karanbir
9 years ago

Hi,
I am new to xebium and need help to figure out , How to compare 2 values in Xebium.
Thanks in advance
Regards
Karan

Guillermo Schwarz
Guillermo Schwarz
8 years ago

“A note for Windows users, though. When performing a lot of tests, Windows tends to run out of sockets. There is a way to configure your machine to work around those silly limitations (at your own risk!).”
That’s a clear symptom that Xebium has resource leaks.

abhishek koulgi
abhishek koulgi
5 years ago

Hi,
I am new to xebium and i copied exported the test case from selenuim to fitnesse as required but i am getting” Could not invoke constructor for SeleniumDriverFixture[0]” and “The instance scriptTableActor.doOn. does not exist” after i tried to run simple test from the link:https://blogs.infosupport.com/my-first-xebium-fitnesse-selenium-test/,please help me in this .do I need to add some libraries or set particular path?
thank you

Edirley
2 years ago

Hi friends,
My name is Edirley and I’m Brazilian. I need a help friends.
I need to copy/save a SQL query result for one variable or parameter in FitNesse, and after to use this value in my test.One example showing what I want:Step flow:
Select number_order from orders
where item = ‘00001’
Where I want to save:
!define number_order_save (number_order)
Where I want to use:
”’Write Order Number”’
!| VerifyTextPresent | Number Order|
| Enter | ${number_order_save} |I hope that you can help me friends.

Explore related posts