Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn off automatic screenshots on UI Testing (Xcode)

I am running Xcode's UI Testing through Jenkins. Screenshots are taken at each step and so after running the suite for a while, the Mac uses up all its hard drive space. Does anyone know if you can switch off Xcode UI Testing's automatic screenshots, so less space is used?

like image 636
Charlie Seligman Avatar asked Feb 29 '16 11:02

Charlie Seligman


3 Answers

Another way of doing this is configuring your Xcode Scheme to not take screenshots, by doing the following in Xcode:

  1. Edit Scheme (Cmd+Shift+<)
  2. Click on Test configuration on left side
  3. Click Options on top
  4. Uncheck "Capture screenshots automatically". Alternatively you can keep this checked but also check "Delete when each test succeeds" if you just want screenshots for failures.

Xcode Edit Scheme

like image 134
Liron Yahdav Avatar answered Nov 01 '22 02:11

Liron Yahdav


I'm not sure how to turn off screen shots but you could put the screen shots to a location where they'd be deleted:

xcodebuild -workspace App.xcworkspace \
   -scheme "SchemeName" \
       -sdk iphonesimulator \
       -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.0'
       -derivedDataPath '/dev/null'
       test

Note the -derivedDataPath '/dev/null' which is where the screen shots will be going. This will put the screen shots to the null device, which is a special device which discards the information written to it.

Hope that helps, happy testing!

like image 39
cakes88 Avatar answered Nov 01 '22 02:11

cakes88


I didnt find a reliable way to deactivate screenshots, but the size taken up by them was removed by setting the following in jenkins:

Jenkins > Open Job > Configure > Build > Xcode > Advanced build settings > tick the box labelled 'Clean test reports'

This now keeps the test results in a far more manageable size and means I can constantly keep my test suites running in jenkins.

Hope this helps someone else.

like image 2
Charlie Seligman Avatar answered Nov 01 '22 02:11

Charlie Seligman