Skip to content

ralupopa/Tests-NUnit-AltTesterDriver-CoinCollector

Repository files navigation

Prerequisite

  1. Download and install .NET SDK
  2. Have a game instrumented with AltTester Unity SDK
  3. Have AltTester Desktop app installed (to be able to inspect game)

Tests created with NUnit & AltTester-Driver for a game developed w/ Unity (CoinCollector)

This repository is a test project that uses NUnit as the test library. It was generated using following command (as suggested in documentation)

dotnet new nunit

AltTester Unity SDK framework contains AltDriver class used to connect to the instrumented game developed w/ Unity. AltTester-Driver for C# is available as a nuget package. Install AltTester-Driver nuget package

dotnet add package AltTester-Driver --version 1.8.0

Run tests manually (with dotnet CLI)

  1. Launch game
  2. From CoinCollector.Tests execute all tests:
dotnet test

! Make sure to have the Alttester Desktop App closed, otherwise the test won't be able to connect to proper port.

Run all tests from a specific class / file

dotnet test --filter <test_class_name>

Run only one test from a class

dotnet test --filter <test_class_name>.<test_name>

Run tests and generate HTML test report

Using Allure

Read Setup Allure as pre-requisite.

allure_run_tests_generate_report.sh

Manual Steps

  1. Launch game from AppCoinCollector\CoinCollectorStandalone.exe

  2. Move to CoinCollector.Tests

  3. Execute all tests and generate output specific for Allure NUnit adapter

dotnet test --results-directory allure-results
  1. Generate test results report
allure serve allure-results

Save Allure report in one HTML file (easy to share)

After generating allure-report, when we need to save everything into one html file (to share it): install an external package which builds allure generated folder into one html file.

Requirements: Python 3.6+

pip install allure-combine

allure-combine package implementation and documentation

Then each time after running test, when want to save allure-report in one sharable HTML file:

allure generate -o allure-report
allure-combine ./allure-report