How one can change the number of Script Errors

After execution eggplant shows the alert containing number of script errors. How can we change the value of it during execution?

Comments

  • Hi--

    You'll want to use the logerror command:
    if not imagefound("someImage")
        logError "Image did not appear."
    else
        click foundImageLocation()
    end if
    
    Page 131 in the Eggplant Reference section of the help (Help Menu-->Eggplant Help) will give you even more information on how to influence the reports.

    Hope this helps.
  • User1User1 Member
    No I want to change the count of the errors. For Example, I have executed a case which fails due to 2 failures, but after execution eggplant shows an alert (see image)

    Script Error:
    Number of Errors Logged: 2

    which I want to change to the number of cases. (in this case 1 should be displayed).

    Any Idea, how can I do this?
  • User1User1 Member
    Does it possible?
  • User1 wrote:
    No I want to change the count of the errors. For Example, I have executed a case which fails due to 2 failures, but after execution eggplant shows an alert (see image)

    Script Error:
    Number of Errors Logged: 2

    which I want to change to the number of cases. (in this case 1 should be displayed).

    Any Idea, how can I do this?
    Unfortunately, this is an Eggplant dialog that cannot be adjusted. You probably want to use the Answer command. It will allow you to pop your own dialog box and in it you can display whatever you wish. Look for "Answer command" in the SenseTalk Reference section of the Eggplant Help.
  • User1User1 Member
    Thanks for your suggestion. Can I suppress the eggPlant dialog.
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    The error dialog that shows the number of errors will always be displayed at the end of a script run if any LogError commands were executed during that run, and will show the total number of LogErrors that were executed. To keep this dialog from showing, you could implement your own reporting mechanism instead.

    For example, you might use the?LogWarning command instead of LogError. Then at the end of your main script you could get the number of warnings for the current script run using the ScriptResults function like this:
    set warningCount to the warnings of the last item of ScriptResults()
    

    You could then display this warningCount using the Answer command, as Allen suggested:
    Answer "Number of warnings: " & warningCount
    
Sign In or Register to comment.