zalando / SwiftMonkey

A framework for doing randomised UI testing of iOS apps
MIT License
1.95k stars 174 forks source link

How to run test #66

Closed jihun-im closed 6 years ago

jihun-im commented 6 years ago

I am new to iOS. I turned on iOS simulator and xcode. When I tried 'Cmd+U' on the example, Xcode says that Build Succeeded.

What I expected is running monkey test. Could you tell me what am I missing?

image

jihun-im commented 6 years ago

Build failed. image

wojciechczerski commented 6 years ago

Hey @jihunim, it looks like you are using the latest version of SwiftMonkey and Xcode 9 which is not compatible. Either update to Xcode 10 or specify in your Podfile pod 'SwiftMonkey', '2.1.0'. If you want to try out the sample app, after you checked out the source, switch to the 2.1.0 tag, for example:

git checkout tags/2.1.0

Please let me know if that helps.

jihun-im commented 6 years ago

Thank you very much!

jihun-im commented 6 years ago

I updated Xcode to version 10. It worked fine. However, I have trouble using this tool as a framework. As written in README.md, I added SwiftMonkeyPaws and SwiftMonkey. However, build fails. Could you check this?

image image
wojciechczerski commented 6 years ago

Hey there! I see you chose integrating SwiftMonkey without a dependency manager (like CocoaPods) which is slightly more difficult. I'll try however to guide you through the process.

  1. Create an app.

bildschirmfoto 2018-10-15 um 00 04 28

  1. Find SwiftMonkeyPaws.xcodeproj in Finder.

bildschirmfoto 2018-10-15 um 00 04 44

  1. Drag SwiftMonkeyPaws.xcodeproj onto your project in Xcode.

bildschirmfoto 2018-10-15 um 00 04 53

From your screenshots I see that you almost did this except for you didn't drag the xcodeproj file, but instead the folders containing project files.

  1. Go to your target settings -> General -> Embedded Binaries. Press the + button and select SwiftMonkeyPaws from the list.

bildschirmfoto 2018-10-15 um 00 05 58

Done! SwiftMonkeyPaws is now integrated into your app! This is an optional step but I assume you would like to see a visualization of random input generated by SwiftMonkey 😉 Now let's move on to integrate SwiftMonkey into you'r UITests target.

  1. Find SwiftMonkey.xcodeproj in Finder and drag it onto you'r project (just like we did with SwiftMonkeyPaws).

bildschirmfoto 2018-10-15 um 00 07 09

  1. Go to your UI tests target settings -> Build Phases -> Link With Libraries, press the + button and select SwiftMonkey from the list.

bildschirmfoto 2018-10-15 um 00 07 28

  1. In the same view, press the "Add new build phase" button (1) and select "Copy Files". Press the + button (2) and SwiftMonkey.framework to the newly added "Copy Files" phase. Select "Frameworks" as Destination (3).

bildschirmfoto 2018-10-15 um 00 08 32

After all that is done you should have SwiftMonkey integrated successfully. Please let me know whether this helped 😏

jihun-im commented 6 years ago

Thank you for detailed explanation. I will try this and get back to you later. If problem still occurs then I will reopen this. Thank you very much :)

jihun-im commented 6 years ago

I followed your guide and it worked perfectly. (I had to import SwiftMonkeyPaws, create a MonkeyPaws variable and initialize it.)