• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [Wonder-disc] ERSelenium without ERExtensions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Wonder-disc] ERSelenium without ERExtensions


  • Subject: Re: [Wonder-disc] ERSelenium without ERExtensions
  • From: Chuck Hill <email@hidden>
  • Date: Tue, 26 Jun 2007 10:31:42 -0700

Hi Michael,

Right, we were supposed to discuss this when I returned from WWDC. I am still working through a page of "to do" tasks that I accumulated that week.

On Jun 26, 2007, at 2:38 AM, Michael Bushkov wrote:

Chuck, I've got several questions:
- How do you prepare a test suite?

I am not certain what you are asking. I use the Selenium IDE to create the individual test cases. I create the suite by hand, in an HTML editor, so that I can control the order of the tests and add HTML comments on what is happening and why. I maintain this externally to the project in a directory that looks like this:


Project/
	Code/
		WOApp/
		WOFramework1/
		WOFramework2/
	Testing/
		selenium/
			Suites/
				TestCases/
			TestData/

One of my goals is to _not_ be the person who writes and maintains the functional tests. Because of this, it is important to keep the tests separate from the applications and frameworks that it tests.



- What format do you use to store the selenium-tests?

Selenese (HTML). Again, this supports test creation and maintenance by non-developers. The people doing the test creation and maintenance do need some technical ability, but not to the extent of knowing Java or XPath.



- Will open/click commands in your test work ok if you run them on the host with different WO base URL - for example if you switch from "http://localhost/cgi-bin/WebObjects"; to "http://somehost/";?

Here is what I do. There are very few references to the URL. I leave it as localhost for development as that is more convenient when testing locally. For integration testing, I use Selenium RC (remote control) from an Ant script. Before launching the suite, the Ant script does a search and replace on the host and application names. As I said earlier, that is only in a few places (like the log in test case as the start of a string of tests cases).


Most of the tests don't refer to the URL. Instead, I make extensive use of HTML ID attributes. So a test for login would look like:

<tr>
	<td>type</td>
	<td>userName</td>
	<td>chill2</td>
</tr>
<tr>
	<td>type</td>
	<td>password</td>
	<td>chill2</td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>loginButton</td>
	<td></td>
</tr>

The use of IDs serves two purposes. One, it isolates the tests from changes to the host, application name, etc. Two, it makes the tests easier to read and understand. Again, this supports my goal of having functional (domain) experts write and maintain the functional tests. This is supported by a Selenium locator ordering that gives a higher priority to the ID than to XPath etc.

Anjo points out that the use of ID is a Bad Idea (tm). Anjo, of course, is dead wrong in this. :-) Anjo's objection was that ID has to be unique in a page. This is true. For items in repetitions, I append an index to the ID. For example, instead of id = "view", it is rendered as id = "view.1"; or id = "view.row.1"; This does require some code in the component that uses the repetition, but I do not object to that as it supports my goal of readable tests. There is probably a way to do this automatically; so far it has not seemed worth the effort.

Another potential problem area is components that are used multiple times on a page. Consider a text input that wraps up a WOTextField, a required marker, and a validation message. The WOD of page using this might look like:

FirstName: TextInputWithValidation {
	value = firstName;
}

LastName: TextInputWithValidation {
	value = lastName;
}


Obviously, if I implement TextInputWithValidation with a WOTextField like this:


Text: WOTextField {
	value = ^value;
	id = "text";
}

the ID will get duplicated and bad things will happen. Instead, I put the ID up a level:


FirstName: TextInputWithValidation { value = firstName; id = "FirstName"; }

LastName: TextInputWithValidation {
	value = lastName;
	id = "LastName";
}

Text: WOTextField {
	value = ^value;
	id = ^id;
}

This has the advantage of being more readable as well as eliminating the duplicate ID problem. Passing the ID down has avoided the problem of duplicate IDs for me so far. Sometimes you need to do a bit more work and concatenate the ID from multiple levels, but I have not run into a situation where it required much work or thought to come up with a unique ID that was also sensible to someone reading the test.



ERSelenium's idea is to facilitate a lot of common tasks that are usually solved manually to organize Selenium testing. Among these tasks are:
- Automatic test suites generation from your folder structure.

I am curious as to what you are doing for this. To me, Selenium tests are for functional testing and so have no relation at all to project structure.




- Writing tests in the preferred format - wiki/html.

Is that different from Selenese?


- Unified format of setup/tear down methods with appropriate error messages.

I don't see the need for these. For me, the Selenium tests should be from the point of view of the user of the application. So any setup / tear down outside of loading the bootstrap data should be done through the UI and be part of the test. In some rare occasions (mimicking interactions from other systems), I do need some setup that is not possible from the UI. In that case, I create a direct action to do this and call it from the test in a new window. The direct action is only enabled during testing runs.




- Ability to write simple relative URLs to avoid problems with host base url.

I solve that problem by using IDs.


You always can use Selenium without ERSelenium framework, but It surely won't save your time and will force you to do a lot of work (that can be done automatically by ERSelenium) manually.

I am not so convinced of that, but my goals may not be your goals. If you think that ERSelenium will benefit me, please convince me!



Chuck




Chuck Hill wrote:
Do you even need the framework? FWIW, I use Selenium, but have no Selenium specific code. I do have Selenium core installed.
In my DocumentRoot, I have
selenium-core -> /Developer/Applications/Tools/Selenium/selenium-core
(not sure if that is used for this or not...)
To run the tests I have a bookmark like this:
chrome://selenium-ide/content/selenium/TestRunner.html? test=file:/// path/to/Testing/selenium/Suites/ TestSuite.html&baseURL=http:// localhost/&auto=true
My app starts right on http://localhost/, you may need a different URL.
Start the app, hit the bookmark, and the suite runs.
Chuck
On Jun 25, 2007, at 1:36 PM, Guido Neitzer wrote:
Hi.

I'm currently looking at ERSelenium because we might want to use it
in our projects and I wonder whether we should make it not depend on
ERExtensions.

We have one project where we'd like to use it, that can't be easily
converted to Wonder, so I looked into it and saw that it mainly
relies on convenient stuff (ERXProperties, ERXFileUtilities,
ERXStatelessComponent, ERXFrameworkPrincipal) and log4j. It should be
possible to make a self contained framework by reverting the logging
stuff back to NSLog, and pulling the needed stuff into the framework
or use WebObjects classes for it.


I'd rather not create our own copy of the framework because of
further development and with the changes more people could use it on
more projects.

What do you think about that? Objections?

Denis, what do you think?

cug

-------------------------------------------------------------------- -- ---
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wonder-disc mailing list
email@hidden
https://lists.sourceforge.net/lists/listinfo/wonder-disc



-- With best regards, Michael Bushkov Southern Federal University


--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: [Wonder-disc] ERSelenium without ERExtensions
      • From: Steven Mark McCraw <email@hidden>
  • Prev by Date: run errors
  • Next by Date: Support blog set up for tutorial
  • Previous by thread: Re: run errors
  • Next by thread: Re: [Wonder-disc] ERSelenium without ERExtensions
  • Index(es):
    • Date
    • Thread