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

How to specify the environment variable BROWSERSTACK_BUILD_NAME to generate test report #25

Open
phucgame opened this issue Dec 25, 2020 · 11 comments

Comments

@phucgame
Copy link

  • My sample project is using Jenkins triggers to run Browserstack Cypress by command:
    browserstack-cypress run

  • I installed Browserstack plugin in Jenkins. Follow steps but got failed at generating report as below:
    ========================================
    [BrowserStack] Generating BrowserStack Test Report
    [BrowserStack] BrowserStack Project identified as : AUTOMATE
    [BrowserStack] [ERROR] BrowserStackException occurred while fetching build: com.browserstack.automate.exception.AutomateException: Build not found by name: jenkins-project_aaa-7
    [BrowserStack] BrowserStack Report Status: Failed
    ========================================

  • This is a warning but I don't know how to do
    ========================================
    This step will generate BrowserStack Test Report by utilising the build name from the environment variable BROWSERSTACK_BUILD_NAME set by the BrowserStack plugin
    ========================================

Reference:
--> https://www.browserstack.com/docs/automate/selenium/jenkins?ref=jenkins_plugin#JenkinsUI

@wati123321
Copy link

The BrowserStack Jenkins plugin will directly set the build name for the test. It sets the Environment variable BROWSERSTACK_BUILD_NAME.

@phucgame
Copy link
Author

@wati123321
Please help to review
Here is full console log for specified build, then still failed with build not found ...

========================================
FSSCM.check completed in 12.686 seconds
[BrowserStack] Local: Starting BrowserStack Local...
[BrowserStack] Local: Started
[BrowserStack] BROWSERSTACK_USERNAME=phuclegame1
[BrowserStack] BROWSERSTACK_ACCESS_KEY=********************
[BrowserStack] BROWSERSTACK_BUILD=jenkins-project_aaa-7
[BrowserStack] BROWSERSTACK_BUILD_NAME=jenkins-project_aaa-7
[BrowserStack] BROWSERSTACK_LOCAL=true
[BrowserStack] BROWSERSTACK_LOCAL_IDENTIFIER=53e3f298-5cd5-4b93-b3dd-4866acdddc46-project_aaa__7
[project_aaa] $ cmd /c call C:\Users\phuc\AppData\Local\Temp\jenkins8923147995851973098.bat

C:\Users\phuc.jenkins\workspace\project_aaa>browserstack-cypress run --build-name jenkins-project_aaa-7
[12/25/2020, 4:43:56 PM] - �[32minfo�[39m: Reading config from C:\Users\phuc.jenkins\workspace\project_aaa\browserstack.json
[12/25/2020, 4:43:57 PM] - �[32minfo�[39m: Reading username from the environment variable BROWSERSTACK_USERNAME
[12/25/2020, 4:43:57 PM] - �[32minfo�[39m: Reading access key from the environment variable BROWSERSTACK_ACCESS_KEY
[12/25/2020, 4:43:57 PM] - �[32minfo�[39m: Reading local setting from the environment variable BROWSERSTACK_LOCAL
[12/25/2020, 4:43:57 PM] - �[32minfo�[39m: Reading local identifier from the environment variable BROWSERSTACK_LOCAL_IDENTIFIER
[12/25/2020, 4:43:57 PM] - �[32minfo�[39m: Validating the config
[12/25/2020, 4:43:57 PM] - �[32minfo�[39m: Creating tests.zip with files in .
[12/25/2020, 4:43:57 PM] - �[32minfo�[39m: Uploading the tests to BrowserStack
[12/25/2020, 4:43:59 PM] - �[32minfo�[39m: Uploaded tests successfully (bs://93c111964aa3170916bf3b787f4cdf85668d1e2a)
[12/25/2020, 4:43:59 PM] - �[32minfo�[39m: Deleted tests.zip successfully.
[12/25/2020, 4:43:59 PM] - �[32minfo�[39m: Browsers list: Windows 10 / Chrome (latest), Windows 10 / Firefox (latest), Windows 10 / Edge (latest)
[12/25/2020, 4:43:59 PM] - �[32minfo�[39m: Local is set to: true (you will now be able to test localhost / private URLs)
[12/25/2020, 4:43:59 PM] - �[32minfo�[39m: Parallels limit specified: 3
[12/25/2020, 4:44:01 PM] - �[33mwarn�[39m: No npm dependencies specified - your specs might fail if they need any packages to be installed before running.
[12/25/2020, 4:44:01 PM] - �[33mwarn�[39m: Read more about npm dependencies here: https://www.browserstack.com/docs/automate/cypress/npm-packages. You can suppress this warning by using --disable-npm-warning flag.
[12/25/2020, 4:44:01 PM] - �[32minfo�[39m: Success! Build created with build id: 20950429036ef452f313f5d7677019cff55d69ed
[12/25/2020, 4:44:01 PM] - �[32minfo�[39m: Visit the Automate dashboard for real-time test reporting: https://automate.browserstack.com/dashboard/v2/builds/20950429036ef452f313f5d7677019cff55d69ed
[12/25/2020, 4:44:01 PM] - �[32minfo�[39m: Exiting the CLI, but your build is still running. You can use the --sync option to keep getting test updates. You can also use the build-info 20950429036ef452f313f5d7677019cff55d69ed command now.
[BrowserStack] Local: Stopping BrowserStack Local...
[BrowserStack] Local: Stopped
[BrowserStack] Generating BrowserStack Test Report
[BrowserStack] BrowserStack Project identified as : AUTOMATE
[BrowserStack] [ERROR] BrowserStackException occurred while fetching build: com.browserstack.automate.exception.AutomateException: Build not found by name: jenkins-project_aaa-7
[BrowserStack] BrowserStack Report Status: Failed
Finished: SUCCESS

@Namrata-m13
Copy link

@phucgame You can generate the reports using the CLI functionality as mentioned in the following link, https://www.browserstack.com/docs/automate/cypress/generate-reports.

We will let you know once we have added support for Cypress reports in the Jenkins plugin. Meanwhile, you can use the above-mentioned method to generate reports using Cypress on BrowserStack.

@msilesgap
Copy link

I'm having the same issue trying to generate the report

[7/9/2021, 11:20:58 PM] - �[31merror�[39m: Generating report for the build 29 failed. with error: 
{
  "message": "Build not found"
}
[BrowserStack] Generating BrowserStack Cypress Test Report
[BrowserStack] BrowserStack Cypress Project identified as : AUTOMATE
[BrowserStack] [ERROR] BrowserStack Cypress Report not generated, build name mismatch.
[BrowserStack] BrowserStack Cypress Report Status: Failed
Finished: SUCCESS

@Tae-juss
Copy link

Tae-juss commented Jul 9, 2021

@msilesgap You can generate HTML reports with Cypress at BrowserStack. Embedded reports within Jenkins is not supported at the moment.

For reference: https://www.browserstack.com/docs/automate/cypress/generate-reports

@Tasmi123
Copy link

I am also getting the same error. How to set this variable in the parallel config JSON file for testNG?

@Swapnil-Titar
Copy link

Anyone got the solution for this problem, with Ruby 3.x I am getting same error...

@alwaysshiftingleft
Copy link

if you are looking to generate Cypress Test Report with Browserstack using Cypress, I was able to generate it now with the below configuration in Jenkins
image
image

BROWSERSTACK_BUILD_NAME set by the BrowserStack plugin and i am still try to figure out if it can be send from the code or as variable (custom name)

@ghost
Copy link

ghost commented Aug 24, 2022

BROWSERSTACK_BUILD_NAME (variable name) will need to be kept as is and cannot be modified to a custom name since the BrowserStack Plugin generates the Build Name (value) at runtime. This Build name is consumed by the BrowserStack Cypress Test Report Action to map the session on the BrowserStack Platform with the results to be published on Jenkins.

If you have any further queries with respect to the BrowserStack plugin, you may want to reach out to BrowserStack Support.

@hayaalresheq94
Copy link

hey was this issue fixed? I am fixing the exact issue

@bhumikababbar
Copy link

@ hayaalresheq94

You can try and follow the steps mentioned by abhimanyu1589

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

10 participants