i have installed scan to automate my testing process. i use the process from below website:http://qualitytesting.tumblr.com/post/141771752059/run-a-subset-of-xctest-tests-with-fastlanescan
I have two project one is ios and another is Osx which runs the ios project.
In the osx project, i init the scan file and there i add the scheme of ios project.
when i run the
scan
command from terminal, it runs the ios project successfully.
But if i use below code:
class func shell(args: String...) -> Int32 {
let task = NSTask()
task.launchPath = "/usr/bin/env"
task.arguments = args
task.currentDirectoryPath = "/Users/username/Desktop/Xocde/mainSwiftAutomation/"
task.launch()
task.waitUntilExit()
return task.terminationStatus
}
and than call the function like:
classname.shell("scan")
it shows the below error:
env: scan: No such file or directory
please help.
Scan will run if you change
to
if your Scan is installed there instead. This was the problem on my machine.
The application is still unable to find xcpretty to generate the report, but my UI tests do run.
If you add the code with the shebang (
#!/usr/bin/env swift
) to a regularrun_tests.swift
file (rather than a Command Line Tool project), then you should be able to run it without problems from the command line:...which is running the tests from Swift code but not through Xcode.
i have solved this like below:
i have create shell script where i use the scan command, than locate the shell script in my project folder and run it using my code.
But there i change my taskpath to
and from command line, go to /usr/local/bin/scan and make it executable like below:
finally i run my shell script and it runs well.