Closed Trilokesh closed 12 years ago
There are two ways to configure:
CreateIosDevice
and CreateIosApplication
) built into Victor, orIf you're already able to run tests, then you likely know how to construct some of the pieces.
Here is a sample test project that uses the factory classes to configure everything: https://github.com/dhemery/vigor
That project includes a base class that all test classes extend: http://bit.ly/L10KO4
In that class, the startApplicationInDevice()
method launches the app in the simulator. It uses Victor's CreateIosDevice
and CreateIosApplication
classes to configure everything. Those factory classes provide reasonable default values for all of Victor's configuration properties. The factory classes peek into your Info.plist to guess the best device type and SDK to launch.
I'll describe the factory classes on the wiki eventually (maybe next week).
With the factory classes, there's a good chance that the only thing you have to supply is a value for the victor.application.bundle.path
configuration option. I usually do that via property files, which I read into a Configuration object (see lines 21 and 28 of the test base class I liked to above).
Line 33 waits for the Frank server to respond to a request. It uses a fancy little polling library that I wrote called polling-kit. You don't have to use polling-kit, but you will likely need some way of polling until Frank responds.
If you need more control than the factory classes offer, you can wire up all of the pieces yourself. See the Configure Victor page on the wiki for details. You may also want to read through the Victor Architecture page to see how all of the pieces fit together.
Closing this issue as a duplicate of issue 3: https://github.com/dhemery/victor/issues/3
I hope to complete this next week.
Hi Dale,
Thanks a lot for the response and the details. I followed your examples and details code and tried to run. But I was getting the following exception in the "OSCommand.java" file.(com.dhemery.victor.os) java.io.IOException: Cannot run program "plutil": CreateProcess error=2, The system cannot find the file specified
What Steps I followed? Firstly, I import all the required packages(com.dhemery.configuration/device/discovery), and jars (polling-kit, etc.). Then I put the following line of code in my base class @BeforeTest public void waitForFrank() throws IOException, PollTimeoutException{ System.out.println("In waitForFrank"); VigorTest.startApplicationInDevice(); }
[I have copied the VigorTest class as shown in the below url].
Additional info: ios.selector.engine=shelley_compat victor.application.bundle.path = IOSApp copy.app [have changed the app name] ios.simulator.path=/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app
It would be very helpful if you can guide me in resolving this issue.
Thanks and Regards, Trilokesh
On Fri, Jun 1, 2012 at 11:37 AM, Dale Emery < reply@reply.github.com
wrote:
There are two ways to configure:
- You can use the two "factory" classes (
CreateIosDevice
andCreateIosApplication
) built into Victor, or- You can construct all of the pieces yourself.
If you're already able to run tests, then you likely know how to construct some of the pieces.
Here is a sample test project that uses the factory classes to configure everything: https://github.com/dhemery/vigor
That project includes a base class that all test classes extend: http://bit.ly/L10KO4
In that class, the
startApplicationInDevice()
method launches the app in the simulator. It uses Victor'sCreateIosDevice
andCreateIosApplication
classes to configure everything. Those factory classes provide reasonable default values for all of Victor's configuration properties. The factory classes peek into your Info.plist to guess the best device type and SDK to launch.I'll describe the factory classes on the wiki eventually (maybe next week).
With the factory classes, there's a good chance that the only thing you have to supply is a value for the
victor.application.bundle.path
configuration option. I usually do that via property files, which I read into a Configuration object (see lines 21 and 28 of the test base class I liked to above).Line 33 waits for the Frank server to respond to a request. It uses a fancy little polling library that I wrote called polling-kit. You don't have to use polling-kit, but you will likely need some way of polling until Frank responds.
If you need more control than the factory classes offer, you can wire up all of the pieces yourself. See the Configure Victor page on the wiki for details. You may also want to read through the Victor Architecture page to see how all of the pieces fit together.
Reply to this email directly or view it on GitHub: https://github.com/dhemery/victor/issues/10#issuecomment-6054004
Ah, you've discovered a dependency that I mistakenly assumed would always be satisfied.
The CreateIosDevice
class uses a Mac command line tool called plutil
to read the app's Info.plist to discover information that it needs in order to launch the app (e.g. what iOS SDK version, the name of the app executable, the default device type to simulate).
So you will need to make sure plutil
is in the PATH environment variable when your tests run.
Try running which plutil
on the command line. If that displays a file path, then plutil
is in the path. If plutil
is already in your path, let me know. If that's the case, I'm not sure why Victor can't run it.
On my computers, plutil is here:
/usr/bin/plutil
So if /usr/bin
is in the path, Victor will find it.
FYI, Victor uses another command line tool to locate the simulator app. Victor looks for the simulator in a fixed place inside the current "platform path". To find the platform path, it runs this command:
xcodebuild -sdk iphonesimulator -version PlatformPath
So xcodebuild
must also be in the path. If you run command yourself, and the output is /Developer/Platforms/iPhoneSimulator.platform
, then Victor will use the simulator you mentioned.
Hi Dale,
Thank again. Your response helped me to move forward. Looks like I am very close, but having a issue with application Binary. When I execute i get exception in the below method as Application binary is not executable - private String applicationBinaryPath() { String applicationBinary = applicationBundle.pathToExecutable(); if(applicationBundle.isExecutable()) { return applicationBinary; } throw new IosDeviceConfigurationException("Application binary is not executable: " + applicationBinary); }
looks like my application.bundle path is improper. Simulator path:/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator.
I witnessed that in the info.plist of the frankified App the Key CFBundleExecutable has the value "${EXECUTABLE_NAME}".
Is this causing the issue. Also in mac where do i get the .app of the frankified target.
I tried the following as application bundle, but that also did not helped
much -
/Users/admin/Library/Developer/Xcode/DerivedData/TaxOnlineMobile-fzwdnbbhgxgrticsmgkwcvcxwfdz/Build/Products/Release-iphonesimulator/
Any suggestions to try out.
*when I tried the following command from Terminal, it only brings the Simulator successfully..
Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\
Simulator.app/Contents/MacOS/iPhone\ Simulator launch
/Users/admin/Perforce/
Thanks and Regards, Trilokesh
* On Thu, Jun 7, 2012 at 2:00 AM, Dale Emery < reply@reply.github.com
wrote:
Ah, you've discovered a dependency that I mistakenly assumed would always be satisfied.
The
CreateIosDevice
class uses a Mac command line tool calledplutil
to read the app's Info.plist to discover information that it needs in order to launch the app (e.g. what iOS SDK version, the name of the app executable, the default device type to simulate).So you will need to make sure
plutil
is in the PATH environment variable when your tests run.Try running
which plutil
on the command line. If that displays a file path, thenplutil
is in the path. Ifplutil
is already in your path, let me know. If that's the case, I'm not sure why Victor can't run it.On my computers, plutil is here:
/usr/bin/plutil
So if
/usr/bin
is in the path, Victor will find it.FYI, Victor uses another command line tool to locate the simulator app. Victor looks for the simulator in a fixed place inside the current "platform path". To find the platform path, it runs this command:
xcodebuild -sdk iphonesimulator -version PlatformPath
So
xcodebuild
must also be in the path. If you run command yourself, and the output is/Developer/Platforms/iPhoneSimulator.platform
, then Victor will use the simulator you mentioned.
Reply to this email directly or view it on GitHub: https://github.com/dhemery/victor/issues/10#issuecomment-6161844
Hi Trilokesh,
Thank again. Your response helped me to move forward. Looks like I am very close, but having a issue with application Binary. When I execute i get exception in the below method as Application binary is not executable - private String applicationBinaryPath() { String applicationBinary = applicationBundle.pathToExecutable(); if(applicationBundle.isExecutable()) { return applicationBinary; } throw new IosDeviceConfigurationException("Application binary is not executable: " + applicationBinary); }
looks like my application.bundle path is improper.
Yes, that's likely the problem.
Simulator path:/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator.
Don't worry about the simulator path. Victor knows how to find that.
I witnessed that in the info.plist of the frankified App the KeyCFBundleExecutable has the value "${EXECUTABLE_NAME}".
That's how it looks in the source code. When you build the app, Xcode fills that in with the file name. So if you see "${EXECUTABLE_NAME}, you're probably looking at the source file instead of the file inside the built application
Also in mac where do i get the .app of the frankified target.
In Xcode:
I tried the following as application bundle, but that also did not helped much - /Users/admin/Library/Developer/Xcode/DerivedData/TaxOnlineMobile-fzwdnbbhgxgrticsmgkwcvcxwfdz/Build/Products/Release-iphonesimulator/
.app
That looks like a typical application bundle path. That .app "file" is a bundle. It looks like a file in Finder, but it's actually a directory. Here are some things to check:
open Info.plist
on the command line. That will open the file in Xcode and show you all of its keys and values.ls -g
and observe whether that file's x
flag is set.If the bundle has an Info.plist, and the Info.plist identifies a CFBundleExecutable, and the named file exists and is executable, Victor should be able to find and launch it.
*when I tried the following command from Terminal, it only brings the Simulator successfully..
Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator launch /Users/admin/Perforce/
/projects/ /source/ .app
Instead of launch
, try -SimulateApplication
.
Also, when you launch the simulator on the command line, you have to specify the full path to the executable inside the .app bundle.
Finally, the /source/
in your command line makes me wonder what that's pointing to. I suspect it's not a valid iOS application bundle, but I don't have enough information to know for sure.
Dale
Hi Dale,
Bingo.
I use the following as the victor.application.bundle.path and it worked.
/Users/admin/Library/Developer/Xcode/DerivedData/odhjkksiwpodjiasl-fzwdnbbhgxgrticsmgkwcvcxwfdz/Build/Products/Release-iphonesimulator/
Thanks for your detailed explanation. It really helped it getting into the result.
N.B. Now I am running Victor tests in Mac. I know i can execute the tests from the windows (I did earlier, except the launching the part of app in the simulator). While running the victor tests from a windows machine can we launch simulator and the app as I just did now. Any thoughts.
Thanks again.
Regards, Trilokesh
I'm glad you got your tests running.
I have a backog item (https://github.com/dhemery/victor/issues/2) to allow Victor to launch a simulator on another computer. I don't know when I will implement that.
Several months ago Victor briefly included the ability to launch, interact with, and stop a simulator on a remote Mac. That required keeping a "simulator server" running on the remote Mac. Then the tests would launch a "remote simulator" that would interact with the simulator server on the remote Mac.
That feature seemed to work, but I never tested it thoroughly. When I rewrote Victor a few months ago I disabled that code. You can see some of the classes still in the Victor source code, but they are incomplete.
As I said, I don't know when I will implement that feature. You can register for notifications by clicking the "Enable notifications for this Issue" link at the bottom of the issue page.
Thanks again.
On Mon, Jun 11, 2012 at 12:43 AM, Dale Emery < reply@reply.github.com
wrote:
I'm glad you got your tests running.
I have a backog item (https://github.com/dhemery/victor/issues/2) to allow Victor to launch a simulator on another computer. I don't know when I will implement that.
Several months ago Victor briefly included the ability to launch, interact with, and stop a simulator on a remote Mac. That required keeping a "simulator server" running on the remote Mac. Then the tests would launch a "remote simulator" that would interact with the simulator server on the remote Mac.
That feature seemed to work, but I never tested it thoroughly. When I rewrote Victor a few months ago I disabled that code. You can see some of the classes still in the Victor source code, but they are incomplete.
As I said, I don't know when I will implement that feature. You can register for notifications by clicking the "Enable notifications for this Issue" link at the bottom of the issue page.
Reply to this email directly or view it on GitHub: https://github.com/dhemery/victor/issues/10#issuecomment-6230993
Hi Dale,
Is there a way we can run our ios-automation test (developed using Victor) against the Real Device. If so can you please tell how to proceed.
Thanks and Regards, Trilookesh
Yes. If you use the CreateIosDevice and CreateIosApplication classes to configure Victor, you can run against the device by adjusting two properties:
victor.frank.host: <your device's IP address> victor.simulator.process.owner: other
That second property tells Victor not to launch or shut down a simulator. Victor does not know how to install or launch an app on a device, so you will have to install the app and launch it before running the tests.
Hi Dale,
Thanks for your response. I am having some build issue, so yet to test as yo have mentioned.
In between, can you suggest a automation tool / driver for android app automation.
Thanks and Regards, Trilokesh
On Tue, Jul 10, 2012 at 11:30 PM, Dale Emery < reply@reply.github.com
wrote:
Yes. If you use the CreateIosDevice and CreateIosApplication classes to configure Victor, you can run against the device by adjusting two properties:
victor.frank.host: <your device's IP address> victor.simulator.process.owner: other
That second property tells Victor not to launch or shut down a simulator. Victor does not know how to install or launch an app on a device, so you will have to install the app and launch it before running the tests.
Reply to this email directly or view it on GitHub: https://github.com/dhemery/victor/issues/10#issuecomment-6883590
I don't know anything about Android. Sorry.
hi Dale,
I am using Victor to automate an iOS app. It is a great tool as I can still design my automation suite in java. I have automated couple of tests, and I execute them from my windows. Before start of the execution I launch simulator and the app by clicking "Run" button on the Xcode. When app launch completed in the simulator then I triggered the test suite.
But now I am trying to execute test suite without any manual intervention (as I am now doing at the start of execution to launch simulator and the app by clicking 'Run' button in the Xcoce).
Could you please help me using victor how do i launch the simulator and and the frankified app.
Thanks in anticipation. Trilokesh