BrowserStack - Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure - jenkins

In my local Jenkins Docker container, I could run my test plan without any issues .
Even without giving
However, in my office Jenkins server, I setup with that as per the https://www.browserstack.com/docs/automate/selenium/jenkins#configuring-browserstack-credentials
Yet I get this error.
org.openqa.selenium.remote.UnreachableBrowserException:
Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'hidden', ip: 'hidden', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.15.2.el7.x86_64', java.version: '1.8.0_201'
Driver info: driver.version: RemoteWebDriver
at com.sam.browserstack.BrowserStackInitiation.setUp(BrowserStackInitiation.java:78)
Caused by: java.net.SocketTimeoutException: connect timed out
at com.sam.browserstack.BrowserStackInitiation.setUp(BrowserStackInitiation.java:78)
My build command is as per below.
export M2_HOME=/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven3
export PATH=$PATH:$M2_HOME/bin
mvn --version
cd CommonPagesStorage
mvn clean install -DskipTests
cd ..
cd AutomationFrameworkDemo
mvn clean test -Dbrowser="${Browser}" -Dbrowser_version="${browser_version}" -Dos_version="10" -Dos="Windows" -Dlocalrun="false" -Dtestxml=src/test/TestSuites/${TestPlanName}
I also tried adding below code as exports but no avail.
export http_proxy="http://proxy-dev.can.myorg.com:8080"
export https_proxy="http://proxy-dev.can.myorg.com:8080"
export NO_PROXY=123.345.145.345,.can.myorg.com,localhost,200.0.0.2

I got the url whitelisted from netwrok team, also below lines of code were needed too.
https://username:password#hub-cloud.browserstack.com/wd/hub
(Since I use free style project, to get M2_HOME, I created a maven project with just mvn --version as a shell command and got the value from output console)
export M2_HOME=/opt/software/apache-maven-3.6.3
export PATH=$PATH:$M2_HOME/bin
export http_proxy="http://proxy-dev.aws.skynet.com:8080"
export https_proxy="http://proxy-dev.aws.skynet.com:8080"
export NO_PROXY=777.777.777.777,.aws.skynet.com,localhost,127.0.0.1
mvn --version
cd CommonPagesStorage
mvn clean install -DskipTests
cd ..
cd AutomationFrameworkDemo
mvn clean test -Dhttp.proxyHost=proxy-dev.aws.skynet.com -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxy-dev.aws.skynet.com -Dhttps.proxyPort=8080 -Dbrowser="${Browser}" -Dbrowser_version="${browser_version}" -Dos_version="10" -Dos="Windows" -Dlocalrun="false" -Dtestxml=src/test/TestSuites/${TestPlanName}

Related

Unable to see appium-webdriveragent folder when install Appium 2.0

I have installed Appium 2.0 using command line but unable to see the appium-webdriveragent folder under /usr/local/lib/node_modules/appium/node_modules/ path (no folder found which is starts with appium).
Theses are the following commands I ran:
npm install -g appium#next
brew install Carthage
npm install -g appium-doctor
appium --base-path /wd/hub
appium driver install xcuitest
appium plugin install images
appium plugin install execute-driver
appium plugin install relaxed-caps
This is the appium version:
~ % appium -v
2.0.0-beta.46
This is the driver installed location:
~ % npm ls -g appium-webdriveragent
/usr/local/lib
└── (empty)
I am using Xcode:
Version 14.1 (14B47b)
This is the execution failure log:
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
xcodebuild error message:
. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
Host info: host: 'L0057s-MacBook-Pro.local', ip: 'fe80:0:0:0:1863:fbc8:e2f5:1313%en0'
Build info: version: '4.5.0', revision: 'fe167b119a'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '12.5.1', java.version: '18.0.1.1'
Driver info: io.appium.java_client.AppiumDriver
Command: [null, newSession {capabilities=[{appium:appName=XXXX APP, appium:automationName=XCUITest, browserName=, appium:deviceName=iPhone 6s, appium:newCommandTimeout=60, platformName=IOS, appium:platformVersion=15.7.1, appium:udid=0ee9ce6c7e262203d06348ed55de4e747cfaab75, appium:usePrebuiltWDA=true}], desiredCapabilities=Capabilities {appName: XXXX APP, automationName: XCUITest, browserName: , deviceName: iPhone 6s, newCommandTimeout: 60, platformName: IOS, platformVersion: 15.7.1, udid: XXXXXXXX1234..., usePrebuiltWDA: true}}]
Capabilities {}
have followed https://github.com/appium/appium
You could try this fix.
For me it didn't work and I had to go back to xcode 13.4.1 to have it working again...
I tried as well with Appium2 (2.0.0-beta.46) but, unfortunately, I had to go back to 1.22.3 and downgraded Xcode from 14.1 to 13.4.1
Try installing XCUITest via:
appium driver install xcuitest or appium driver update xcuitest
appium-webdriveragent folder is available in user's home directory as .appium or can be located via
echo "$(dirname "$(find "$HOME/.appium" -name WebDriverAgent.xcodeproj)")"

How do you debug a Bazel sandboxing failure?

Repo with full code example.
When I try to run a test with Bazel involving the tree-sitter binary, I get an Operation not permitted error without any further information.
❯ bazel test --test_output=errors --verbose_failures --sandbox_debug //tree-sitter-nbts:check-generated
INFO: Analyzed target //tree-sitter-nbts:check-generated (0 packages loaded, 0 targets configured).
INFO: Found 1 test target...
FAIL: //tree-sitter-nbts:check-generated (see /private/var/tmp/_bazel_varun/e55142ab9bc72292b8c54fb9627025eb/execroot/__main__/bazel-out/darwin_arm64-fastbuild/testlogs/tree-sitter-nbts/check-generated/test.log)
INFO: From Testing //tree-sitter-nbts:check-generated:
==================== Test output for //tree-sitter-nbts:check-generated:
++ dirname /private/var/tmp/_bazel_varun/e55142ab9bc72292b8c54fb9627025eb/sandbox/darwin-sandbox/17/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/tree-sitter-nbts/check-generated.runfiles/__main__/tree-sitter-nbts/check-generated
+ cd /private/var/tmp/_bazel_varun/e55142ab9bc72292b8c54fb9627025eb/sandbox/darwin-sandbox/17/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/tree-sitter-nbts/check-generated.runfiles/__main__/tree-sitter-nbts
+ git init -b main
Initialized empty Git repository in /private/var/tmp/_bazel_varun/e55142ab9bc72292b8c54fb9627025eb/sandbox/darwin-sandbox/17/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/tree-sitter-nbts/check-generated.runfiles/__main__/tree-sitter-nbts/.git/
+ git add .
+ GIT_AUTHOR_EMAIL=_
+ GIT_AUTHOR_NAME=_
+ GIT_COMMITTER_EMAIL=_
+ GIT_COMMITTER_NAME=_
+ git commit -m 'Initial commit'
[main (root-commit) 1f79ef2] Initial commit
11 files changed, 11 insertions(+)
create mode 120000 Cargo.lock
create mode 120000 Cargo.toml
create mode 120000 bindings/rust/build.rs
create mode 120000 bindings/rust/lib.rs
create mode 120000 check-generated
create mode 120000 check-generated.sh
create mode 120000 grammar.js
create mode 120000 src/grammar.json
create mode 120000 src/node-types.json
create mode 120000 src/parser.c
create mode 120000 src/tree_sitter/parser.h
+ tree-sitter generate
Operation not permitted (os error 1)
================================================================================
Target //tree-sitter-nbts:check-generated up-to-date:
bazel-bin/tree-sitter-nbts/check-generated
INFO: Elapsed time: 0.220s, Critical Path: 0.11s
INFO: 2 processes: 2 darwin-sandbox.
INFO: Build completed, 1 test FAILED, 2 total actions
//tree-sitter-nbts:check-generated FAILED in 0.1s
/private/var/tmp/_bazel_varun/e55142ab9bc72292b8c54fb9627025eb/execroot/__main__/bazel-out/darwin_arm64-fastbuild/testlogs/tree-sitter-nbts/check-generated/test.log
INFO: Build completed, 1 test FAILED, 2 total actions
What is a good way of debugging this? So far, I know the following:
Running tree-sitter generate directly in the source tree works fine.
The bazel test command works fine with --spawn_strategy=standalone, which I think confirms that this is a sandboxing issue.
The bazel test command works fine inside the Nix environment (see the linked repo). This one is a little weird, not sure what's going on here.
Configuration information:
macOS 12.4 on an M1 Mac
Bazel v5.2.0 (both in Nix and outside)
tree-sitter v0.20.6 (both in Nix and outside) (I tried using the Nix-installed binary with Bazel and that didn't seem to make any difference)
OpenJDK v11.0.15 in the global environment vs OpenJDK v11.0.11 in Nix.
GitHub issues which seem related:
ln call fails with "operation not permitted" during bazel test - This comment mentions there is no command printed with --verbose_failures --sandbox_debug.
Strange "Operation not permitted" problem for test program accessing files in the sand box on MacOS

sonar-project.properties doesnt seem to be picked up when trying to Run SonarScanner from the Docker image

I have been trying to do the "Running SonarScanner from the Docker image" from the documentation"
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.6.0.2311
INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
INFO: Linux 5.10.25-linuxkit amd64
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 8.8.0
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=63ms
INFO: Server id: BF41A1F2-AXkMJHXiUF2U87mzcajk
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=35ms
INFO: Load/download plugins (done) | time=1086ms
INFO: Process project properties
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2.438s
INFO: Final Memory: 5M/20M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: You must define the following mandatory properties for 'Unknown': sonar.projectKey
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
my guess is that the sonar-project.properties are not being picked up and I don't understand why not
docker run \
--rm \
--network=host \
-e SONAR_HOST_URL="http://127.0.0.1:9000/" \
-e SONAR_LOGIN="*token*" \
-v $(pwd)/idevops-crmservice:/root/src \
sonarsource/sonar-scanner-cli
when I try to searching for this issue, all I really get is to use
sonar-runner -Dsonar.projectKey=
but that does not help me since I need the sonar-project.properties to be picked up
im wanting to scan an entire folder and unsure on what to do.
I also have same problem. and the solution is either dont run it on docker.. or create a new docker myself. the docker image on its documentation doesnt provide any argument other than the sample that was given.

how to include sonar scanner in a docker image

I have a dotnet image that is used as an agent for the Jenkins pipeline. Now I want to include sonar scanner in the image so that I can run an analysis and see if the coverage is good. If the coverage is not good then the build should fail. How to include the sonar scanner in my image.
I tried including the skilldlabs/sonar-scanner in my Dockerfile of the dotnet image. but when I run the container it directly executed the sonar cube commands and failed as the default sonarqube address is used.
Below is my current Dockerfile
FROM microsoft/dotnet:2.1-sdk
FROM skilldlabs/sonar-scanner:3.3
COPY some-ca.crt /usr/local/share/ca-certificates
COPY NuGet.Config /build/.nuget/NuGet/
VOLUME [ "/build/sources" ]
WORKDIR /build/sources
When I ran :
docker run --name sonar -it sonar
INFO: Scanner configuration file: /root/sonar-scanner-3.3.0.1492-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 3.3.0.1492
INFO: Java 1.8.0_191 Oracle Corporation (64-bit)
INFO: Linux 4.9.125-linuxkit amd64
INFO: User cache: /root/.sonar/cache
ERROR: SonarQube server [http://sonarqube:9000] can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 5.433s
INFO: Final Memory: 3M/39M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to execute SonarQube
ERROR: Caused by: Fail to get bootstrap index from server
ERROR: Caused by: sonarqube: Try again
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug
logging.
How can I tell the container to provide the config for the sonar-scanner?
Instead of using the sonar scanner image into my image, I have installed dotnet-sonarscanner using the below command,
dotnet tool install -g dotnet-sonarscanner
I had to install a "coverlet" package to my unit test project by adding the below to my .csproj file of the unit test project.
<PackageReference Include="coverlet.msbuild" Version="2.6.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Now, whenever I want to send sonarqube my coverage results I run below command to generate the coverage file.
dotnet test ./UnitTests/UnitTests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
The above command will generate the coverage.opencover.xml file in the project folder.
Now use below commands to send the coverage
dotnet sonarscanner begin /k:"yourprojectkey" /d:sonar.host.url=https://yoursonarqubedomain.com /d:sonar.cs.opencover.reportsPaths="./UnitTests/coverage.opencover.xml" /d:sonar.coverage.exclusions="**Tests*.cs"
dotnet build
dotnet sonarscanner end
you can set the sonarscanner properties like report location and the URL etc., using /d:

Load test run in Jenkins with Jmeter does not end

I'm trying to run load tests on Jenkins through Jmeter (with Blazemeter). I've installed:
Install Jenkins on a machine that you have access to
Install the Jenkins Performance Plugin on the machine with Jenkins
Install Taurus on the Jenkins machine
Install Apache JMeter™ on our local machine
The only file that initially exists in the project folder is the blazedemo_script. jmx script generated in Jmeter and that works perfectly in this software.
The execution never ends. And I also don't understand why you can't find the modified file it generates if you enter it in the same directory.
Thank you very much.
I get the following log:
Lanzada por el usuario e73dbef17ee24d5c96bb99b8c598de0c
Ejecutando.en el espacio de trabajo C:\Program Files (x86)\Jenkins\workspace\blazermeter
[WARNING] Performance test: Job workspace contains spaces in path. Virtualenv does not support such path. Creating temporary workspace for virtualenv.
Performance test: Checking global bzt installation...
[blazermeter] $ bzt --help
Performance test: Found global bzt installation.
Performance test: run [bzt, blazedemo_script.jmx, C:\Program Files (x86)\Jenkins\workspace\blazermeter\jenkins-report.yml]
[blazermeter] $ bzt blazedemo_script.jmx "C:\Program Files (x86)\Jenkins\workspace\blazermeter\jenkins-report.yml"
13:24:19 INFO: Taurus CLI Tool v1.10.5
13:24:19 INFO: Starting with configs: ['C:\\Program Files (x86)\\Jenkins\\workspace\\blazermeter\\jenkins-report.yml', 'c:\\windows\\temp\\jmx_52sdqz.json']
13:24:19 INFO: Configuring...
13:24:19 INFO: Artifacts dir: C:\Program Files (x86)\Jenkins\workspace\blazermeter\2018-02-20_13-24-19.717000
13:24:19 INFO: Preparing...
13:24:20 WARNING: Failed to detect plugins for C:\Program Files (x86)\Jenkins\workspace\blazermeter\modified_blazedemo_script-1.jmx: [Error 2] El sistema no puede encontrar el archivo especificado
13:24:20 INFO: Starting...
13:24:20 INFO: Waiting for results...
Finally I have solved the problem using the following command and script in jenkins:
Shell Script -- bzt xxxx.yml -o scenarios.xxxx-webapp.variables.port-number=8080 -o scenarios.xxxx-webapp.variables.server-name=xxxx-es-web-stable-12-app -o scenarios.xxxx-mobile.variables.port-number=8080 -o scenarios.xxxx-mobile.variables.server-name=xxxx-es-web-stable-12-app -o modules.console.disable=true -o settings.artifacts-dir=./results --
Attached the configuration yml file:
execution:
- scenario: xxxxxx-webapp
- scenario: xxxxxx-mobile
scenarios:
xxxxxx-webapp:
script: ./xxxxxx_WEBAPP/xxxxxx_WEBAPP.jmx
variables:
server-name: localhost
port-number: 9090
num-users: 1
ramp: 10
xxxxxx-mobile:
script: ./xxxxxx_ANDROIDAPP/xxxxxx_ANDROIDAPP.jmx
variables:
server-name: localhost
port-number: 9090
num-users: 3
ramp: 10

Resources