Specflow running with MSTest - mstest

I am using VS2013.
I am trying to run the *.dll from the MSTest, but it fails without any execution.
If I execute the same test case manually, it always pass.
Below is the command line execution lines:
c:>"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest" /testcontainer:"E:\E_Drive\TFS_Work\PlatformSoftware\Embedded\AutomatedRe
gressionTests\Main\bin\Debug\YDOA.dll" /category:"TRLYS1D"
Microsoft (R) Test Execution Command Line Tool Version 12.0.21005.1
Copyright (c) Microsoft Corporation. All rights reserved.
Loading E:\E_Drive\TFS_Work\PlatformSoftware\Embedded\AutomatedRegressionTests\Main\bin\Debug\YDOA.dll...
Starting execution...
Results Top Level Tests
------- ---------------
Failed YDOA.InputOutputFeature.RelayAndRelayFdbkAsUsedNormalAndFALSEAndTRUE_01
Failed YDOA.InputOutputFeature.RelayAsUnusedNormalAndALLRelaysTRUE
0/2 test(s) Passed, 2 Failed
Summary
Test Run Failed.
Failed 2
Total 2
Results file: c:\TestResults\Admin_GE-6QSVBDRLU204 2015-07-08 16_10_38.trx
Test Settings: Default Test Settings
I have the reference "Microsoft.VisualStudio.QualityTools.UnitTestFramework" in my project.
mentioned is my AppConfig.
<specFlow>
<unitTestProvider name="MsTest"/>
<stepAssemblies>
In the SpecFlow - "Test Runner Tool", I have tried with all the options like : AUTO, ReSharper, VS2010MStest, VS2012, SpecRun....still I have the same problem.
I could not able to understand the problem.
Thanks,
Sai

Related

SSIS Custom Task Error - Code: 0xC001F02A Source: Package Description: Cannot create a task from XML for task

I am trying to create a custom package. I made a simple test package, to send an email using outlook interop. I was able to get the task to show up in the ssis toolbox by switching the server version to 2012. however I get the following error when trying to run it in vs on my local machine,
Error: 0xC0010026 at Custom Task: The task has failed to load. The
contact information for this task is "".
I then tried to run it in dtexec to see if i could get more information.
Microsoft (R) SQL Server Execute Package Utility Version 11.0.7001.0
for 32-bit Copyright (C) Microsoft Corporation. All rights reserved.
Started: 3:53:50 PM Error: 2021-01-14 15:53:50.27 Code: 0xC001F02A
Source: Package Description: Cannot create a task from XML for
task "Custom Task", type "SSISCustomTaskLibrary.CustomTaskTest,
SSISCustomTaskLibrary, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=4fdef094ddc47664" due to error 0x80070057 "The
parameter is incorrect.". End Error Error: 2021-01-14 15:53:50.27
Code: 0xC0010018 Source: Custom Task Description: Failed to
load task "Custom Task", type "". The contact information for this
task is "". End Error Error: 2021-01-14 15:53:50.28 Code:
0xC0010026 Source: Custom Task Description: The task has failed
to load. The contact information for this task is "". End Error Error:
2021-01-14 15:53:50.28 Code: 0xC0024107 Source: Custom Task
Description: There were errors during task validation. End Error
Error: 2021-01-14 15:53:50.28 Code: 0xC0010025 Source: Package
Description: The package cannot execute because it contains tasks that
failed to load. End Error DTExec: The package execution returned
DTSER_FAILURE (1). Started: 3:53:50 PM Finished: 3:53:50 PM Elapsed:
0.109 seconds
so I fiddled some more and found that if after I loaded the task I switched back to 2019, task disappeared from the toolbox but it ran successfully. however the properties were not working and show an error for every property. I took a screenshot and added it to the project which is located here, https://github.com/w-storey/SSISCustomTaskTestSolution.git
I am using visual studio 2019 with the data tools installed. I added the dll to the gac using these commands
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8
Tools\gacutil" /u SSISCustomTaskLibrary "C:\Program Files
(x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\gacutil" /iF
"\source\repos\Tests\SSISCustomTaskTestSolution\SSISCustomTaskLibrary\bin\Release\SSISCustomTaskLibrary.dll"
copy
"\source\repos\Tests\SSISCustomTaskTestSolution\SSISCustomTaskLibrary\bin\Release\SSISCustomTaskLibrary.dll"
"C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Tasks"
so the question is how can I get this task custom task to work?

dotMemory Unit Standalone launcher with XUnit hang at the end of the test

I am using dotMemory Unit Standalone launcher on a gitlab CI server to lauch XUnit unit test.
The test succeed but the process hang at the end then the test is considered failed because it hit the timeout.
The test output the result before getting stuck
testing Test.Memory...
$ output\memorytools\dotMemoryUnit output\xunit.console.exe --work-dir=output --propagate-exit-code --no-instrumentation --no-auto-cleanup --no-updates --log-level=VERBOSE -- UbikeyOfficeVerticalUiTest.dll -namespace %TestNamespace% -html test_results.html -verbose -stoponfail
dotMemory Unit 3.0 part of 2017.3 build 111.0.20171219.95427. Copyright (C) 2015-2017 JetBrains s.r.o.
xUnit.net Console Runner (64-bit Desktop .NET 4.0.30319.42000)
Discovering: Test
Discovered: Test
Starting: Test
...
(test log)
...
Finished: Test
=== TEST EXECUTION SUMMARY ===
Test Total: 1, Errors: 0, Failed: 0, Skipped: 0, Time: 7.243s
I use the folowing command in the gitlab-ci.yml to lauch the test
'output\memorytools\dotMemoryUnit output\xunit.console.exe --work-dir=output --propagate-exit-code --no-instrumentation --no-auto-cleanup --no-updates --log-level=VERBOSE -- Test.dll -namespace %TestNamespace% -html test_results.html -verbose -stoponfail'
The output folder contains the xunit.console executable and the test dll and it's dependencies. the memorytools folder containt everything from the tool folder of the JetBrains.dotMemoryUnit nuget package
The test is just:
[Retry]
public void TestImageMemoryLeak()
{
true.ShouldBeTrue();
}
There is no problem when lauching test with Xunit without dotMemory.
Also the test do not hang when I lauch it with dotmemory localy on my computer.
Version used:
JetBrains.dotMemoryUnit 3.0.20171
xunit.runner.console 2.4.1
GitLab Community Edition 11.4.5

Why Opencover with MSTest does not execute and says "access is denied"?

I am using open cover with MSTest.
I am a new users and trying to get hang of Opencover.
I have tried with MSTest and MSTest is working fine with my new project in Vs2010. When I am executing following test using MStest it is working fine:
Command line run of MS Test :
MSTest /testmetadata:VoterDetails.vsmdi /testlist:DOBTest
Result:
C:\Users\<<MYuserName>>\Documents\Visual Studio 2010\Projects\VoterDetails>
MSTest /testmetadata:VoterDetails.vsmdi /testlist:DOBTest
Microsoft (R) Test Execution Command Line Tool Version 10.0.30319.1 Copyright (c) Microsoft Corporation. All rights reserved.
Loading VoterDetails.vsmdi...
Starting execution...
Results Top Level Tests
------- ---------------
Passed (DOBTest/)UT_voterDOB.VoterValidationTest.validateVoterDOB
Test
1/1 test(s) Passed
Summary
-------
Test Run Completed.
Passed 1
---------
Total 1
Results file: C:\Users\<<MYuserName>>\Documents\Visual Studio 2010\Projects\VoterDetails\TestResults\<<MYuserName>>.trx
Test Settings: Local
But When I am executing following command then I am getting following result:
I am posting all combinations I have tried:
C:\Users\<<MyUserName>>\AppData\Local\Apps\OpenCover>OpenCover.Console.exe
-register:user
-target:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe"
-targetargs:"/testmetadata:VoterDetails.vsmdi /testlist:DOBTest"
-filter:+[VoterDetails]*
Access is denied.
C:\Users\<<MyUserName>>\AppData\Local\Apps\OpenCover>OpenCover.Console.exe
-register:-arch:32
-target:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe"
-targetargs:"/testmetadata:VoterDetails.vsmdi /testlist:DOBTest"
-filter:+[VoterDetails]* -output:coverage.xml
Access is denied.
C:\Users\<<MyUserName>>\AppData\Local\Apps\OpenCover>OpenCover.Console.exe
-target:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe"
-targetargs:"/testmetadata:VoterDetails.vsmdi /testlist:DOBTest"
-filter:+[VoterDetails]*
-output:coverage.xml
-mergebyhash
Access is denied.
How will MSTEST know where to find VoterDetails.vsmdi when you are running in the wrong folder; try running from OpenCover from
C:\Users\<<MYuserName>>\Documents\Visual Studio 2010\Projects\VoterDetails
i.e.
C:\Users\<<MyUserName>>\AppData\Local\Apps\OpenCover>OpenCover.Console.exe -register:user ...
also -arch:32 is not a valid option for OpenCover

How to integrate NCover and MSTest 10.0?

Using NCover Community edition, I tried:
set ncover="C:\Program Files (x86)\NCover\NCover.Console.exe"
set mstest="C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe"
set testdllfolder="C:\.hudson\jobs\Project\workspace\src\TestProject\bin\Debug"
%ncover% //x coverage.xml //w %testdllfolder% %mstest% /noisolation /testcontainer:TestProject.dll
The output begins like this
Working Directory:
Assemblies:
Coverage Xml: C:.hudson\jobs\Project\workspace\src\coverage.xml
Coverage Log: Coverage.Log
Waiting for profiled application to connect...Microsoft (R) Test Execution Command Line Tool Version 10.0.30319.1
and after the MSTest output
Test Run Failed.
Passed 8
Failed 2
Inconclusive 2
Total 103
Results file: C:.hudson\jobs\Project\workspace\src\debug.trx
Test Settings: Local
Connected
Profiled process terminated. Profiler connection not established.
How to fix that?
Can you post the console output to your message? That'd tell if the session completed successfully. It could be that the coverage xml isn't showing because it's going to a directory other than the one you think it should. It's default is the current command prompt directory.
Also, you may want to try using the latest edition of NCover, v.3.4.16. You can get a 21-day trial for free at www.ncover.com/download.

Build VS2010 solution on Team Build 2008 - MSTest failed to run

I have a weird problem while building VS2010 solution incl. unit tests on a Team Build 2008 server. It builds the solution and also can run the test without an error, but after running the test I get following warning which makes the build breaking:
MSBUILD : warning MSB6003: The
specified task executable "MSTest.exe"
could not be run. The system cannot
find the file specified
[C:\data\builds\FSuite\CI_Project[Debug]\BuildType\TFSBuild.proj]
The previous error was converted to a
warning because the task was called
with ContinueOnError=true. Build
continuing because "ContinueOnError"
on the task "TestToolsTask" is set to
"true".
It does not seem to be the problem that MSTest have not been found, I also checked if the TFSBuild.proj file is on this localtion - it is not missing. So what could it be?
Edit:
In meantime I figured out, that our old build server loaded and start the test assemblies once.
Task "TestToolsTask" Command:
C:\Program Files\Microsoft Visual
Studio 9.0\Common7\IDE\MSTest.exe
/nologo
/runconfig:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Sources\Sources\Products\FSuite.Debug.testrunconfig"
/searchpathroot:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug"
/resultsfileroot:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\TestResults"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.AppConfiguration.Console.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.Common.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.Common.UI.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.Dbms.Handler.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Base.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.BusinessObjects.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Client.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Client.UI.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Enums.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Messages.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Reporting.ReportPackage.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Reporting.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.MasterStation.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.MonitoringStation.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Pac.ProductInspection.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Pac.XmlRpcProtocol.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Server.DomainLayer.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Server.Licensing.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Server.NotificationLayer.Tests.Unit.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Tests.Unit.Ext.dll"
/testcontainer:"C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Tests.Unit.Joint.dll"
/publish:"http://ch06sd01:8080/"
/publishbuild:"V1.0_CI_FSuite[Debug]_20100728.4"
/teamproject:"FSuite" /platform:"x86"
/flavor:"Debug" The
"TestToolsTask" task is using
"MSTest.exe" from "C:\Program
Files\Microsoft Visual Studio
9.0\Common7\IDE\MSTest.exe". Loading C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Sources\Sources\Products\FSuite.Debug.testrunconfig...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.AppConfiguration.Console.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.Common.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.Common.UI.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.Dbms.Handler.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Base.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.BusinessObjects.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Client.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Client.UI.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Enums.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Messages.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Reporting.ReportPackage.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Reporting.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.MasterStation.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.MonitoringStation.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Pac.ProductInspection.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Pac.XmlRpcProtocol.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Server.DomainLayer.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Server.Licensing.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Server.NotificationLayer.Tests.Unit.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Tests.Unit.Ext.dll...
Loading
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Tests.Unit.Joint.dll...
Starting execution...
Results...
2387/2387 test(s) Passed
Summary ------- Test Run Warning.
Passed 2387
------------
Total 2387 Results file: C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\TestResults\ch06-tfsservice_CH06WL2013302
2010-07-28 11_08_03_x86_Debug.trx
Run Configuration: FSuite Debug
Testconfig
Run has the following issue(s): Code coverage instrumentation warning
while processing file
MT.FSuite.Joint.Enums.dll:
TESTTOOLSTASK : warning VSP2007:
C:\data\builds\FSuite\V1.0_CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Joint.Enums.dll
contains no instrumentable code.
TESTTOOLSTASK : warning : Test Run
deployment issue: The assembly or
module
'DevExpress.RichEdit.v10.1.Core'
directly or indirectly referenced by
the test container
'c:\data\builds\fsuite\v1.0_ci_fsuite[debug]\binaries\x86\debug\mt.fsuite.tests.unit.ext.dll'
was not found. Waiting to publish...
Publishing results of test run
ch06-tfsservice#CH06WL2013302
2010-07-28 11:08:03_x86_Debug to
http://ch06sd01:8080/Build/v1.0/PublishTestResultsBuildService2.asmx...
................................Publish
completed successfully. Done executing
task "TestToolsTask".
But the new build server with VS2010 loads all test assemblies except the MT.FSuite.Tests.Unit.Joint.dll and executes the tests, which run successfully, afterwards MSTest get called again with the mentioned assembly and failes.
Command: MSTest.exe /nologo
/runconfig:"C:\data\builds\FSuite\CI_FSuite[Debug]\Sources\Sources\Products\FSuite.Debug.testrunconfig"
/searchpathroot:"C:\data\builds\FSuite\CI_FSuite[Debug]\Binaries\x86\Debug"
/resultsfileroot:"C:\data\builds\FSuite\CI_FSuite[Debug]\TestResults"
/testcontainer:"C:\data\builds\FSuite\CI_FSuite[Debug]\Binaries\x86\Debug\MT.FSuite.Tests.Unit.Joint.dll"
/publish:"http://ch06sd01:8080/"
/publishbuild:"CI_FSuite[Debug]_20100728.2"
/teamproject:"FSuite" /platform:"x86"
/flavor:"Debug" The
"TestToolsTask" task is using
"MSTest.exe" from "MSTest.exe".
I wonder why, because the test container string did not change and furthermore the second time it does not say anymore from where it gets the MSTest.exe...
Thanks for help,
Eny
OK, I've found the source of the problem. The TeamBuild targets file (C:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets) has a wrong value - replace the following:
<UsingTask TaskName="TestToolsTask"
AssemblyFile="$(MSTestRefPath)\Microsoft.VisualStudio.QualityTools.MSBuildTasks.dll"
Condition="'$(ProjectFileVersion)' == '2'" />
(the last UsingTask at line 82 if you haven't edited the file already) with:
<UsingTask TaskName="Microsoft.TeamFoundation.Build.Tasks.TestToolsTask"
AssemblyFile="C:\Program Files\Microsoft Visual Studio
10.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Build.ProcessComponents.dll"
Condition=" '$(ProjectFileVersion)' == '2' "/>
This fixed it for me, and now my build lights are all green.

Resources