Skip to content

Commit 04289c0

Browse files
committed
Added README.md, updated .gitignore and added docker-compose.yml
1 parent f50477a commit 04289c0

File tree

3 files changed

+119
-1
lines changed

3 files changed

+119
-1
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,4 +360,6 @@ MigrationBackup/
360360
.ionide/
361361

362362
# Fody - auto-generated XML schema
363-
FodyWeavers.xsd
363+
FodyWeavers.xsd
364+
365+
TestResults/

README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
![Test Automation using Selenium WebDriver, NUnit and C#](./images/NUnit-Automation-Framework.png?raw=true "Test Automation using Selenium WebDriver, NUnit and C#")
2+
3+
# Test Automation using Selenium WebDriver and C#
4+
This is sample Test Automation framework designed using Selenium WebDriver, NUnit and C#. And in this framework we will see some basic working examples for learning.
5+
6+
## Features
7+
- This automation framework is designed using NUnit.
8+
- C# is used as programming language.
9+
- Reporting is implemented using `` npm module. This generates the report in html. Also it captures the screenshots.
10+
11+
## To Get Started
12+
13+
### Pre-requisites
14+
- Download and install Chrome or Firefox browser.
15+
- Download and install [.NET 5.0](https://dotnet.microsoft.com/download/dotnet/5.0)
16+
- Download and install any Text Editor like Visual Code
17+
- Install Extension in Visual Code
18+
* [PackSharp](https://marketplace.visualstudio.com/items?itemName=elsnoman.packsharp)
19+
* [C#](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp)
20+
21+
### Setup Scripts
22+
- Clone the repository into a folder
23+
24+
## How Framework is setup like a advance user
25+
26+
### Open the Command Palette for each of these commands
27+
- `PackSharp: Create New Project` > select `Class Library` > call the Project "Framework"
28+
- `PackSharp: Create New Project` > select `Class Library` > call the Project "Royale"
29+
- `PackSharp: Create New Project` > select `NUnit 3 Test Project` > call the Project "Royale.Tests"
30+
- `PackSharp: Create New Project` > select `Solution File` > call the Project "StatsRoyale"
31+
32+
> NOTE: The Solution (.sln) file will manage the Project (.csproj) files while the Project files handle their own packages and dependencies. As you add things, this is all handled for you! Very cool.
33+
34+
### Add the Projects to the Solution. Run these commands in the Terminal:
35+
- `$ dotnet sln add Framework`
36+
- `$ dotnet sln add Royale`
37+
- `$ dotnet sln add Royale.Tests`
38+
39+
### Build the Solution so we know everything is working
40+
- `$ dotnet build`
41+
42+
### Clean all the projects
43+
- `$ dotnet clean`
44+
45+
### Run the Tests
46+
- `$ dotnet test`
47+
- This will run all the tests, but you only have one right now. It should pass.
48+
49+
### Console Test Results
50+
51+
### How to Generate HTML Report
52+
53+
## How to run tests in Docker
54+
55+
### Download and install Docker
56+
- Check version of docker `docker --version`
57+
58+
### How to find all the images in your system
59+
- Go to `http://hub.docker.com/`
60+
- Search for selenium images
61+
- Pull images
62+
* `docker pull selenium/hub`
63+
* `docker pull selenium/chrome`
64+
* `docker pull selenium/chrome-debug`
65+
* `docker pull selenium/firefox`
66+
* `docker pull selenium/firefox-debug`
67+
- Check all the version in your system `docker images`
68+
69+
### How to run docker-compose
70+
- `docker-compose up -d`
71+
72+
### How to find which are the images up and running
73+
- `docker ps -a`
74+
75+
### How to check local Grid in a browser?
76+
- `http://localhost:4444/grid/console`
77+
78+
### How to restart docker-compose
79+
- `docker-compose restart`
80+
81+
### How to stop docker-compose
82+
- `docker-compose down`
83+
84+
## Reference
85+
- https://codemag.com/Article/2009101/Interactive-Unit-Testing-with-.NET-Core-and-VS-Code

docker-compose.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: "3"
2+
services:
3+
4+
selenium-hub:
5+
image: selenium/hub
6+
ports:
7+
- "4444:4444"
8+
environment:
9+
GRID_MAX_SESSION: 16
10+
GRID_BROWSER_TIMEOUT: 300
11+
GRID_TIMEOUT: 300
12+
13+
chrome:
14+
image: selenium/node-chrome
15+
depends_on:
16+
- selenium-hub
17+
environment:
18+
HUB_PORT_4444_TCP_ADDR: selenium-hub
19+
HUB_PORT_4444_TCP_PORT: 4444
20+
NODE_MAX_SESSION: 2
21+
NODE_MAX_INSTANCES: 2
22+
23+
firefox:
24+
image: selenium/node-firefox
25+
depends_on:
26+
- selenium-hub
27+
environment:
28+
HUB_PORT_4444_TCP_ADDR: selenium-hub
29+
HUB_PORT_4444_TCP_PORT: 4444
30+
NODE_MAX_SESSION: 4
31+
NODE_MAX_INSTANCES: 4

0 commit comments

Comments
 (0)