Calling Applescript from Eggplant

I want to get the results from an Eggplant Suite that is SuiteStatistics.csv and parse it a bit to get the Name and Status Fields only . Then I want pass this Data to a Windows m/c which has a VBScript to Populate the status of Test Set in Mercury’s Quality Center .

Some Background : We use their Quality Center tool to log our Test Case execution statistics . For Windows Testing we already have QuickTest Pro as a Tool and we are looking at Eggplant ( 4 Licenses have been bought )for non Windows Platforms and Firefox/Windows Combination. Issues are mostly relates to Intergration of Eggplant with QC

I am having this solution :
Have an XMLRPC Server in Windows which triggers the VBscript to Populate Quality Center with the results , and use Applescript to pass the Test Name and Results to it . I am not able to pass parameters from Eggplant script to Applescript

Do you have a more elegant solution . Or at least can you point me where I am wrong in the Call to Applescript
Code is

(*Main script starts here *)
put latestSuiteResults (“RH9Mozilla16”) into resultCSV
(Basic Error handling in place)
if resultCSV is empty then
answer "There are no test results for suite " & suiteName title “No Results”
exit handler
end if

repeat with each line of resultCSV --put the name and status of the Test ONLY
put item 1 to 2 of it & newline after results
end repeat
answer results

do applescript
{{

script test

property mServerAddress : "172.27.96.78"


--
--	Create an AppleScript object that looks as much as possible like the 
--	Exposed class in the Sample XML-RPC Server
--


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


on postResultstoQC([[results]])
	using terms from application "http://localhost/"
		tell application ("http://" & mServerAddress & ":8081/")
			return call xmlrpc {method name:"test.postResultstoQC", parameters:{[[results]]}}
		end tell
	end using terms from
end postResultstoQC

end script

– Figure out which machine we are talking to
set test’s mServerAddress to text returned of ?
(display dialog “Server Address (e.g. qtpvm-pd or 192.27.96.78):” default answer “172.27.96.78”)

– Invoke some methods
{test’s postResultstoQC([[results]])}

}}

(* Returns the contents of the statistics file for a given suite *)
function latestSuiteResults suite
put fullSuitePath(suite) into suite – find it and get its full path
put suite & “/Results” into resultsFolder

put resultsFolder & "/SuiteStatistics.csv" into suiteStatsFile
put file suiteStatsFile into suiteStats
--put lines 2 to last of suiteStats
return lines 2 to last of suiteStats -- Remove first line of headers

end latestSuiteResults

(* Returns the line of the statistics file for a given file within a suite *)
function latestScriptResults suite,script
put fullSuitePath(suite) into suite – find it and get its full path
put suite & “/Results” into resultsFolder

put resultsFolder & "/SuiteStatistics.csv" into suiteStatsFile
put file suiteStatsFile into suiteStats
if script is empty then
	-- no script specified, so return all results for the suite
	return lines 2 to last of suiteStats 
end if

put script into scriptName
if scriptName ends with ".script" then delete last item delimited by "." of scriptName

put empty into scriptStat
repeat with each line of suiteStats
	if item 1 of it is scriptName then
		put it into scriptStat
		exit repeat
	end if
end repeat
if scriptStat is empty then throw "Unknown Script","No results for script " & script & " in suite " & last item delimited by "/" of suite

return scriptStat

end latestScriptResults

(* 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

I think the only problem you have is that instead of

do applescript {{

you need

do applescript merge of {{

You have the merge fields ([[var]]) in your code, but you’re missing the instruction that tells Eggplant to interpret them.

Let us know if you have any other questions.

Regards,
Matt Hicks

cool was able to get that . Thanks