XCode Test Automation For IPhone

后端 未结 8 771
隐瞒了意图╮
隐瞒了意图╮ 2020-12-23 15:16

I would like to have my iphone test app to be tested automatically in an IPhone. The following are the steps I would like to have:

  1. compile, link and code sign
相关标签:
8条回答
  • 2020-12-23 15:38

    The comment section does not provide a good way of display the solution properly. Here is the summary of answer.

    The task of building IPhone app, uploading and trigger the debug process on IPhone is done via AppleScript. Here is how the AppleScript looks like:

    tell application "Xcode"
        open "Users:chuan:Desktop:iphone_manual_client:iphone_manual_client.xcodeproj"
        tell project "iphone_manual_client"
            clean
            build
            (* for some reasons, debug will hang even the debug process has completed. 
               The try block is created to suppress the AppleEvent timeout error 
             *)
            try
                debug
            end try
        end tell
        quit
    end tell
    

    AppleScript accepts ":" instead of "/" for file and folder separator.

    The GDB console output can be captured by setting the GDB option to write it to file. this is done by typing the following command in Terminal:

    defaults write com.apple.Xcode PBXGDBDebuggerLogToFile YES 
    defaults write com.apple.Xcode PBXGDBDebuggerLogFileName <path to my gdb output file>
    

    Lastly, many thanks to various ppl who have helped to solve this problem.

    0 讨论(0)
  • 2020-12-23 15:39

    xcodebuild will just build the binary and it will not upload the newly compiled binary to iphone.

    actually it can upload (after signing it), but not run too bad... maybe it can be run using gdb once connected to target but how (ip?, usb? usbnet?) ?

    0 讨论(0)
  • 2020-12-23 15:43

    There's a command line tool "xcodebuild" you can call to kick off an XCode build without it being open. There are flags you can use to set targets and so on.

    0 讨论(0)
  • 2020-12-23 15:43

    Could you add a build phase to the target that runs a script to upload the binary to the iphone?

    Right click the target, Add->New Build Phase->New Run Script Build Phase

    0 讨论(0)
  • 2020-12-23 15:55

    Dr Nic's testing with Ruby may help with some of this

    0 讨论(0)
  • 2020-12-23 15:57

    Check out iphone_testify, it works well with OCUnit and Google Toolbox For Mac, and I think it could be possible extend it for something like UISpec.

    Regards

    0 讨论(0)
提交回复
热议问题