Skip to content

xuanzhaopeng/appium-dotnet-specflow-mweb-example

Repository files navigation

Mobile web/Desktop Browser test starter

              

Build Status

The project is in C#.Net, with the help of Appium/Selenium(.net version), NUnit, Specflow and Allure.

Environment

  • C#.Net Target: 4.7.1
  • Specflow: 2.4.1

Proejct logic

Project logic

Configure driver and timeout

  <!-- You could config Driver and timeout in App.config -->
  <TestSettings>
    <Driver PlatformName="Android" BrowserName="Chrome" DeviceName="Android Emulator" ServerUrl="http://localhost:4723/wd/hub"></Driver>
	<!-- You also could add SauceLabsDriver / BrowserStackDriver -->
  </TestSettings>

Predefined Drivers

Support Mobile Web Support Desktop Web
LocalDriver
SauceLabsDriver
BrowserStackDriver

Run test

  • Run with SauceLabs Real Device (TestObject)
export SERVER_PROVIDER=SauceLabs
export SAUCE_KEY=<Your Sauce API Key>

nuget restore Spec.Web.sln
nuget install NUnit.Console -Version 3.9.0 -OutputDirectory testrunner
msbuild /p:Configuration=Release Spec.Web.sln
./testrunner/NUnit.ConsoleRunner.3.9.0/tools/nunit3-console.exe ./Spec.Web.Mobile/bin/Release/Spec.Web.Mobile.dll
  • Run with local Appium and Android
# Ensure you start Appium locally and has conntected Android or Android emulator

nuget restore Spec.Web.sln
nuget install NUnit.Console -Version 3.9.0 -OutputDirectory testrunner
msbuild /p:Configuration=Release Spec.Web.sln
./testrunner/NUnit.ConsoleRunner.3.9.0/tools/nunit3-console.exe ./Spec.Web.Mobile/bin/Release/Spec.Web.Mobile.dll
  • Run with BrowserStack Desktop Browser
export SERVER_PROVIDER=BrowserStack
export BS_USER=<Your BrowserStack User>
export BS_KEY=<Your BrowserStack Key>

nuget restore Spec.Web.sln
nuget install NUnit.Console -Version 3.9.0 -OutputDirectory testrunner
msbuild /p:Configuration=Release Spec.Web.sln
./testrunner/NUnit.ConsoleRunner.3.9.0/tools/nunit3-console.exe ./Spec.Web.Desktop/bin/Release/Spec.Web.Desktop.dll
  • Run with local Chrome Desktop browser
# Ensure you start selenium standalone server with related chrome driver

nuget restore Spec.Web.sln
nuget install NUnit.Console -Version 3.9.0 -OutputDirectory testrunner
msbuild /p:Configuration=Release Spec.Web.sln
./testrunner/NUnit.ConsoleRunner.3.9.0/tools/nunit3-console.exe ./Spec.Web.Desktop/bin/Release/Spec.Web.Desktop.dll

Test Report

It will generate Allure test report in allure-results folder where the assemly located. Please kindly noticed I do not really properly configured the Allure report, you could extend it such as adding screenshots or recorded videos into report.

Project structure

  • Spec.Web.Core: The core library that could be shared by all test assembly
  • Spec.Web.Mobile: The mobile web test project for both Android and iOS.
  • Spec.Web.Desktop: The desktop browser test project
  • Spec.Web.Bindings: Specflow common bindings(Hook & StepDefinitions) and PageObjects

Copyright

Please kindly notice this project is only could be used for LEARNING usage of Appium / Selenium / Specflow in C#.Net environment.

About

Example of Appium / Selenium with Specflow, NUnit and Allure in .Net

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published