[prev in list] [next in list] [prev in thread] [next in thread] 

List:       selenium-commits
Subject:    [Selenium-commits] [JIRA] Commented: (SEL-174) Driven mode logging
From:       "Nelson Sproul (JIRA)" <jira () public ! thoughtworks ! org>
Date:       2005-12-22 21:57:00
Message-ID: 104240896.1135288620002.JavaMail.oqa-j2ee () openqa01 ! managed ! contegix ! com
[Download RAW message or body]

    [ http://jira.openqa.org/browse/SEL-174?page=comments#action_12581 ] 

Nelson Sproul commented on SEL-174:
-----------------------------------

I have coded a change to support logging in Java driven mode.  I changed setContext \
to optionally take a parameter giving the desired log level ("error", "warning", \
"info" or "debug").

Here are the diffs (which assume the prior application of other changes Dan Fabulich \
and I have done which haven't yet been accepted into selenium; I think it would be \
more clear if I could attach these modules in their entirety -- is there a way to do \
this?):

diff -r -b $OLD/shared/p4/Tools/selenium/java/integration-test/com/thoughtworks/selenium/embedded/jetty/RealDealIntegrationTest.java \
/home/nelsons/shared/p4/Tools/selenium/java/integration-test/com/thoughtworks/selenium/embedded/jetty/RealDealIntegrationTest.java
 73c73,74
<         selenium.setContext("A real test, using the real Selenium on the browser \
                side served by Jetty, driven from Java");
---
> selenium.setContext("A real test, using the real Selenium on the browser side \
> served by Jetty, driven from Java", SeleniumLogLevels.DEBUG);
89a91,92
> selenium.setContext("A real negative test, using the real Selenium on the browser \
> side served by Jetty, driven from Java", SeleniumLogLevels.DEBUG);
diff -r -b $OLD/shared/p4/Tools/selenium/java/main/com/thoughtworks/selenium/DefaultSelenium.java \
/home/nelsons/shared/p4/Tools/selenium/java/main/com/thoughtworks/selenium/DefaultSelenium.java
 35a36
> private String logLevel = null;
279c281,285
<         String result = commandProcessor.doCommand("context", context, "");
---
> setContext(context, "");   
> }
> 
> public void setContext(String context, String logLevel) {
> String result = commandProcessor.doCommand("context", context, logLevel);
330c336,338
< 
---
> public String getLogLevel() {
> return logLevel;
> }
diff -r -b $OLD/shared/p4/Tools/selenium/java/main/com/thoughtworks/selenium/Selenium.java \
/home/nelsons/shared/p4/Tools/selenium/java/main/com/thoughtworks/selenium/Selenium.java
 57a58
> void setContext(String context, String logLevel);


Only in /home/nelsons/shared/p4/Tools/selenium/java/main/com/thoughtworks/selenium/SeleniumLogLevels.java:


	package com.thoughtworks.selenium;
	
	public class SeleniumLogLevels {
		public static final String DEBUG = "debug";
		public static final String INFO = "info";
		public static final String WARN = "warn";
		public static final String ERROR = "error";
	}
	
diff -r -b $OLD/shared/p4/Tools/selenium/javascript/selenium-api.js \
/home/nelsons/shared/p4/Tools/selenium/javascript/selenium-api.js 479c479,480
< Selenium.prototype.doContext = function(context) {
---
> Selenium.prototype.doContext = function(context, logLevelThreshold) {
> if  (logLevelThreshold==null || logLevelThreshold=="") {
480a482,483
> }
> return this.page().setContext(context, logLevelThreshold);
diff -r -b $OLD/shared/p4/Tools/selenium/javascript/selenium-browserbot.js \
/home/nelsons/shared/p4/Tools/selenium/javascript/selenium-browserbot.js 911c911
< PageBot.prototype.setContext = function(strContext) {
---
> PageBot.prototype.setContext = function(strContext, logLevel) {
913a914,916
> if (logLevel!=null) {
> 	LOG.setLogLevelThreshold(logLevel); 
> }
diff -r -b $OLD/shared/p4/Tools/selenium/javascript/selenium-logging.js \
/home/nelsons/shared/p4/Tools/selenium/javascript/selenium-logging.js 21a22,32
> setLogLevelThreshold: function(logLevel) {
> 	this.pendingLogLevelThreshold = logLevel;
> this.show();
> //
> // The following message does not show up in the log -- _unless_ I step along w/ \
> the debugger // down to the append call.  I believe this is because the new log \
> window has not yet loaded, // and therefore the log msg is discarded; but if I step \
> through the debugger, this changes // the scheduling so as to load that window and \
> make it ready. // this.info("Log level programmatically set to " + logLevel + " \
> (presumably by driven-mode test code)"); },
> 
25a37,45
> if (this.logWindow && this.pendingLogLevelThreshold && \
> this.logWindow.setThresholdLevel) { \
> this.logWindow.setThresholdLevel(this.pendingLogLevelThreshold); 
> // can't just directly log because that action would loop back to this code \
> infinitely this.pendingInfoMessage = "Log level programmatically set to " + \
> this.pendingLogLevelThreshold + " (presumably by driven-mode test code)"; 
> this.pendingLogLevelThreshold = null;	// let's only go this way one time
> }
> 
46a67,70
> 	if (this.pendingInfoMessage) {
> 		    logWindow.append(this.pendingInfoMessage, "info");
> this.pendingInfoMessage = null;
> }
diff -r -b $OLD/shared/p4/Tools/selenium/javascript/SeleniumLog.html \
/home/nelsons/shared/p4/Tools/selenium/javascript/SeleniumLog.html 18a19,20
> var logLevelThreshold = null;
> 
27a30,42
> function setThresholdLevel(logLevel) {
> logLevelThreshold = logLevel;
> var buttons = document.getElementById('logLevelChooser').level;
> for (var i = 0; i < buttons.length; i++) {
> 	if (buttons[i].value==logLevel) {
> buttons[i].checked = true;
> }
> else {
> buttons[i].checked = false;
> }
> }
> }
> 
29c44,47
<     if (logLevels[logLevel] < logLevels[getThresholdLevel()]) {
---
> if (logLevelThreshold==null) {
> 	logLevelThreshold = getThresholdLevel();
> }
> if (logLevels[logLevel] < logLevels[logLevelThreshold]) {


> Driven mode logging doesn't work
> --------------------------------
> 
> Key: SEL-174
> URL: http://jira.openqa.org/browse/SEL-174
> Project: Selenium
> Type: Bug
> Components: SeleneseRunner, Drivers - Ruby, Drivers - Plone, Drivers - .Net, \
>                 Drivers - Java
> Versions: 0.6
> Environment: IE6 with Java Driver 0.6.0 on Windows 2003
> Reporter: Dan Fabulich

> 
> 
> Normally Selenium logging is done by having the user manually open the logging \
> window in the browser prior to launching the tests.  But in driven mode, the \
> browser automatically starts running tests immediately upon startup; there's no \
> time to click on the "Show Log" button to get the logs. If you add a direct call to \
> LOG.show() in the onload handler for SeleneseRunner.html, the log will open, but \
> then the WindowsIEBrowserLauncher will be unable to close all browser windows at \
> shutdown time.  This will cause the RealDealIntegrationTest to fail.  (It looks \
> like possibly another caching problem...?) The SeleneseRunner needs to not use a \
> separate window; it should use an iframe instead.  Furthermore, it needs to be \
> possible to use query arguments to set the logging level from the driver side, so \
> that logging can occur automatically.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.openqa.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

_______________________________________________
Selenium-commits mailing list
Selenium-commits@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic