Prototype application with a Vue.js client that has significant unit testing coverage with Vue Test Utils (Jest as the test runner) and configured for e2e testing with Nightwatch. The web API is built using ASP.NET Core 5.0 and unit/integration testing is handled using xUnit.core. Has a basic, functional UI for executing requests to a back-end web api.
- Front-end initially bootstrapped using the
Vue CLI App
with the following options:Babel
,TypeScript
,PWA
,Router
,Vuex
,CSS Pre-processors (node-sass)
,Linter (ts-lint)
,Unit Testing (Jest/ts-jest)
,E2E Testing (Nightwatch)
- Additionally I added:
Bulma CSS Framework
for modular stylingaxios
for REST endpoint requestsvuex-module-decorators
which enables you to write class based vuex store modulesvue-snotify
snackbar notifications (based off the original library for Angular)vue-js-modal
for displaying compiled templates as modal components, or the option to create modals dynamically at runtime (my preferred modal plugin for Vue.js)
- Back-end Web API using
ASP.NET Core 5.0
and a seperatexUnit.core
test project (for integration testing of Web API). For both Development and xUnit tests I am using theInMemory
database option withEntity Framework Core
for convienence
- Install the following (or confirm installed):
- After cloning the repo, run the command
npm install
in theClientApp
directory to restore all Node packages/dependencies from package.json - Open the .sln solution in Visual Studio and make sure all dependencies and Nuget dependencies are installed/restored - won't hurt to rebuild the entire solution (both projects)
- Two potential ways to start the entire project:
- I installed and configured the
aspnetcore-vueclimiddleware
in the FullStackTesting.Web.Api project - in theory this makes things easier by allowing you to launch the Web Api and the Vue.js client from within Visual Studio by just running the project. I found its functionality to be spotty when used with .NET Core 2.x, however, after upgrading to .NET 5.0 and bump the Nuget package to the 5.0 version I encountered zero issues.
- I installed and configured the
using VueCliMiddleware;
app.UseEndpoints(endpoints => {
endpoints.MapControllers();
if (System.Diagnostics.Debugger.IsAttached)
{
endpoints.MapToVueCliProxy(
"{*path}",
new SpaOptions { SourcePath = _spaSourcePath },
npmScript: "serve",
regex: "running at",
forceKill: true
);
}
else
{
endpoints.MapFallbackToFile("index.html");
}
});
- You can choose to not use this the way it is currently configured and instead launch the front-end and back-end independently and proxy requests to your specified port.
After cloning the repo, run this command. This will:
- Install Node dependencies from package.json
To start the app (development build), run this command. This will:
- Compile the app and run on the development server
- This will execute your unit tests located at
ClientApp/tests/unit
- they should follow the naming convention[name].spec.ts
. I have 7 tests already written and passing in there.
- This will execute your end-to-end integration Nightwatch tests located at
ClientApp/tests/e2e/specs
- Run the linter (configured in the tslint.json file found in the root of this project)
This script will:
- Build release Webpack bundles
A few of the ways to execute the tests contained within the project FullStackTestin.Web.Api.IntegrationTests:
- Run the CLI command
dotnet test
from within the FullStackTesting.Web.Api.IntegrationTests folder - If you have the
Open Command Line
Visual Studio extension installed you can right click FullStackTesting.Web.Api.IntegrationTests project when loaded in Visual Studio to launch the cmd/PowerShell prompt that way and proceed to rundotnet test
- From within Visual Studio (with the FullStackTesting.Web.Api.IntegrationTests project loaded) via Test/Run/[select option]