Sample project for web applications testing lessons.
Old version: If you are looking for old version built on ASP.NET WebApi2 (.NET Framework 4.6.2) and AngularJS 1.6 check branch named old
You need:
- .NET Core 2.0 SDK
- Visual Studio 2017 or Visual Studio Code to edit the code, debug etc.
- Node.js
- Angular CLI
- Chrome browser
- Clone this repository
- Go to
src\Server\
and rundotnet run
from command line. This compiles and starts server part of the application. (dotnet
is part of .NET Core SDK) - Go to
src\Client\ClientApp\
and runnpm install
to install NPM packages. Then runng serve
. This compiles and starts client part of the application. (ng
is part of Angular CLI) - Navigate to http://localhost:4200 and you should see running application
Server tests can be run from Visual Studio Test Explorer or using dotnet test
command. Visual Studio way is easy, tests just apper in Test Eplorer after build. (Note: EndToEndApiTests
need running server to work)
To run tests from command line you need to:
- Unit tests: Go to
src\tests\ServerTests\
and rundotnet test
. It runs unit tests for server part. - E2E tests: These tests need running server so run server using
dotnet run
insrc\Server\
first. Then go tosrc\tests\EndToEndApiTests\
and rundotnet test
. It runs E2E tests for server part.
Debugging tests
You can debug server tests from Visual Studio. Just put breakpoints to code and, right-click on test in Test Explorer and select Debug selected test
Client tests can be run using Angular CLI
.
- Unit tests: Go to
src\Client\ClientApp\
and runng test
. This command starts Chrome browser and executes client unit tests in it. You'll also see tests results in command line where you executed the command. - E2E tests: These tests need running server so run server using
dotnet run
insrc\Server\
first. Then go tosrc\Client\ClientApp\
and runng e2e
. This command starts Chrome browser and executes E2E tests by interacting with application UI.
Debugging tests
You can debug client tests from Visual Studio Code. See Chrome Debugging with Angular CLI for details how to set it up.