TGIMBA .NET Core Upgrade – Part 8 – Continuous Integration / Continuous Deployment – Part 3 – Building On Visual Studio Team Services Continued – Tests and more (pre-deploy)

Git  Code Commit 1

Git  Code Commit 2

Welcome back!

This post picks up in the next step of automating The Globe In My Bucket List Application (TGIMBA) into a Continuous Integration/Continuous Deployment (CICD) pipeline. I have chosen Visual Studio Team Services (VSTS) since (in my experience) the .NET ecology is easier to use on Microsoft provided platforms. Besides offering really cool tools, it makes learning really easy and cheap (i.e. free). Amazon offers similar services on their platform. However, replicating what Microsoft offers for .NET Core technologies seems easier on VSTS.

In the last post, I created a TGIMBA .NET Core team project, hooked it up to the TGIMBA git repository (i.e. https://github.com/ehelin/TGIMBANetCore) and the out of the box functionality did a nuget restore, built the solution and ran the .NET Core tests. However, it failed after that moment.

The error:

System.IO.FileNotFoundException: Unable to find tests for D:\a\1\s\API\bin\Release\netcoreapp2.0\TestsDAL.dll. Make sure test project has a nuget reference of package “Microsoft.NET.Test.Sdk” and framework version settings are appropriate. Rerun with /diag option to diagnose further.

The part I did not understand is that the tests in that project ran successfully. Plus, the error was thrown multiple times. The summarized output:


Starting test execution, please wait…
Error == > System.IO.FileNotFoundException: …
Passed LoginDemoUserTest
Passed RunApiIntegrationTest
Error == > System.IO.FileNotFoundException: …
Passed TestLoggerMsg
Error == > System.IO.FileNotFoundException: …
Passed TestHomeControllerIndex
Passed TestWelcomeControllerIndex
Passed RunBucketListDataV1Tests
Passed RunBucketListDataV1Tests
Passed RunMemberShipDataTests
Error == > System.IO.FileNotFoundException: …

Total tests: Unknown. Passed: 11. Failed: 0. Skipped: 0

After some digging, I realized that I had made two mistakes. I was sharing a base class between test projects. Cloning the BaseTest.cs to the other project fixed this. I really believe code should only exist once.  But in this case, combining two separate test projects was a bad move.  I should have created a shared test project.  For now, I will live with the clone.  I also removed some related links (see git commit links at start of post). After making these changes, everything worked 🙂

Summary

1

Details
2

The next step is to look at the build and see if all of the files that I need are there. If you remember, there were two steps on the local .bat file. Building the solution AND publishing the website.

Looking at the out of the box build artifact:

  • On VSTS

3

Once downloaded, the directory chain was a bit complicated.  Specifically:

  • Expanding build artifact

4

  • Expanding web build inside build artifact

5

  • Finding the deploy files (compared with local publish output)

6

Good news is the VSTS files match the local publish files.  All I have to do now is figure out how to account for the node_modules directory (not present in the deploy files) and then how to deploy to my production site.

I will either need to capture the node_modules directory from the VSTS npm install or do another.

Stay Tuned!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s