Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to run with BrowserStack account in VS2022 #18

Open
JYouren opened this issue Nov 15, 2024 · 5 comments
Open

Fails to run with BrowserStack account in VS2022 #18

JYouren opened this issue Nov 15, 2024 · 5 comments

Comments

@JYouren
Copy link

JYouren commented Nov 15, 2024

Following the instructions here, or the same ones at https://app-automate.browserstack.com/dashboard/v2/quick-start/get-started#run-a-sample-build result in the following error when attempting to run the tests.

git clone https://github.com/browserstack/nunit-appium-app-browserstack.git
cd nunit-appium-app-browserstack
cd android
change the username/password in browserstack.yml
dotnet build
dotnet test --filter "Category=sample-test"

Build started at 08:51...
1>------ Build started: Project: android, Configuration: Debug Any CPU ------
1>The template "Dotnet local tool manifest file" was created successfully.
1>
1>You can invoke the tool from this directory using the following commands: 'dotnet tool run browserstack-sdk' or 'dotnet browserstack-sdk'.
1>Tool 'browserstack-sdk' (version '1.16.4') was successfully installed. Entry is added to the manifest file C:\Source\nunit2\android.config\dotnet-tools.json.
1>2024-11-15 08:51:48.5241|INFO|browserstack_sdk.utils|Using dotnet: C:\Program Files\dotnet\dotnet.exe
1>2024-11-15 08:51:50.4863|INFO|browserstack_sdk.Program|Detected Selenium version 3.141.0
1>2024-11-15 08:51:50.4863|INFO|browserstack_sdk.Program|Detected Appium version 4.4.0
1>2024-11-15 08:51:50.4863|INFO|browserstack_sdk.Program|Running for f/w nunit 3.13.3
1>2024-11-15 08:51:50.6247|INFO|browserstack_sdk.Program|Detected dotnet version 8.0.404
1>2024-11-15 08:51:50.8712|INFO|browserstack_sdk.utils|Using existing app id bs://417c29b9234c10bb5a652167a5d5ac789fc67163 for hash : bf26007ec897ff6d7b9971fa053e2274.
1>2024-11-15 08:51:50.8712|INFO|browserstack_sdk.Configuration|Using App : bs://417c29b9234c10bb5a652167a5d5ac789fc67163.
1>2024-11-15 08:51:50.8712|INFO|browserstack_sdk.Program|SetupObservability: No test Assembly found in environment, returning
1>2024-11-15 08:51:50.8982|ERROR|browserstack_sdk.Program|Uncaught exception occured: System.IndexOutOfRangeException: Index was outside the bounds of the array.
1> at browserstack_sdk.Program.Main(String[] args)
1>C:\Users\User\.nuget\packages\browserstack.testadapter\0.3.1\build\BrowserStack.TestAdapter.targets(9,5): error MSB3073: The command "dotnet browserstack-sdk --add-patch-bstack obj\Debug\net6.0\ C:\Source\nunit2\android\bin\Debug\net6.0\android.dll" exited with code 1.
1>Done building project "android.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 08:51 and took 05.094 seconds ==========

@AnushyaSelvan
Copy link

Can you please provide the dotnet version and the details regarding the system configuration(windows or mac)?

@JYouren
Copy link
Author

JYouren commented Nov 15, 2024

.Net 8.0.404
Windows 11 x64

@JYouren
Copy link
Author

JYouren commented Nov 15, 2024

In the .csproj file I had to change

to

for it to build successfully.

@JYouren
Copy link
Author

JYouren commented Nov 15, 2024

Then when I run

dotnet test --filter "Category=sample-test"

I get

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Failed searchWikipedia
Error Message:

12.0

OpenQA.Selenium.WebDriverException : [BROWSERSTACK_INVALID_APP_URL] The app_url/ custom_id/ shareable_id specified in the 'app' capability in your test script is invalid. Please update the 'app' capability with a valid value and try again. Refer to this document to reset the app capabilities : https://www.browserstack.com/docs/app-automate/appium/set-up-tests/specify-app#BrowserStack_SDK
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.

11.0

OpenQA.Selenium.WebDriverException : [BROWSERSTACK_INVALID_APP_URL] The app_url/ custom_id/ shareable_id specified in the 'app' capability in your test script is invalid. Please update the 'app' capability with a valid value and try again. Refer to this document to reset the app capabilities : https://www.browserstack.com/docs/app-automate/appium/set-up-tests/specify-app#BrowserStack_SDK
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.

12.0

OpenQA.Selenium.WebDriverException : [BROWSERSTACK_INVALID_APP_URL] The app_url/ custom_id/ shareable_id specified in the 'app' capability in your test script is invalid. Please update the 'app' capability with a valid value and try again. Refer to this document to reset the app capabilities : https://www.browserstack.com/docs/app-automate/appium/set-up-tests/specify-app#BrowserStack_SDK
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.

Stack Trace:

12.0

at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Appium.AppiumDriver1.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(RemoteWebDriver this, ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) at OpenQA.Selenium.Appium.AppiumDriver1..ctor(ICommandExecutor commandExecutor, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.AppiumDriver1..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout) at OpenQA.Selenium.Appium.AppiumDriver1..ctor(Uri remoteAddress, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.Android.AndroidDriver`1..ctor(Uri remoteAddress, DriverOptions driverOptions)
at BrowserStack.BrowserStackNUnitTest.Init() in C:\Source\nunit2\android\BrowserStackNUnitTest.cs:line 27
--TearDown
at BrowserStack.BrowserStackNUnitTest.Cleanup() in C:\Source\nunit2\android\BrowserStackNUnitTest.cs:line 33

11.0

at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Appium.AppiumDriver1.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(RemoteWebDriver this, ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) at OpenQA.Selenium.Appium.AppiumDriver1..ctor(ICommandExecutor commandExecutor, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.AppiumDriver1..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout) at OpenQA.Selenium.Appium.AppiumDriver1..ctor(Uri remoteAddress, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.Android.AndroidDriver`1..ctor(Uri remoteAddress, DriverOptions driverOptions)
at BrowserStack.BrowserStackNUnitTest.Init() in C:\Source\nunit2\android\BrowserStackNUnitTest.cs:line 27
--TearDown
at BrowserStack.BrowserStackNUnitTest.Cleanup() in C:\Source\nunit2\android\BrowserStackNUnitTest.cs:line 33

12.0

at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Appium.AppiumDriver1.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(RemoteWebDriver this, ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) at OpenQA.Selenium.Appium.AppiumDriver1..ctor(ICommandExecutor commandExecutor, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.AppiumDriver1..ctor(Uri remoteAddress, ICapabilities appiumOptions, TimeSpan commandTimeout) at OpenQA.Selenium.Appium.AppiumDriver1..ctor(Uri remoteAddress, ICapabilities appiumOptions)
at OpenQA.Selenium.Appium.Android.AndroidDriver`1..ctor(Uri remoteAddress, DriverOptions driverOptions)
at BrowserStack.BrowserStackNUnitTest.Init() in C:\Source\nunit2\android\BrowserStackNUnitTest.cs:line 27
--TearDown
at BrowserStack.BrowserStackNUnitTest.Cleanup() in C:\Source\nunit2\android\BrowserStackNUnitTest.cs:line 33

Failed! - Failed: 1, Passed: 0, Skipped: 0, Total: 1, Duration: < 1 ms - android.dll (net8.0)

@JYouren
Copy link
Author

JYouren commented Nov 15, 2024

So if I go to https://app-automate.browserstack.com/dashboard/v2/quick-start/get-started, upload the WikipediaSample.apk file manually, and replace

app: ./WikipediaSample.apk

with

app: bs://........

in the browserstack.yml file I get a successful test! 😩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants