问题
Is it possible to send an html email report through a monkey talk automation tool. If it is possible please provide any code or url.
Thanks, Ramakrishna.
回答1:
Use a CI (continuous Integration tool) with monkeytalk.
like jenkins+monkeytalk it is bit hard to configure it. but it can be done. use jenkins to automate the process of checkout code from repository and write a shell script to build the project and runtest cases with monkeytalk. after finish tests jenkins will email the reports to the given recipients.
jenkins: http://jenkins-ci.org/
More details...
first of all you need to download and deploy Jenkins. Downloadlink
to deploy in terminal
$ java -jar jenkins.war
open a browser http://localhost:8080
will take you to Jenkins dash board.
There is link for Jenkins settings on left side menu: from that page you can set an email account , password for Jenkins. and then provide recipient email addresses. so if a build faild Jenkins will email all console errors to the recipents. (try reading Jenkins documentation if it hard to install)
Then create a new job giving a name and details . add your repository URL and type add user credientials to it. and configure the rest in the end of the page you can give a build command as a shell script or ant file or there are many options. then save the job and edit configurations start a build if it not checkout your code from repo and build correctly copy the errors from error console and search in google.
here is a sample code for build a Xcode project to a simulator
echo "Build Start"
/usr/bin/xcodebuild -target FuncTest CODE_SIGN_IDENTITY="iPhone Distribution: Leapset Inc." PROVISIONING_PROFILE="xxxxxxxx-1216-4E86-97D5-xxxxxxxxxxxx" OTHER_LDFLAGS="-lxml2 -all_load -lstdc++" DSTROOT="build" VALID_ARCHS="armv7 armv7s i386" -arch i386 -sdk iphonesimulator6.0 -configuration Release clean build install;
echo "Build End"
if you need to open iPhone simulator with the app use
# open app in simulator
echo "Start run app in simulator"
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication release-1.081/Leapset/build/Release-iphonesimulator/LeapsetFuncTest.app/FuncTest & disown;
echo "DONE run app in simulator"
run tests
echo "start run Test jobs"
######### Job 1 #########
echo
echo "TEST: SignInOut.mts"
echo "DISCRIPTION: sign in and out with user credintials"
#java -jar $$ROOTPATH/monkeytalk/LeapsetTest/libs/monkeytalk-runner-1.0.43.jar -agent IOS $ROOTPATH/monkeytalk/LeapsetTest/signinUser.mt
java -jar monkeytalk/LeapsetTest/libs/monkeytalk-runner-1.0.43.jar -agent IOS monkeytalk/LeapsetTest/SignInOut.mts
and monkey talk will generate reports. only thing you need to find is some way to attach those html reports to the Jenkins There are so many plugging available for Jenkins.
above commodes are working fine but you need to give the corrects paths to work it. like for above build command Note: this command should run in terminal inside the project root directory(where the Xcode project file is)
Good luck :)
xocdebuild command help
xcodebuild
[-project <projectname>]
[[-target <targetname>]...|-alltargets]
[-configuration <configurationname>]
[-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]]
[-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild
[-project <projectname>] -scheme <schemeName>
[-configuration <configurationname>]
[-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]]
[-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild
-workspace <workspacename> -scheme <schemeName>
[-configuration <configurationname>]
[-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]]
[-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild -version [-sdk [<sdkfullpath>|<sdkname>] [<infoitem>] ]
xcodebuild -list [[-project <projectname>]|[-workspace <workspacename>]]
xcodebuild -showsdks
来源:https://stackoverflow.com/questions/15675014/send-an-email-using-monkey-talk-automation-tool