nunit-console hangs in remote powershell session after finishing test run - powershell

I'm running NUnit tests using the following PS line:
& 'D:\tools\nunit-console.exe' D:\MyApplication.Specs.dll /run=MyApplication.MyTest /framework=net-4.5 /nothread
This line is working fine.
After that I'm running the same test in remote session on the same PC with following line:
Invoke-Command -ComputerName MyHost -ScriptBlock { & 'D:\tools\nunit-console.exe' D:\MyApplication.Specs.dll /run=MyApplication.MyTest /framework=net-4.5 /nothread } -credential MyUser
After the test execution is finished nunit-console hangs with following output:
NUnit-Console version 2.6.3.13283
Copyright (C) 2002-2012 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.
Runtime Environment -
OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
CLR Version: 2.0.50727.5477 ( Net 3.5 )
ProcessModel: Default DomainUsage: Single
Execution Runtime: net-4.5
Selected test(s): MyApplication.MyTest
.
Tests run: 1, Errors: 0, Failures: 0, Inconclusive: 0, Time: 6.96245315227513 seconds
Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0
I have noticed nunit-agent process in task manager. If I kill this process test execution is finished successfully.

The tests are running in separate manually created ASP.NET application domain via Remoting. The solution is to unload this app domain when all tests are passed. Global NUnit TearDown method is useful in this case :)

Related

Facing issue while running my first C program in VS Code

I have written my first C program and while running facing problem,Below is the code.
#include<stdio.h>
void main()
{
printf("Hello World");
}
While running the program getting below warning in terminal.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
Warning: PowerShell detected that you might be using a screen reader and has disabled PSReadLine for compatibility purposes. If you want to re-enable it, run 'Import-Module PSReadLine'.
PS D:\C_Program> & 'c:\Users\azhar.vscode\extensions\ms-vscode.cpptools-1.11.5-win32-x64\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-kultbrgv.bxw' '--stdout=Microsoft-MIEngine-Out-tvw2mt1p.wdr' '--stderr=Microsoft-MIEngine-Error-lhguvkjt.xrj' '--pid=Microsoft-MIEngine-Pid-vho11bhr.z5a' '--dbgExe=C:\MinGW\bin\gdb.exe' '--interpreter=mi'
PS D:\C_Program>
enter image description here

Display passed tests while they run with latest NUnit3TestAdapter version 4+

I'm having a silly problem, with Nunit3TestAdapter version 3 under dotnet 5, I could see tests while they were passing, with the execution time detailed, the "Passed Test1" in the following transcript, as long as verbosity was set to at least normal:
$ dotnet test -v normal
[...]
NUnit Adapter 3.17.0.0: Test execution complete
Passed Test1 [21 ms]
Passed Test2 [< 1 ms]
Test Run Successful.
Total tests: 2
Passed: 2
I recently upgraded to dotnet 6 and nunit adapter 4.2.0, and now I'm unable to display the detailed output, even with the higher (detailed) verbosity:
$ dotnet test -v detailed
[...]
Test run for /tmp/nunit-repro/bin/Debug/net6.0/nunit-repro.dll (.NETCoreApp,Version=v6.0)
Microsoft (R) Test Execution Command Line Tool Version 17.0.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Passed! - Failed: 0, Passed: 2, Skipped: 0, Total: 2, Duration: 24 ms - /tmp/nunit-repro/bin/Debug/net6.0/nunit-repro.dll (net6.0)
I've been looking around for some time now and cannot find a relevant configuration option. Am I missing something?
Having integration test suites made of hundreds of tests and taking several minutes to pass, it's quite frustrating to have no visual progress whatsoever, not knowing if things are running or hanging.
Someone found the solution for me, add -l "console;verbosity=detailed":
dotnet test -l "console;verbosity=detailed"

Can't run stock SF Container out of the box on local cluster

I created a stock out of the box VS2019 Azure Service Fabric Container app. It and every other Service Fabric app won't run on the local cluster. I get this:
1>------ Build started: Project: ServiceFabricContainer, Configuration: Debug x64 ------
2>------ Publish started: Project: ServiceFabricContainer, Configuration: Debug x64 ------
2>Started executing script 'GetApplicationExistence'.
2>Finished executing script 'GetApplicationExistence'.
2>Time elapsed: 00:00:00.5863836
-------- Package started: Project: ServiceFabricContainer, Configuration: Debug x64 ------
ServiceFabricContainer -> C:\dev\ServiceFabricContainer\pkg\Debug
-------- Package: Project: ServiceFabricContainer succeeded, Time elapsed: 00:00:00.2741254 --------
2>Started executing script 'Deploy-FabricApplication.ps1'.
2>powershell -NonInteractive -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command ". 'C:\dev\ServiceFabricContainer\Scripts\Deploy-FabricApplication.ps1' -ApplicationPackagePath 'C:\dev\ServiceFabricContainer\pkg\Debug' -PublishProfileFile 'C:\dev\ServiceFabricContainer\PublishProfiles\Local.1Node.xml' -DeployOnly:$false -ApplicationParameter:#{} -UnregisterUnusedApplicationVersionsAfterUpgrade $false -OverrideUpgradeBehavior 'None' -OverwriteBehavior 'SameAppTypeAndVersion' -SkipPackageValidation:$false -ErrorAction Stop"
2>Copying application to image store...
2>Upload to Image Store succeeded
2>Registering application type...
2>Register application type started. Use Get-ServiceFabricApplicationType to query for status.
2>Running Image Builder process ...
2>Application package is registered.
2>Removing application package from image store...
2>Remove application package succeeded
2>Creating application...
2>New-ServiceFabricApplication : Repository Credentials for Account Name:sgentile cannot have a blank password if you
2>have PasswordEncrypted set to True or Type set to Encrypted/SecretsStoreRef.
2>At C:\Program Files\Microsoft SDKs\Service
2>Fabric\Tools\PSModule\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1:358 char:9
2>+ New-ServiceFabricApplication -ApplicationName $ApplicationNam ...
2>+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2> + CategoryInfo : InvalidOperation: (Microsoft.Servi...usterConnection:ClusterConnection) [New-ServiceFabr
2> icApplication], FabricException
2> + FullyQualifiedErrorId : CreateApplicationInstanceErrorId,Microsoft.ServiceFabric.Powershell.NewApplication
2>
2>Finished executing script 'Deploy-FabricApplication.ps1'.
2>Time elapsed: 00:00:09.7611521
2>The PowerShell script failed to execute.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
Help please!
The answer is right in the error information. I just needed to have a non blank password. It works now.

Chain psexec and nunit is not working (psexec exit with code 1 and nunit is crashed)

Sorry for unclear subject but i really don't understand where problem.
I use a system for autotests c#+webdriver for chrome + nunit (2.6) + cc.net ( 1.6.7981.1)
And my tests is run on remote machine (Windows XP SP 2 x86)via psexec which start bat file on remote machine
bat file includes 2 commands:
run msbuild
run nunit-console
Well, psexec has next arguments
/accepteula \MachineName -u Login -p Pass -s Path\start.bat
Bat file has next command
nunit-console-x86.exe "%PROJECT_FOLDER%\Path\Tests.dll" "/xml=%TEST_RESULT_PATH%"
When cc.net launch psexec tests is started and the tests work during some time. Unexpected, psexec exit with code 1
message level="Error">Path\start.bat exited on MachineName with error code 1. message
But nunit-console on remote machine is continue working
And after some time console is crashed with error
szAppName : nunit-console-x86.exe szAppVer : 2.6.0.12051
szModName : kernel32.dll szModVer : 5.1.2600.2180 offset :
0001eb33
Message from Event log
Application: nunit-console-x86.exe Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.IOException Stack: at
System.IO._Error.WinIOError(Int32, System.String) at
System.IO._ConsoleStream.Write(Byte[], Int32, Int32) at
System.IO.StreamWriter.Flush(Boolean, Boolean) at
System.IO.StreamWriter.Write(Char[], Int32, Int32) at
System.IO.TextWriter.WriteLine(System.String) at
System.IO.TextWriter.WriteLine(System.String, System.Object) at
System.IO.TextWriter+SyncTextWriter.WriteLine(System.String,
System.Object) at System.Console.WriteLine(System.String,
System.Object) at NUnit.ConsoleRunner.Runner.Main(System.String[])
at NUnit.ConsoleRunner.Class1.Main(System.String[])
If run nunit locally than no problem(nunit-console works fun).
Some time ago system worked, and i don't know what is changed (This is most bad case)
How can i resolve this problem?
Thanks!
This problem is resolved!
Now system is working

Another PartCover Empty Report Question

I've tried the steps listed here, but I still can't get partcover to generate any output other than:
<?xml version="1.0" encoding="utf-8"?>
<PartCoverReport ver="2.2.0.36423" />
Here is what I've done:
Installed 2.2 instead of 2.3
Ran corflags /Force /32bit+ PartCover.exe
Ran corflags /Force /32bit+ PartCover.browser.exe
Here is my command line:
partcover --target nunit-console-x86.exe --target-args unittests.dll --include +[*]* --output c:\temp\out.txt
When I run that command, here is the output I get:
Start target
Wait results
NUnit version 2.5.0.9117 (RC)
Copyright (C) 2002-2008 Charlie Poole.\r\nCopyright (C) 2002-2004 James W. Newki
rk, Michael C. Two, Alexei A. Vorontsov.\r\nCopyright (C) 2000-2002 Philip Craig
.\r\nAll Rights Reserved.
Runtime Environment -
OS Version: Microsoft Windows NT 6.0.6002 Service Pack 2
CLR Version: 2.0.50727.4200 ( Net 2.0.50727.4200 )
ProcessModel: Default DomainUsage: Single
Execution Runtime: net-2.0.50727.4200
.Gendarme v2.4.0.0
Copyright (C) 2005-2009 Novell, Inc. and contributors
Initialization: 1.1 seconds
unittests.dll: 2.4 seconds
One assembly processed in 3.5 seconds.
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
.................................
Tests run: 1076, Errors: 0, Failures: 0, Inconclusive: 0 Time: 19.071907 seconds
Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0
Walk results
Does anyone have any suggestions that might help? Thank you!
OK, here is what I did to fix the problem, in addition to the steps above:
Add a settings file: settings.xml
<PartCoverSettings>
<Target>nunit-console-x86.exe</Target>
<TargetArgs>unittests.dll</TargetArgs>
<Rule>+[*]*</Rule>
</PartCoverSettings>
Run with this command line:
partcover --settings settings.xml --output out.xml
And that produces an XML file.
I also didn't need to downgrade to 2.2. 2.3 seems to work fine for me now...