With test.sh
you can run several integration tests for ObjectBox Swift.
To test the latest version available from Cocoapods, simply run the script without any parameters:
./test.sh
Another typical example to reset all files (the script calls something like git clean -fdx
and git reset --hard
) and specify a particular ObjectBox version to test:
./test.sh --clean -v 1.6.0
If all works out you should see something like this in your Terminal:
** TEST SUCCEEDED **
_
_ // ALL DONE (Thu Feb 25 11:43:58 CET 2021)
\X/
To learn more about the test script, use the --help
parameter, which prints something like this:
$ ./test.sh --help
Usage: test.sh [options] {project-directory}
-v, --version: specify version for the Podfile/Cartfile
-s, --source: specify source repository for the Podfile/Cartfile
-S, --staging: use the staging source repository for the Podfile/Cartfile
-f, --file: only create Podfile/Cartfile
-c, --carthage: use Carthage instead of CocoaPods
--carthage-bin: use the packaged Carthage executable from our bin dir
--clean: cleans all added/modified files to reset the state to a fresh
git checkout. Warning: Data may be LOST!!
Does something like 'git clean -fdx && git reset --hard'
--skip: specify a project to skip
--framework: specify a HTTPS URL to an uploaded framework to be tested
(this creates a local Cartfile pointing to the URL)
The process for each project is like this:
- Plain Xcode project and sources checked in without pods; ensure this "fresh" state when running on the CI machine
- Add ObjectBox pods by running the usual commands as described in the docs (pod init, manual Podfile edits, pod install, setup.rb)
- Build the project and its unit tests and run the latter
This is an example Podfile for a project called "obxtest2":
source 'https://github.com/objectbox/objectbox-swift-spec-staging.git'
# Uncomment the next line to define a global platform for your project
# platform :ios, '11.0'
target 'obxtest2' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for obxtest2
pod 'ObjectBox', '~> 1.5.0'
end
To get to a Podfile like that (and use it) consider this sequence:
- Ensure no pod related files are on the file system (e.g. left-overs from last run)
cd
into the project dir and runpod init
to get an initial Podfile for the given project- Adjust the Podfile
- Insert
source 'https://github.com/objectbox/objectbox-swift-spec-staging.git'
as the first line - Find the line containing
# Pods
and insertpod 'ObjectBox', '~> 1.0.0-rc.3'
after it
- Insert
- Run
Pods/ObjectBox/setup.rb
(still in the project dir) - Now that the pods are prepared for the project, build the project using the Xcode workspace
TODO: add unit tests to the plain Xcode projects and execute them in CI