This example is about using FITNesse QueryTable fixture with Selenium. Let's consider next scenario. There is a list of SharePoint sites and an administrator can grant permissions to users for any site in this list. A result of such action is a report that contains list of the users with sites they have permissions for.
The best way to check that the action is competed succefully is to check that given user is presented in this report and has appropriate permissions set. It is very easy to do using the QueryTable fixture.
Just define a class with the query method and a constructor that takes a user name. Pay attention that this QueryTable class should aggregate the Browser class instance to access data on the html page.
But actually here is a problem. An architecture of FITNesse does not allow the PermissionsActionsReport QueryTable class instance to access existed instance of the Browser class that was used to make the action and that contains the result of this action. Fortunately this obstacle can be solved easy using the singleton pattern.
Monday, March 21, 2011
Sunday, March 13, 2011
Using FITNesse and Selenium for acceptance testing, example 1
I have alredy written that Fitnesse+SLIM+Selenium is a pretty powerfull tandem to be used for testing web applications. Also I have a blog post about Selenium 2/WebDriver that is much better for testing web applications than first Selenium. In this and upcoming posts I gonna to share my experience of testing complex use cases in my web application using Fitnesse and WebDriver.
For example, there is a list of the SharePoint Sites. You can use checkboxes and a toolbar to select and execute a set of actions for them. Let's do Copy List: select a site and click the Copy List button. It will araise the Select Lists dialog box.
Here you have to select lists what you want to copy and press the Next button. In the next dialog box it's necessary to select target site. Actually a list of these site can be very long. But there is a search here that allows you to narrow a scope: type a name of site that you want to target and press the Search button. Now find the site in the search result and press copy.
Now wait for operation to be completed.
Actually the scenario forks here. It can be completed successfully or not.
If operation is failed, you will see an error description and can click to the SharePoint log files link to see more details.
Here the fitnesse test that checks this scenario.
And here it's code
As you can see the working element here is the Browser python class
For example, there is a list of the SharePoint Sites. You can use checkboxes and a toolbar to select and execute a set of actions for them. Let's do Copy List: select a site and click the Copy List button. It will araise the Select Lists dialog box.
Here you have to select lists what you want to copy and press the Next button. In the next dialog box it's necessary to select target site. Actually a list of these site can be very long. But there is a search here that allows you to narrow a scope: type a name of site that you want to target and press the Search button. Now find the site in the search result and press copy.
Now wait for operation to be completed.
Actually the scenario forks here. It can be completed successfully or not.
If operation is failed, you will see an error description and can click to the SharePoint log files link to see more details.
Here the fitnesse test that checks this scenario.
And here it's code
As you can see the working element here is the Browser python class
Subscribe to:
Posts (Atom)