简体   繁体   中英

Xamarin.UITest AppCenter Cannot find test-cloud.exe

I have created Xamarin.UITest that can run locally on my desktop. My goal is to execute these test as a part of a post-build script to run UITest after the app has built as mentioned in this article below:

https://tomsoderling.github.io/AppCenter-Automated-UI-tests-on-build/

Below is my script

appcenter test run uitest --app "MY-APP" --devices 168683d9 --app-path $APPCENTER_OUTPUT_DIRECTORY/MyApp.Mobile.Droid.apk  --test-series "myapp-mobile-test"  --locale "en_US" --build-dir $APPCENTER_SOURCE_DIRECTORY/MyApp.Mobile.UITests/bin/Release --token MY-TOKEN  --uitest-tools-dir $APPCENTER_SOURCE_DIRECTORY/packages/Xamarin.UITest.*/tools

When the script above is apart of my appcenter post build script, I get the following error: Error: Cannot find test-cloud.exe, the path specified by "--uitest-tools-dir" was not found. Please check that "/Users/vsts/agent/2.141.1/work/1/s/packages/Xamarin.UITest.2.2.6/tools" is a valid directory and contains test-cloud.exe. Minimum required version is "2.2.0".

I think a lot of people are having trouble dealing with this actually and I know it has something to do with --uitest-tools-dir OR --build-dir variables.

Keep in mind this I am first trying to do this with Xamarin.Android, if successful I will try the Xamarin.iOS

One clue i do see is when Tom says "I had to chose to build the app solution file in my App Center CI build - not simply the iOS project like I normally would" in the noted article, but I am not quite sure how to do that or if is connected to why AppCenter cannot locate my test-cloud.exe I will also say that test-cloud.exe somehow comes from the Xamarin.UITest nuget, but I do not see any test-cloud.exe file in my Xamarin.Forms project.

Kudos to AppCenter Agents for helping me to resolve this. 2 things were required as indicated below: Agent Anvesh says Hi there, Thanks for the details, So seems like you are using a nuget as a PackageReference in your project(this means that there will be no package folder in your project, packages will be there at user profile). So when you are trying to run the test as part of the app center build. Then in the shell script used the --uitest-tools-dir value as below /Users/vsts/.nuget/packages/xamarin.uitest/2.2.6/lib/tools

So I modified my above script to add the below: --uitest-tools-dir /Users/vsts/.nuget/packages/xamarin.uitest/2.2.6/tools \\

Agent Shawn says So I added the below msbuild $APPCENTER_SOURCE_DIRECTORY/MyApp.Mobile.UITestProject.csproj

This answer works, but it's pretty fragile.

The test-cloud.exe can't be located at packages/Xamarin.UITest.2.XX/tools in projects that uses the old project structure (projects that use packages.config). For new projects (new .csproj formats), there is no such file in the path of the project. The only way I found to make it work on AppCenter is to use it from the NuGet package cache ( /Users/vsts/.nuget/packages/xamarin.uitest/2.XX )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM