Running Mstest.exe without team foundation server. - visual-studio-2010

I want to run tests in comman line using mstest.exe. Here is the command which I am trying to execute
MSTest.exe /platform:[x64] "/testcontainer:D:\Dev\tas\Tests.dll" /resultsfile:"D:\Dev\TestResults.xml"
But everytime I am getting error.
No Build Uri specified for publish operation.
For switch syntax, type "MSTest /help"
I am not using any teamFoundation server. How do I run this?

The /platform command line option is actually related to the publishing, not test execution (as described at http://msdn.microsoft.com/en-us/library/ms182489(v=vs.100).aspx). When you specify at least one publishing option, MSTest validates that the minimum required set of publishing options have been supplied.
Since you don't really want to publish, simply getting rid of the /platform option should fix the problem.

Related

SVN commit using Jenkins

I recently created an automated process to run multi-step Maven builds for my organization. They now are looking to have the entire process automated using Jenkins. I have been able to successfully create branches, builds, change versions, etc., using Maven commands but I am having difficulty committing the version changes (1.0.1-Snapshot to 1.0.1-E1 for example) with Jenkins. I have tried using basic commands like:
SVN commit "Comments"
However, Jenkins does not seem to know what to do with these command lines in the "Execute Windows Batch File" Post Build option. I simply receive build failures caused by the batch file for "unknown reasons." I see the help desk I am working with has installed the Subversion plugin, but perhaps something else is missing. I know that when I use the command prompt locally I need to use something like this:
"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe"
/command:commit /path: /url:
However, Jenkins is hosted by a third party and I do not have direct access to the servers so I would not be able to implement that kind of path data. So I am now looking to see if I can run this, somehow, purely through Jenkins as my client requests.
Anyone have any success with SVN Commit to update version changes through Jenkins?
Thanks!
-Cameron
Why did you decide to run TortoiseProc via Jenkins? TortoiseProc is not the right tool for this task, use svn.exe client.
TortoiseProc can be used for TortoiseSVN's GUI automation, but this case is completely different to running Jenkins.

BDD Tests are not recognized in command level

I am trying to run Specflow BDD tets in command line and looks like it doesn't recognized those tests. But I am able to run them in VS IDE
Not sure whether there is a path issue.
I tried other options as in the below link as well. No luck though
How do you run SpecFlow scenarios from the command line using MSTest
The Problem was, that the code-behind files of the feature files were not generated properly, because the configuration of the unitTestProvider was missing.
See the documentation for that here: http://www.specflow.org/documentation/Configuration/

How to get the sonar-report.json file created with sonarqube?

I am runnig Sonarqube 5.3 and has integrated it with Jenkins. I want to post Sonareqube issues as Gerrit comments.
Then I need to specify the path to and name of the data generated from sonarqube, e.g. build/sonar/sonar-report.json
The file sonar-report.json is not generated and I have found some setting for Sonarqube that shouold make sonareqube create the file.
sonar.report.export.path=sonar-report.json
sonar.issuesReport.html.enable=true
sonar.issuesReport.json.enable=true
sonar.issuesReport.console.enable=true
I have tried to set these in the file
<sonar-installation-directory>/conf/sonar.properties
I have restarted the Sonare service and restarted the computer but the sonar-report.json file is still not created.
Those properties are not meant to be configured on the server side, they are passed on the scanner side, and are valid only for analysis in preview mode (by the way no need for sonar.issuesReport.json.enable). That's what SonarLint for Command Line is about.
Why preview mode ? Because the goal is to analyse a diff (to comment the code review in your case). You don't want a full analysis to be submitted to SonarQube if the code is not yet pushed to the repo.
Example:
$ sonar-runner -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true -Dsonar.report.export.path=report.json -Dsonar.host.url=http://localhost:9000
[...]
$ ls .sonar/
issues-report report.json
(careful with the JSON report, looks like it will ultimately be removed, see SONAR-7247)
P.S.: I guess you might be using the sonar-gerrit Jenkins plugin, which is essentially saying the same thing:
This plugin is intended to work with report provided by SonarQube running on your project in preview mode

Which MSBuild tasks initiate a call to SGen?

I have inherited a complex MSBuild script which builds & deploys multiple solutions. When I run the script I see the following error in log:
SGEN: Cannot generate serialization assembly
C:\B\268\Agents\Agents.XmlSerializers.dll
because it already exists. Use /force to force an overwrite of the
existing assembly.
I agree that Agents.XmlSerializers.dll exists. What I can't determine is which task caused it to be created and which one initiated the attempt to re-create it.
I have searched through the files in the build hierarchy for 'SGen' and found nothing. So I presume that SGen is called implicitly by two (or more) of the tasks in the build.
Can anyone point out what might call SGen?
Thanks.
In the Build Output window, look for...
Task "SGen"
Right above that is the actual "sgen.exe" command.
And as Pawell said, you need full details in your build output. Inside of Studio, it's Tools - Options... - Projects and Solutions - Build and Run - MSBuild project build output verbosity: Diagnostic.

What command line arguments does Visual Studio use for running MsTest?

I'm trying to figure out which is the command line arguments used by Visual Studio when you run the MsTest tests, I guess it starts with:
MSTest.exe /testmetadata:%SolutionName%.vsmdi /testlist:
But I couldn't figure out how to fill the testlist parameter, because both the test list name and id get the following error:
The test list path 8c43105b-9dc1-4917-a39f-aa66a61bf5b6 cannot be found.
An error occurred while executing the /testlist switch.
I'm trying to figure out which is the command line arguments used by
Visual Studio when you run the MsTest tests
It depends on how do you run your tests from Visual Studio. See the following examples:
You are selecting some tests from the Test View window and run them
MSTest.exe /testcontainer:TestProject.dll /test:TestMethod1 /test:TestMethod2 ...
Your are running all the tests from the Test View window
MSTest.exe /testcontainer:TestProject.dll
You have filtered your tests by a category through Test View window and run this category
MSTest.exe /testcontainer:TestProject.dll /category:CategoryName
You have opened the *.vsmdi file and selected some TestLists to run
MSTest.exe /testmetadata:*.vsmdi /testlist:TestList1 /testlist:TestList2 ...
You are running Load or Ordered tests
MSTest.exe /testcontainer:LoadTest1.loadtest /testcontainer:OrderedTest1.orderedtest
You can combine the above examples (arguments) to create the MSTest command that suits on your case. The only restriction you have is that you cannot use the /testmetada and /testcontainer arguments together.
As for the TestList argument you just need to give as parameter the name of the list. If it is not found then your test list does not exist or it does not belong to the *.vsmdi you have defined on the /testmetadata argument.
I am sure that you have already done it, but you can check the following link:
MSTest.exe Command-Line Options
See following link. Even though this post is about msbuild. It uses exec task for calling mstest.
If you use /testlist you need to give metadata file.
You can use /testcontainer and give dll for your test project. It will run all of your tests.
/testcontainer:[file name] Load a file that contains tests. You can
Specify this option more than once to
load multiple test files.
Examples:
/testcontainer:mytestproject.dll
/testcontainer:loadtest1.loadtest

Resources