[cl-selenium-devel] Optional execution errors.

Robin Lee Powell rlpowell at digitalkingdom.org
Wed Oct 15 02:10:52 UTC 2008


I find it vastly annoying for execution errors to, well, throw
errors, because then my test framework doesn't get to tell me
*where* the error occured.

Arguably a bug in my test framework, but I fixed it in Selenium
anyways, by making an overrideable error routine:

diff -C3 -w -r cl-selenium-0.4-orig/iedoc.lisp cl-selenium-0.4/iedoc.lisp
*** cl-selenium-0.4-orig/iedoc.lisp     2008-10-14 17:27:36.000000000 -0700
--- cl-selenium-0.4/iedoc.lisp  2008-10-14 19:02:47.000000000 -0700
***************
*** 160,166 ****
         (convert-result (subseq reply (min 3 (length reply))) return-type))
        ((starts-with reply "ERROR:")
         (let ((err (second (split-sequence:split-sequence #\: reply))))
!          (error 'execution-error :description err))))))

  (defun convert-function (iedoc-function)
    (let ((function-name (convert-function-name (iedoc-function-name iedoc-function)))
--- 160,167 ----
         (convert-result (subseq reply (min 3 (length reply))) return-type))
        ((starts-with reply "ERROR:")
         (let ((err (second (split-sequence:split-sequence #\: reply))))
!          (funcall *selenium-execution-error-func* :description err)
!        )))))

  (defun convert-function (iedoc-function)
    (let ((function-name (convert-function-name (iedoc-function-name iedoc-function)))
***************
*** 184,186 ****
--- 185,194 ----
    defaults to this special variable.  You can bind a selenium session
    to this variable and use those functions without providing an
    explicit session each time.")
+
+ (defvar *selenium-execution-error-func*
+   (lambda (desc err)
+     (error 'execution-error :description err))
+   "This is the function that is run to create Selenium execution errors.
+   Replace it to get different error handling.")
+

-Robin

-- 
They say:  "The first AIs will be built by the military as weapons."
And I'm thinking:  "Does it even occur to you to try for something
other than the default outcome?" -- http://shorl.com/tydruhedufogre
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/




More information about the cl-selenium-devel mailing list