- Instructions
- Tests
- Api Integration tests
- Web UI tests
- Improvements that I could have made
- Executing tests from command line
- Run Api tests
- Run Selenium tests
- Executing tests from visual studio
- Executing tests from Docker
- Automation framework and code have been implemented using .NET Core 2.1 and C# 7.0 as the language
- .NET Core 2.1 can be download from https://dotnet.microsoft.com/download/dotnet-core/2.1
- I have used Visual Studio(VS) 2019 (https://visualstudio.microsoft.com/downloads/) as the IDE during development.
- If you wish to run tests from visual studio, you need to have Visual studio with specflow visual studio plugin (https://marketplace.visualstudio.com/items?itemName=TechTalkSpecFlowTeam.SpecFlowForVisualStudio). Tests can be run from command line without using VS as well. Please check the 'Executing tests from command line' section below for more information.
- chromedriver.exe version 81.0.4044.69 is required to run the tests, If your chrome browser version is lower than 81.0.4044.69, you have to upgrade.
- If you have a newer version of Chrome Browser than version 81.0.4044.69, please use the matching chromedriver.exe
- Make sure chromedriver.exe is not being used by any other process during test execution. Use "taskkill -f -im chromedriver.exe" to kill if it's being used.
The solution has two test projects(Api and Web UI)
- Api integration tests have been automated using .NET Http client and NUnit test framework
- Only GetAsync was implemented as no other HTTP verbs were required to achieve the given task
- No attempts were made to implement bearer token acquisition to authenticate the request as its was not required
- Use Specflow/Webdriver and BDD approach
- Web UI tests don't have a Logger implemented(I have done it only for the Api tests).
- Can implement a HTML report generating capability after a test run to see the pass/fail status and stats
- Screenshots can be captured before and after every step and embed in the HTML report.
- Use of IWebDriver in page objects and page components tightly couple the framework to selenium/webdriver.This can be eliminated by wrapping the IWebDriver to a framework-specific interface so that the framework will be agnostic of the underlying webdriver technology and plugged to a different api later on without changing the test code.
- WebDriverFactory can be improved to run the tests using any other browser or even on mobiles using appium and RemoteWebDriver
- Can add more hooks (Before after features / Before after steps) to gather vital information such as time taken to execute each steps to identify bottlenecks
- Page objects and components only contain the elements/methods (MVP) that are required to achieve the workflows in scenarios.
- Navigate to Api test folder where you can find the *.csproj file e.g. C:\Users\xxxx\source\repos\Trademe.Automation\Trademe.Automation.Api.Tests
- Open command line and run "dotnet test -v m --logger trx Trademe.Automation.Api.Tests.csproj"
- After test run is finished , open TestResults to see the test result trx file
- Navigate to Api test folder where you can find the *.csproj file e.g. C:\Users\xxxx\source\repos\Trademe.Automation\Trademe.Automation.Web.Tests
- Open command line and run "dotnet test -v m --logger trx Trademe.Automation.Web.Tests.csproj"
- After test run is finished , open TestResults to see the test result trx file
- Select Tests > Windows > Test Explorer from the Visual studio menu
- After successful compilation, you should see tests in the Test Explorer panel.
- Right-click and run all or selected tests
- Change the target to "Remote" in appsettings.json of Trademe.Automation.Web.Tests project.
- You must have docker installed. Make sure your docker server deamon is running on Linux. (If on Windows containers, switch to Linux containers)
- On the solution root folder, build the test container using
- WEB TESTS > "docker build --target webtestrunner -t webuitests:latest"
- API TESTS > "docker build --target apitestrunner -t apitests:latest"
- Start the selenium hub as "docker run -d --name seleniumhub -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome"
- Run your web ui tests as "docker --rm run --link seleniumhub webuitests"
- Run your api tests as "docker --rm -it run apitests"