Chutzpah 4.4.11 failing with exit code 2 when running with vstest - automated-tests

vstest.console.exe 16.10 works with Chutzpah 4.2.3. But upgraded to Chutzpah 4.4.11, and it fails with exit code of 2. chutzpah.console.exe also works by itself in 4.4.11, so I'm not sure if I'm missing something in the vstest command line. (I get the same results with vstest.console.exe when running from an Azure DevOps pipeline.)
Any suggestions?
> "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe"
"[path-to-test-file]\index-tests.js"
/TestAdapterPath:"C:\Users\TFSBuild\.nuget\packages\chutzpah\4.4.11\tools"
Microsoft (R) Test Execution Command Line Tool Version 16.10.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Error: Unknown error occurred when executing test file. Received exit code of 2
While Running:[path-to-test-file]\index-tests.js
No test is available in [path-to-test-file]\index-tests.js.
Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
Test Run Failed.

Found the solution. I'm using Engine: Chrome, and the newer version of Chutzpah was failing to find chrome.exe. Defining the path to the exe in Chutzpah.json resolved the issue.
"Engine": "Chrome",
"EngineOptions": {
"ChromeBrowserPath": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
}

Related

Dotnet test questions on errors

I am working on Azure pipelines, running on a Windows self-hosted agent, behind a firewall to run automated tests.
I would want to see the tests results and code coverage in the pipeline results in Azure. My build pipelines are working but I never saw yet the results of automated tests so I'm not sure of what to expect.
I run this in my pipeline:
- job: Test
steps:
- task: NuGetAuthenticate#0
- task: DotNetCoreCLI#2
inputs:
command: test
projects: 'src/***.Test.Core/*.csproj'
testRunTitle: '***Tests'
arguments: '--collect "Code coverage"'
publishTestResults: true
Here are extracts of the logs, with my questions and comments:
Initialization of proxies and general stuff
##[debug]Agent.ProxyUrl=http://***proxy.***.***:443
##[debug]Agent.ProxyBypassList=["***.***,localhost,127.0.0.1","***.***","localhost","127.0.0.1"]
##[debug]Agent.CAInfo=*:\***Certificates\***PKIG2PEM.txt
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]command=test
##[debug]projects=src/***.Test.Core/*.csproj
##[debug]arguments=--collect "Code coverage"
##[debug]publishWebProjects=true
##[debug]workingDirectory=*:\Agent\_work\24\s
##[debug]check path : *:\Agent\_work\_tasks\DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b\2.179.2\node_modules\packaging-common\module.json
##[debug]adding resource file: *:\Agent\_work\_tasks\DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b\2.179.2\node_modules\packaging-common\module.json
Not sure what is CHCP but tests are run, with errors I believe linked to firewall so I'd expect to see those errors in the tests results
[command]C:\Windows\system32\chcp.com 65001
##[debug]publishTestResults=true
##[debug]Agent.TempDirectory=*:\Agent\_work\_temp
##[debug]defaultRoot: '*:\Agent\_work\_temp'
##[debug]pattern: '**/*.trx'
Results File: E:\Agent\_work\_temp\***_***_2020-12-17_16_13_24.trx
Attachments:
*:\Agent\_work\_temp\d992768e-f36f-4558-9b52-f42fc7cd3c74\***_***_2020-12-17.16_13_16.coverage
Failed! - Failed: 29, Passed: 0, Skipped: 0, Total: 29, Duration: 3 s - OECD.Glue.Contacts.API.Test.Core.dll (netcoreapp3.1)
Errors when pushing the results, what means "Failed to get FF TestManagement.Server.UsePublishTestResultsLibInAgent Value." ?
##[debug]Exit code 1 received from tool 'C:\Program Files\dotnet\dotnet.exe'
##[debug]STDIO streams have closed for tool 'C:\Program Files\dotnet\dotnet.exe'
##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
##[debug]Processed: ##vso[task.issue type=error;]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
##[debug]BuildConfiguration=undefined
##[debug]BuildPlatform=undefined
##[debug]testRunTitle=***Tests
##[debug]adjustedPattern: '*:\Agent\_work\_temp\**/*.trx'
##[debug]Failed to get FF TestManagement.Server.UsePublishTestResultsLibInAgent Value.
Unable to get the FF: TestManagement.Server.EnablePublishToTcmServiceDirectlyFromTask. Reason: One or more errors occurred. (Moved Temporarily)
Failed to get FF TestManagement.PTR.CalculateTestRunSummary, what is CalculateTestRunSummary ?
##[debug]Failed to get FF TestManagement.PTR.CalculateTestRunSummary Value.
##[debug]Reading test results from file '*:\Agent\_work\_temp\***_***_2020-12-17_16_13_24.trx'
##[debug]Processed: ##vso[results.publish type=VSTest;mergeResults=false;runTitle=GlueContactsTests;publishRunAttachments=true;resultFiles=*:\Agent\_work\_temp\*_***_2020-12-17_16_13_24.trx;testRunSystem=VSTS - dotnet;]
I wonder what to do with these warnings, I don't know much about Dotnet core and Nuget, my job is only the pipeline, not the underlying project. In project settings, I see .Net Core 3.1, I don't understand where to look to find if I use Nuget version < 5.7 and if this warning applies to me
##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build
##[debug]Processed: ##vso[task.issue type=warning;].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) Use global.json using an older sdk version(<=3) to build
##[debug]task result: Failed
Then I have this, publish test results ends with Moved Temporarily, I'm guessing this is because of firewall, still, I did setup the proxy and other calls to Azure seems to work, what could be the issue ?
##[error]Dotnet command failed with non-zero exit code on the following projects : *:\Agent\_work\24\s\src\***.Test.Core\***.Test.Core.csproj
##[debug]Processed: ##vso[task.issue type=error;]Dotnet command failed with non-zero exit code on the following projects : E:\Agent\_work\24\s\src\***.Test.Core\***.Test.Core.csproj
##[debug]Processed: ##vso[task.complete result=Failed;]Dotnet command failed with non-zero exit code on the following projects : E:\Agent\_work\24\s\src\***.Core\***.Test.Core.csproj
##[section]Async Command Start: Publish test results
##[warning]Failed to publish test results: Moved Temporarily
##[section]Async Command End: Publish test results
##[section]Finishing: DotNetCoreCLI
Thanks for any help, Claude
Update 1 ---------------------------------
Thank you.
I understood that my version of DotNet Core on the agent is not good,
the agent has version 5 while the project references version 3.1.
I added this task :
- task: UseDotNet#2
inputs:
packageType: 'sdk'
version: '3.1.x'
But I am behind a firewall, still I have these logs:
##[debug]agent.proxyurl=http://***proxy.***.***:443
##[debug]agent.proxyusername=undefined
##[debug]agent.proxypassword=undefined
##[debug]agent.proxybypasslist=["***.***,localhost,127.0.0.1","***.***","localhost","127.0.0.1"]
##[debug]agent.proxybypasslist=["***.***,localhost,127.0.0.1","***.***","localhost","127.0.0.1"]
##[debug]AZURE_HTTP_USER_AGENT=VSTS_c11775e3-cd05-4e03-abd2-35da98ef2f0f_build_164_0
Tool to install: .NET Core sdk version 3.1.x.
##[debug]task result: Failed
##[error]Failed to download or parse releases-index.json with error: {"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"}
Would it be best to install this version locally ? In that case, would I have to do something special so it uses the correct version ?
Update 2 ---------------------------------
Thanks for that link to a known issue. I noticed that issue doesn't mention an error I have: {"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"}
Can it be that the task tries to reach 'https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.1/releases.json' but can't as we are behind a firewall ??
I don't understand why it tries to install DotNet Core as it is already installed but I don't know much about DotNet Core, I am only trying to run automated tests.
My last test included:
- task: NuGetAuthenticate#0
displayName: 'Authenticate with NuGet'
- task: UseDotNet#2
inputs:
packageType: 'sdk'
version: '3.1.101'
installationPath: '$(Agent.ToolsDirectory)/dotnet'
- task: DotNetCoreCLI#2
inputs:
command: test
projects: 'src/myProject.Test.Core/*.csproj'
testRunTitle: 'myProject'
arguments: '--collect "Code coverage"'
publishTestResults: true
Logs contains:
##[debug]agent.proxyurl=http://proxy.myCie.com:443
##[debug]agent.proxyusername=undefined
##[debug]agent.proxypassword=undefined
##[debug]agent.proxybypasslist=["myCie.com,localhost,127.0.0.1","myCie.com","localhost","127.0.0.1"]
##[debug]agent.proxybypasslist=["myCie.com,localhost,127.0.0.1","myCie.com","localhost","127.0.0.1"]
##[debug]AZURE_HTTP_USER_AGENT=VSTS_xxx_build_173_0
Tool to install: .NET Core sdk version 3.1.101.
##[debug]task result: Failed
##[error]Failed to download or parse releases-index.json with error: {"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"}
##[debug]Processed: ##vso[task.issue type=error;]Failed to download or parse releases-index.json with error: {"code":"UNABLE_TO_GET_ISSUER_CERT_LOCALLY"}
##[section]Finishing: UseDotNet
Thanks for any help
I think this is similar to GitHub issue #10969. It has something to do with internal GitHub repo/url. This is because the version which we specify in the task is searched in releases-index file, which is accessible to public as well:
You could also check the releases-index.json
{
"channel-version": "3.1",
"latest-release": "3.1.10",
"latest-release-date": "2020-11-10",
"security": false,
"latest-runtime": "3.1.10",
"latest-sdk": "3.1.404",
"product": ".NET Core",
"support-phase": "lts",
"eol-date": "2022-12-03",
"releases.json": "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.1/releases.json"
},
In this case, I would recommend you to reopen the Issue #10969.

got error " The "RazorGenerate" task failed unexpectedly. " .After Updating to VS 16.8 and upgrade to .net 5.. the core version target is Core 2.2

When Build Project. Error The "RazorGenerate" task failed unexpectedly. .Net Core 2.2
The fix for me was to introduce a new System Environment Variable with the Key "DOTNET_HOST_PATH" and the value "dotnet" and then to restart Visual Studio.
I did 3 steps to get it to build AND to get the ( ~/ ) variable to work.
Open cmd and write this: setx DOTNET_HOST_PATH "%ProgramFiles%\dotnet\dotnet.exe"
Open C:\Program Files\dotnet\sdk in here delete the folder: NuGetFallbackFolder
Restart your pc!
It worked on the build server, after I added this Nuget package:
Microsoft.NET.Sdk.Razor
Since I added the Net.SDK.Razor package, it builds successfully.
I had also added Microsoft.AspNetCore.Razor.Design, but only Microsoft.NET.Sdk.Razor is actually needed.

basic_client which is built with Makefile BusAttachment::Connect failed

I just built standard core 15.09a on linux and run sample apps basic_client.
This one built by scons.
bin/samples/basic_client works fine.
However, I built cpp/samples/basic/basic_client with Makefile.
It does not work. It shows an error
"0.232 ****** ERROR ALLJOYN external ...e/src/BusAttachment.cc:560 | BusAttachment::Connect failed: ER_OS_ERROR
BusAttachment::Connect('') failed.".
So, I launched the bin/allhoyn-daemon, then no error occurred.
What is difference between scon and Makefile version?
Additionally, where can I get the information of application under the bin directory?
I searched the web-site of AllSeen and couldn't find any info.
As i know, the error that you got when build with Makefile happens because basic_client hasn't alljoyn router inside, with scons it runs fine because it compiles with BR=on and some flags:
-lajrouter -lBundledRouter.o -lssl -lcrypto
For more infomation, visit: here

Build.json Error: Package application for Android

Using Visual Studio RTM 2015 Blank Cordova (5.1.1) TypeScript project to test packaging applications for Android.
Following these instructions: https://github.com/Microsoft/cordova-docs/tree/master/tutorial-package-publish#android
Created the build.json and keystore.
When I publish (Release > Android > Device), I get the following error:
Reading build config file: D:\erase\BlankCordovaApp9\build.json
Command finished with error code 1: cmd /s /c "D:\erase\BlankCordovaApp9\platforms\android\cordova\build.bat --debug --buildConfig=D:\erase\BlankCordovaApp9\build.json"
ERROR building one of the platforms : error : cmd: Command failed with exit code 1
Are the instructions still accurate for 2015 RTM? Using the instructions I get Misssing a comma after an object member when using the suggested format in build.json.
Win 8.1

MbUnit tests pass when run directly from visual studio, but fails when run via command line

I've been using MbUnit for unit testing for a while, along with Nhibernate and Sqlite.
I am now trying to setup a CI server with Jenkins - I have successfully managed to configure Jenkins to pull the code from github and compile it using MSBuild everytime anyone pushes to github. Finally I want to run tests on the code on each successful build.
The tests all run successfully when run from within Visual Studio without any problem whatsoever, I can run each test individually or the whole project and they all run OK. However when I call Gallio.Echo.exe from command line all the tests that have to do with Sqlite fails.
This is what I've been doing to run the test from command line:
"C:\Program Files\Gallio\bin\Gallio.Echo.exe" /report-type:Html /verbosity:quiet "D:\MyProject\MyProject.Tests\bin\Debug\*.Tests.dll"
(ps: There seems to be absolutely no documentation about gallio tools - have I been looking in all the wrong palces? I want to find more about the command line arguments that I can pass)
The tests fail with this:
Gallio Echo - Version 3.3 build 454
Get the latest version at http://www.gallio.org/
Initializing the runtime and loading plugins.
Verifying test files.
Initializing the test runner.
Running the tests.
[failed] Fixture MyProject.Tests/VerificationTests
Set Up
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
---> NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
HResult: -2147024809
at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
at NHibernate.Driver.ReflectionBasedDriver..ctor(String providerInvariantName, String driverAssemblyName, String connectionTypeName, String commandTypeName)
at NHibernate.Driver.SQLite20Driver..ctor()
--- End of inner exception stack trace ---
I've tried a few solutions mentioned around on SO but haven't been able to solve it. The only close thing was this answer but I am not sure what the user means by adding to config files.
Anyone has any idea why the tests fail from command line but are okay when run from within VS please?
Thanks.

Resources