Checking Eggplant ready from remote machine

:o
I have been executing Eggplant commands non-interactively with plink through its command-line interface from a remote Windows machine. The purpose of this is to enable Eggplant test scripts to be run from Test Director.

Any users out there using Test Director to drive Eggplant tests?

One of the TD API methods that I am trying to satisfy is called 'is_host_ready' and its purpose in life is to ask a TD remote agent to check that a designated testing host (Eggplant in my case) is available and ready to roll.

I am looking for practical suggestions as to how to flesh out this method. I am not fluent with Unix scripting but if that's the way...

Comments

  • We have a similar issue in our Organization connecting Quality Center to Eggplant . I have used XML RPC quite effectively to solve this problem

    I have not really is implemented the ' is_host_ready ' but the the things to consider here would be
    1) is the Mac you are planning to run the script on reachable . You can try out the VBSscript Socket API to check this
    2) More important than that is there a VNC Server running on the System under test and is that listening at the proper port. You can use eggplant to validate that like this and return the value back to VBScript or even do that from Windows
    ====

    try

    open socket sutIP&":"& sutPort
    catch anException
    -- do processing here to handle the error
    put anException -- shows ?Bad Problem?
    put anException.reason -- shows ?Something went wrong?
    end try
    close socket sutIP&":"& sutPort

    =====

    QC Integration
    1) start the Test run from QC
    2) run All the Tests remotely
    3)Parse the LOg Files and post the results back to QC

    1) Can be achieved from any expect like tool which does telnet to Mac running Eggplant and laiunches Eggplant from Command Line

    3) Here is a script that actually calls a XMLRPC Server running in the Windows m/c to post the results to QC

    =====

    params suiteName , xmlRPCServerIP, xmlRPCServerPort

    (*Main script starts here*)
    put latestSuiteResultPath(suiteName) into pathZipFile

    --answer pathZipFile
    (*Basic Error handling in place*)
    if pathzipFile is null then
    answer "There are no test results for suite " & suiteName title "No Results"
    answer pathZipFile
    exit handler
    end if

    put the folders of pathZipFile into testNames-- get all of the folders there
    repeat with each item of testNames
    put it into testNamet
    put pathZipFile&"/"&it&"/Runhistory.csv" into RunFile
    open file RunFile for reading
    read from file RunFile until return into header-- read one line
    read from file RunFile until return into lastRunDetails
    replace every occurrence of <<">> in lastRunDetails with empty
    put split ( lastRunDetails , "," ) into runStats
    put item 1 of runStats into dateRun
    put item 2 of runStats into runStatus
    put item 3 of runStats into runTime
    put item 4 of runStats into noErrors
    put item 5 of runStats into noWarnings
    put item 6 of runStats into noExceptions
    put item 7 of runStats into logFile
    put item 8 of runStats into returnVal
    put item 9 of runStats into errMessage
    put pathZipFile&"/"&testNamet&"/"&logFile into logFileName
    put file logFileName into logDetails
    replace every occurrence of <<">> in logDetails with empty
    add 1 to counter


    --put " TEST NAME : " & testNamet &" DATE OF RUN : " & dateRun & " RUN TIME : " & runTime & " STATUS : " & runStatus & tab after results
    --put counter & " TEST DETAILS : " & logDetails & newline after results
    put testNamet & ":" & runStatus &","& newline after results

    close file RunFile
    end repeat
    put results into valpass
    answer valpass

    --We need to check whether we can actually reach the server . If not what is the point wasting time
    try

    open socket xmlRPCServerIP&":"& xmlRPCServerPort
    catch anException
    -- do processing here to handle the error
    put anException -- shows ?Bad Problem?
    put anException.reason -- shows ?Something went wrong?
    end try
    close socket xmlRPCServerIP&":"& xmlRPCServerPort

    do applescript merge of {{


    script test
    property mServerAddress : "xmlRPCServerIP"
    property mPort : "xmlRPCServerPort"


    on test()
    using terms from application "http://localhost/&quot;
    tell application ("http://&quot; & mServerAddress & ":"&mPort&"/")
    return call xmlrpc {method name:"test.test"}
    end tell
    end using terms from
    end test

    on postResultstoQC(suiteName , resultStr)
    using terms from application "http://localhost/&quot;
    tell application ("http://&quot; & mServerAddress&":" &mPort&"/")
    return call xmlrpc {method name:"test.postResultstoQC", parameters:{suiteName,resultStr}}
    end tell
    end using terms from
    end postResultstoQC

    end script


    test's postResultstoQC("suiteName","valpass")

    }}


    put the result

    (* Returns the contents of the statistics file for a given suite *)
    function latestSuiteResultPath suite
    put fullSuitePath(suite) into suite -- find it and get its full path
    answer suite
    put suite & "/Results" into resultsFolder

    answer resultsFolder
    return resultsFolder

    end latestSuiteResultPath




    (* Makes sure that we have the full suitePath for a given suite *)
    function fullSuitePath suite
    if suite does not end with ".suite" then put ".suite" after suite -- ensure .suite extension
    if suite does not begin with "/" then -- not absolute path -- need to find it
    put the long name of me into myPath
    delete the last 3 items delimited by "/" of myPath -- get the dir. containing my suite
    put the folders of myPath into suiteNames -- get all of the folders there
    repeat with each item of suiteNames
    if it is suite then
    put myPath & "/" & it into suite
    exit repeat
    end if
    end repeat
    end if
    if there is not a folder suite then throw "Unknown Suite", "Couldn't find suite " & suite
    if suite does not begin with "/" then put the folder & "/" before suite -- want the full path
    return suite
    end fullSuitePath

    ===========

    You have to implement the XMLRPC Server in Windows m/c to do the post .

    Hope that helps ....
Sign In or Register to comment.