
| Key: |
SRC-54
|
| Type: |
Improvement
|
| Status: |
Closed
|
| Resolution: |
Fixed
|
| Priority: |
Minor
|
| Assignee: |
Unassigned
|
| Reporter: |
Dimitri Frederickx
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
|
Original Estimate:
|
0.02h
|
Remaining Estimate:
|
0.02h
|
Time Spent:
|
Unknown
|
|
Environment:
|
Not relevant
|
|
|
It should be possible to extend the class DefaultSelenium. This way you can add extra functionality and easily change the baseUrl of where to connect to with the launcher. In the test-program that i'm writing this is necessary and therefore i had to fix this issue. It's just a small fix that doesn't infect the current functionality.
The fix that has to be performed to make the extension possible is making the variables commandProcessor and launcher protected instead of private. This is much cleaner code that addes a lot of possibilities for other programmers.
Index: D:/workspaces/marvin/selenium/java/main/com/thoughtworks/selenium/DefaultSelenium.java
===================================================================
--- D:/workspaces/marvin/selenium/java/main/com/thoughtworks/selenium/DefaultSelenium.java (revision 939)
+++ D:/workspaces/marvin/selenium/java/main/com/thoughtworks/selenium/DefaultSelenium.java (working copy)
@@ -33,8 +33,8 @@
*/
public class DefaultSelenium implements Selenium {
- private CommandProcessor commandProcessor;
- private BrowserLauncher launcher;
+ protected CommandProcessor commandProcessor;
+ protected BrowserLauncher launcher;
public static final String DEFAULT_SELENIUM_CONTEXT = "selenium-driver";
|
|
Description
|
It should be possible to extend the class DefaultSelenium. This way you can add extra functionality and easily change the baseUrl of where to connect to with the launcher. In the test-program that i'm writing this is necessary and therefore i had to fix this issue. It's just a small fix that doesn't infect the current functionality.
The fix that has to be performed to make the extension possible is making the variables commandProcessor and launcher protected instead of private. This is much cleaner code that addes a lot of possibilities for other programmers.
Index: D:/workspaces/marvin/selenium/java/main/com/thoughtworks/selenium/DefaultSelenium.java
===================================================================
--- D:/workspaces/marvin/selenium/java/main/com/thoughtworks/selenium/DefaultSelenium.java (revision 939)
+++ D:/workspaces/marvin/selenium/java/main/com/thoughtworks/selenium/DefaultSelenium.java (working copy)
@@ -33,8 +33,8 @@
*/
public class DefaultSelenium implements Selenium {
- private CommandProcessor commandProcessor;
- private BrowserLauncher launcher;
+ protected CommandProcessor commandProcessor;
+ protected BrowserLauncher launcher;
public static final String DEFAULT_SELENIUM_CONTEXT = "selenium-driver";
|
Show » |
|
I think I nice way to do it could be to let the XML/XSL, that generates Java, generate an AbstractSelenium class. This class would have all the methods generated from javascript and one abstract method "protected CommandProcessor getCommandProcessor()".
A typical generated method would look like this:
public void assertTextPresent(String pattern) {
getCommandProcessor().doCommand("assertTextPresent", new String[] {pattern,});
}
Then we would write the DefaultSelenium class in plain java. The thing I like about this is that all javacode possible (constructors, start and stop) would be outside the XSL, and thus easier to change and patch. I also like to have a getter for the command processor, to be used by my subclasses with new asserts.
Hope you think this is helpful.