Quick start guide to integrate BrowserStack Test Observability with Behave.
Prerequisites
Following are the prerequisites to use Test Observability with Behave:
You have a Behave (v1.2.6 or later) test suite.
You may run your tests on BrowserStack Automate or even on any other cloud provider or even locally.
Your tests can be unit / integration / functional or of any nature.
Integrate with Test Observability
You can use BrowserStack Test Observability both when you’re using BrowserStack’s devices and browsers to run your functional end-to-end tests and also if you’re running tests locally on your laptop/CI system or even when you’re using some other cloud provider.
Not only that, Test Observability is agnostic to the type of testing and hence you could also integrate it with your unit or integration test suite written using Behave.
Please select your setup below to get started with an awesome debugging experience with Test Observability:
Go to your Behave project’s root directory and run the following commands to update or install the BrowserStack SDK, set it up using your credentials, and verify the installed version:
Ensure that you have at least browserstack-sdk v1.21.0 before proceeding.
Modify your browserstack.yml config file
After installing the SDK, a browserstack.yml config file will be created at the root level of your project. This file holds all the required capabilities to run tests on BrowserStack.
Copy the contents of the following config file and set it in your project’s browserstack.yml file:
```yml
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name goes here"
projectName: "Your static project name goes here"
CUSTOM_TAG_1: "You can set a custom Build Tag here"
# Use CUSTOM_TAG_<N> and set more build tags as you need.
framework: behave
testObservability: true
browserstackAutomation: false # Set to true for tests on BrowserStack products.
```
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName:"Your static build/job name goes here"projectName:"Your static project name goes here"CUSTOM_TAG_1:"You can set a custom Build Tag here"# Use CUSTOM_TAG_<N> and set more build tags as you need.framework: behave
testObservability:truebrowserstackAutomation:false# Set to true for tests on BrowserStack products.
The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack Automate or App Automate as Test Observability will automatically identify different build runs.
Restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.
Run your test suite with Test Observability
Prepend browserstack-sdk to the command you use to run your test. For example, if you use the command behave <path-to-test-file> to run your test suite, you can run the following command from your project’s root directory to run your test suite with BrowserStack:
Post build run completion, you’ll be able to see the build run report along with all necessary debugging information.
Update to the latest SDK version
Go to your Behave project’s root directory and run the following commands to update to the latest version of BrowserStack SDK, and verify the installed version:
```bash
pip install --upgrade browserstack-sdk
pip show browserstack-sdk
```
pip install --upgrade browserstack-sdk
pip show browserstack-sdk
Ensure that you have at least browserstack-sdk v1.21.0 before proceeding.
Update your browserstack.yml config file
As you’re an existing browserstack-sdk user, you must already be having a browserstack.yml config file at the root level of your project.
Test Observability mandatorily needs the following configurations in the file. You need not change anything but you have to ensure that the values of the buildName and projectName variables are not changing across different build runs.
```yml
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name of CI goes here"
projectName: "Your static project name goes here"
CUSTOM_TAG_1: "You can set a custom Build Tag here"
# Use CUSTOM_TAG_<N> and set more build tags as you need.
framework: behave
testObservability: true
...
```
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName:"Your static build/job name of CI goes here"projectName:"Your static project name goes here"CUSTOM_TAG_1:"You can set a custom Build Tag here"# Use CUSTOM_TAG_<N> and set more build tags as you need.framework: behave
testObservability:true...
The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack Automate or App Automate as Test Observability will automatically identify different build runs.
Restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.
Run your test suite with Test Observability
Prepend browserstack-sdk to the command you use to run your test. For example, if you use the command behave <path-to-test-file> to run your test suite, you can run the following command from your project’s root directory to run your test suite with BrowserStack:
Post build run completion, you’ll be able to see the build run report along with all necessary debugging information.
Install the latest SDK version
Go to your Behave project’s root directory and run the following commands to update or install the BrowserStack SDK, set it up using your credentials, and verify the installed version:
Ensure that you have at least browserstack-sdk v1.21.0 before proceeding.
Modify your browserstack.yml config file
After installing the SDK, a browserstack.yml config file will be created at the root level of your project. This file holds all the required capabilities to run tests on BrowserStack.
Copy the contents of the following config file and set it in your project’s browserstack.yml file:
```yml
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name goes here"
projectName: "Your static project name goes here"
CUSTOM_TAG_1: "You can set a custom Build Tag here"
# Use CUSTOM_TAG_<N> and set more build tags as you need.
framework: behave
testObservability: true
browserstackAutomation: false # Set to true for tests on BrowserStack products.
```
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName:"Your static build/job name goes here"projectName:"Your static project name goes here"CUSTOM_TAG_1:"You can set a custom Build Tag here"# Use CUSTOM_TAG_<N> and set more build tags as you need.framework: behave
testObservability:truebrowserstackAutomation:false# Set to true for tests on BrowserStack products.
The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack Automate or App Automate as Test Observability will automatically identify different build runs.
Restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.
Run your test suite with Test Observability
Prepend browserstack-sdk to the command you use to run your test. For example, if you use the command behave <path-to-test-file> to run your test suite, you can run the following command from your project’s root directory to run your test suite with BrowserStack: