Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIAutomation iPhone: Is it possible to segment the script into several files

I want to write UIAutomation (JavaScript based) tests for a rather complex iPhone App. I dont't want to use one single huge file, but to seperate the testing functions and helpers by using several files. Is that possible at all? How do you structure your UIAutomation tests?

like image 982
Rene Berlin Avatar asked Mar 21 '11 17:03

Rene Berlin


1 Answers

Hey.
Yes it is. Although import keyword is not implemented for JS in browsers, it is implemented in Instruments. You just write #import "somefile.js" in 'master' JS file which you run with Instruments. I haven't tried to include file from locations other than original file you're providing to instruments, but sub folders for that location work.
Look a following example based on this post:

#import "fileInTheSameDirectory.js"
#import "SubDirectory/fileInSubDirectory.js"  
like image 197
yoosiba Avatar answered Sep 28 '22 16:09

yoosiba