Skip to content

Commit f5c7570

Browse files
samirans89abhi-singhsAbhi Singhprincebaretto99
authored
Sdk (#9)
* adds browserstack SDK * updates config * updates buildname --------- Co-authored-by: Abhi Singh <abhidashing.singh@gmail.com> Co-authored-by: Abhi Singh <abhi.s@browserstack.com> Co-authored-by: Princeton Baretto <43331485+princebaretto99@users.noreply.github.com>
1 parent ca69a21 commit f5c7570

26 files changed

Lines changed: 132 additions & 746 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ obj
1010
*.suo
1111
TestResults
1212
**/.DS_Store
13+
log

README.md

Lines changed: 12 additions & 186 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
![Logo](https://www.browserstack.com/images/static/header-logo.jpg)
22

3-
# BrowserStack Examples SpecflowPlus <a href="https://specflow.org/"><img src="https://www.specflow.org/wp-content/uploads/2016/07/SF_Logo.png" alt="Specflow" height="22" alt="Behavior Driven Development for .NET" /></a>
3+
# BrowserStack Examples Specflow <a href="https://specflow.org/"><img src="https://www.specflow.org/wp-content/uploads/2016/07/SF_Logo.png" alt="Specflow" height="22" alt="Behavior Driven Development for .NET" /></a>
44

55
## Introduction
66

7-
SpecFlow is the #1 .NET open source framework for Behavior Driven Development, Acceptance Test Driven Development and Specification by Example. With over 10m downloads on NuGet, SpecFlow is trusted by teams around the world.
7+
SpecFlow is an open source framework for Behavior Driven Development, Acceptance Test Driven Development and Specification by Example.
88

9-
This BrowserStack Example repository demonstrates a #{ Selenium test / Cypress / Puppeteer / Other } framework written in Cucumber and Junit 5 with parallel testing capabilities. The #{ Selenium test / Cypress / Puppeteer / Other } test scripts are written for the open source [BrowserStack Demo web application](https://bstackdemo.com) ([Github](https://github.com/browserstack/browserstack-demo-app)). This BrowserStack Demo App is an e-commerce web application which showcases multiple real-world user scenarios. The app is bundled with offers data, orders data and products data that contains everything you need to start using the app and run tests out-of-the-box.
10-
11-
The #{ Selenium test / Cypress / Puppeteer / Other } tests are run on different platforms like on-prem, docker and BrowserStack using various run configurations and test capabilities.
9+
This BrowserStack Example repository demonstrates a Selenium test framework written in Cucumber and NUnit with parallel testing capabilities. The Selenium test scripts are written for the open source [BrowserStack Demo web application](https://bstackdemo.com) ([Github](https://github.com/browserstack/browserstack-demo-app)). This BrowserStack Demo App is an e-commerce web application which showcases multiple real-world user scenarios. The app is bundled with offers data, orders data and products data that contains everything you need to start using the app and run tests out-of-the-box.
1210

1311
---
1412

@@ -42,124 +40,6 @@ This repository contains the following #{ Selenium test} tests:
4240
| User | Login as User with existing Orders | This test verifies that existing orders are shown for user: "existing_orders_user" .It is executed in Mobile profile. |
4341
4442
---
45-
46-
## Test infrastructure environments
47-
48-
- [On Prem](#on-premise-self-hosted)
49-
- [Docker](#docker)
50-
- [BrowserStack](#browserstack)
51-
52-
---
53-
54-
# On Premise / Self Hosted
55-
56-
This infrastructure points to running the tests on your own machine using a browser (e.g. Chrome) using the browser's driver executables (e.g. ChromeDriver for Chrome). #{ Selenium enables this functionality using WebDriver for many popular browsers.}
57-
58-
## Prerequisites
59-
60-
- For this infrastructure configuration (i.e on-premise), ensure that the ChromeDriver executable is available in the path.
61-
- ChromeDriver can be downloaded from https://chromedriver.chromium.org/downloads
62-
63-
Note: The ChromeDriver version must match the Chrome browser version on your machine.
64-
65-
## Running Your Tests
66-
67-
### Run a specific test on your own machine
68-
69-
- How to run the test?
70-
71-
To run the default test scenario (e.g. Login Scenario) on your own machine, use the following command:
72-
73-
.Net Core:
74-
75-
```
76-
set CAPABILITIES_FILENAME=capabilities-driver.yml
77-
dotnet test --filter Category=single
78-
```
79-
80-
- Output
81-
82-
This run profile executes a specific test scenario on a single browser instance on your own machine.
83-
84-
- To run a specific test scenario use the filter tagged to that feature file.
85-
86-
.Net Core:
87-
88-
```
89-
set CAPABILITIES_FILENAME=capabilities-driver.yml
90-
dotnet test --filter Category=<tag>
91-
```
92-
93-
where, the argument 'Tag' can be any profile configured with filters in feature files for this repository.
94-
95-
E.g. "single", "e2e", "login", "offers", "product" and "user"
96-
97-
- Output
98-
99-
This run profile executes the test Feature file sequentially on a single browser, on your own machine.
100-
101-
---
102-
103-
# Docker
104-
105-
[Docker](https://docs.docker.com/get-started/overview/) is an open source platform that provides the ability to package and test applications in an isolated environment called containers.
106-
107-
## Prerequisites
108-
109-
- Install and start [Docker](https://docs.docker.com/get-docker/).
110-
- Note: Docker should be running on the test machine. Ensure Docker Compose is installed as well.
111-
- Run `docker-compose pull` from the current directory of the repository.
112-
113-
## Running Your Tests
114-
115-
### Run a specific test on the docker infrastructure
116-
117-
- How to run the test?
118-
119-
- Start the Docker by running the following command:
120-
121-
```
122-
docker-compose up -d
123-
```
124-
125-
To run the default test scenario (e.g. Login Scenario) on your own machine, use the following command:
126-
127-
.Net Core:
128-
129-
```
130-
set CAPABILITIES_FILENAME=capabilities-driver.yml
131-
dotnet test --filter Category=single
132-
```
133-
134-
- Output
135-
136-
This run profile executes a specific test scenario on a single browser instance on your personal selenium grid.
137-
138-
- To run a specific test scenario use the filter tagged to that feature file.
139-
140-
.Net Core:
141-
142-
```
143-
set CAPABILITIES_FILENAME=capabilities-driver.yml
144-
dotnet test --filter Category=<Tag>
145-
```
146-
147-
where, the argument 'Tag' can be any profile configured with filters in feature files for this repository.
148-
149-
E.g. "single", "e2e", "login", "user", "offers" and "product"
150-
151-
- Output
152-
153-
This run profile executes the test Feature file sequentially on a single browser, on your personal selenium grid.
154-
155-
- After tests are complete, you can stop the Docker by running the following command:
156-
157-
```
158-
docker-compose down
159-
```
160-
161-
---
162-
16343
# BrowserStack
16444
16545
[BrowserStack](https://browserstack.com) provides instant access to 2,000+ real mobile devices and browsers on a highly reliable cloud infrastructure that effortlessly scales as testing needs grow.
@@ -183,21 +63,19 @@ Note: The ChromeDriver version must match the Chrome browser version on your mac
18363
set BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>
18464
```
18565
186-
Alternatively, you can also hardcode username and access_key objects in the [capabilities.yml](browserstack_examples_specflowplus/BrowserStack/Webdriver/Resources/capabilities.yml) file.
66+
Alternatively, you can also hardcode username and access_key objects in the [browserstack.yml](browserstack_examples_specflowplus/browserstack.yml) file.
18767
18868
Note:
18969
19070
- The exact test capability values can be easily identified using the [Browserstack Capability Generator](https://browserstack.com/automate/capabilities)
19171
19272
## Running Your Tests
19373
194-
### Run a specific test on BrowserStack
195-
196-
In this section, we will run a single test on Chrome browser on Browserstack. To change test capabilities for this configuration, please refer to the `PlatformOptions` object in `capabilities.yml` file.
74+
In this section, we will run tests on Browserstack. To change test capabilities for this configuration, please refer to the `platforms` object in `browserstack.yml` file.
19775
19876
- How to run the test?
19977
200-
To run the default test scenario (e.g. Login Scenario) on your own machine, use the following command:
78+
To run a test scenario (e.g. Login Scenario) on your own machine, use the following command:
20179
20280
.Net Core:
20381
@@ -215,64 +93,21 @@ In this section, we will run a single test on Chrome browser on Browserstack. To
21593
21694
E.g. "single", "e2e", "login", "user", "offers" and "product"
21795
218-
- Output
96+
---
21997
220-
This run profile executes a single test on a single browser on BrowserStack. Please refer to your [BrowserStack dashboard](https://automate.browserstack.com/) for test results.
221-
222-
### Running entire suite in parallel on BrowserStack
223-
224-
- In this section, we will run the tests in parallel on a single browser OS combination on Browserstack.
225-
226-
How to run the test?
227-
228-
To run the entire test suite in parallel on a single BrowserStack browser, just run:
229-
230-
```
231-
dotnet test
232-
```
233-
234-
By default, the NUnit runner will only run 10 tests in parallel. This can changed from [AssemblyInfo.cs](browserstack_examples_specflowplus/Properties/AssemblyInfo.cs). You can change the `[assembly: LevelOfParallelism(10)]` tag where you can replace the number 10 with anny number you find appropriate
235-
236-
### [Web application hosted on internal environment] Running your tests on BrowserStack using BrowserStackLocal
237-
238-
#### Prerequisites
239-
240-
- Clone the [BrowserStack demo application](https://github.com/browserstack/browserstack-demo-app) repository.
241-
```
242-
git clone https://github.com/browserstack/browserstack-demo-app
243-
```
244-
- Please follow the README.md on the BrowserStack demo application repository to install and start the dev server on localhost.
245-
- In this section, we will run a single test case to test the BrowserStack Demo app hosted on your local machine i.e. localhost. Refer to the `Local` object in `conf.json` file to change test capabilities for this configuration.
246-
- Note: You may need to provide additional BrowserStackLocal arguments to successfully connect your localhost environment with BrowserStack infrastructure. (e.g if you are behind firewalls, proxy or VPN).
247-
- Further details for successfully creating a BrowserStackLocal connection can be found here:
248-
249-
- [Local Testing with Automate](https://www.browserstack.com/local-testing/automate)
250-
- [BrowserStackLocal C# GitHub](https://github.com/browserstack/browserstack-local-csharp)
251-
- Onces Connection is established user "browserstack.local": "true" in cpabalitilies.
252-
253-
### [Web application hosted on internal environment] Run a specific test on BrowserStack using BrowserStackLocal
254-
255-
- How to run the test?
256-
257-
-Product Feature can be run by Tag "Local" on a single BrowserStack browser using BrowserStackLocal, use the following command:
98+
To run all the tests, use the following command:
25899
259100
.Net Core:
260101
261102
```
262-
set CAPABILITIES_FILENAME=capabilities-local.yml
263-
dotnet test --filter Category=single
264-
```
265-
266-
or
267-
```set CAPABILITIES_FILENAME=capabilities-local.yml
268-
dotnet test --filter Category=<tag>
103+
dotnet test
269104
```
270105
271-
eg tags are "single", "e2e", "login", "user", "offers" and "product"
106+
The number of prallels per platform can be configured by changing the value of `parallelsPerPlatform` property in the `browserstack.yml` file.
272107
273108
- Output
274109
275-
This run profile executes a single test on an internally hosted web application on a single browser on BrowserStack. Please refer to your BrowserStack dashboard(https://automate.browserstack.com/) for test results.
110+
This run profile executes a single test on a single browser on BrowserStack. Please refer to your [BrowserStack dashboard](https://automate.browserstack.com/) for test results.
276111
277112
## Additional Resources
278113
@@ -282,13 +117,4 @@ In this section, we will run a single test on Chrome browser on Browserstack. To
282117
- [List of Browsers & mobile devices](https://www.browserstack.com/list-of-browsers-and-platforms?product=automate) for automation testing on BrowserStack #{ Replace link for non-Selenium frameworks. }
283118
- [Using Automate REST API](https://www.browserstack.com/automate/rest-api) to access information about your tests via the command-line interface
284119
- Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github)
285-
- For testing public web applications behind IP restriction, [Inbound IP Whitelisting](https://www.browserstack.com/local-testing/inbound-ip-whitelisting) can be enabled with the [BrowserStack Enterprise](https://www.browserstack.com/enterprise) offering
286-
287-
## Observations
288-
289-
- If Test are skipped, please check for other instances of .Net Host & BrowserstackLocal running in background and terminate the running instances explicity.
290-
291-
## Open Issues
292-
293-
- When running all the tests together, there is some flakiness observed and some Test might get fail.
294-
- Please specify the binary path to the local options when using BrowserStack Local. You can find more details about it [here](https://www.nuget.org/packages/BrowserStackLocal/)
120+
- For testing public web applications behind IP restriction, [Inbound IP Whitelisting](https://www.browserstack.com/local-testing/inbound-ip-whitelisting) can be enabled with the [BrowserStack Enterprise](https://www.browserstack.com/enterprise) offering
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"browserstack-sdk": {
6+
"version": "0.3.0",
7+
"commands": [
8+
"browserstack-sdk"
9+
]
10+
}
11+
}
12+
}

browserstack_examples_specflowplus/BrowserStack/Webdriver/Config/BrowserType.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

browserstack_examples_specflowplus/BrowserStack/Webdriver/Config/Capabilities.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

browserstack_examples_specflowplus/BrowserStack/Webdriver/Config/DriverType.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.

browserstack_examples_specflowplus/BrowserStack/Webdriver/Config/LocalFactory.cs

Lines changed: 0 additions & 56 deletions
This file was deleted.

browserstack_examples_specflowplus/BrowserStack/Webdriver/Config/LocalTunnelConfig.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

browserstack_examples_specflowplus/BrowserStack/Webdriver/Config/OnPremDriverConfig.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)