In my solution I have c++ and c# projects with corresponding Unit test projects mixed. During a TFS build I only want to execute the C# unit tests. Unfortunately I can't find a way to exclude these test assemblies to be being used in the unit test runner. I could identify all c++ unit tests projects based on a naming patter like Native.Tests.dll.
I can't find a way to explicitly exclude certain test assemblies from being tested/executed from the test runner.
Is there a way through either
Test Case Filter
Test assembly file specification?
Environment:
TFS 2013
Process template: ReleaseTfvcTemplate.12.xaml
In case you are wondering: Why do I want to exclude certain assemblies?
I want to use the Test Category feature to exclude certain unit tests from being executed on the build server, which you do through the TestCaseFilter feature in the TFS template. You specify that per "Test batch". When I run all my unit tests (c# + c++) in one test settings the native unit tests throw an error, because they don't understand/support the TestCategory-filter feature (remember: Test Case Filter). Therefore I want to split the it in 2 test runs/batches: c++ and c#.
Test Category is only worked in C# test project. (Test in my environment: TFS2015 VS2015)
If you only want to execute the C# unit test. The simplest way you can specify the C# test assembly file in Test assembly file specification.
You just need to identify all C# unit tests projects based on a naming patter totally different as C++ tests projects.
Note: You must make sure you are using totally different naming rules between C++ an C# test project.
For example:
C++test project name : including ABC like ABC1 ,ABC2, ABC3
C# test project name: including XYZ like XYZ1, XYZ2 ,XYZ3
Then using ***XYZ*.dll in Test assembly file specification to run the all C# test project.
Related
My project is composed of several DLLs that I must test with different unit tests. I generate an XML file for each of the tests then I transform them into a JUnit format to be read by Jenkins. It works very well.
On the other hand, the test results are all in the same topic on the Jenkins interface and I would like to separate them for each DLL. It is for a more practical aspect for the visualization of the tests. I haven't found the solution yet. That's why I'm asking you if there is a solution for this problem.
I tried several plugins like JUnit or Warning NG. But the result remains the same. The JUnit plugin puts all the results in the same section and makes no distinction and the Warning NG plugin fails to parse the XML report to display it in Jenkins.
I'm trying to create a unit test in QTCreator so I've followed this tutorial from the QT Docs:
https://doc.qt.io/qt-6/qttestlib-tutorial1-example.html
This runs example fine for me.
Unfortunately, this tutorial, and a few others I've found all give examples referencing classes included within the Unit Test project itself. But I would have thought the proper way would be to use my Unit Test project to create tests for the separate actual application that I'm trying to test. (after all, I can't add QTEST_MAIN to my own project as it has its own main).
So how do I include the testable in the unit test project and refer to the functions that I am trying to test?
I have project that is being built using NAnt.
Several projects are written in Delphi, several - C++, others - C#. They have unit tests. NAnt is smart enough to execute these unit tests.
As a result I have folder TestsResults containing one XML files (NUnit format) per one project with unit tests.
How can I insert tests results from these XML files into sonar DB? I tried to use Maven with sonar to do the trick but still no luck.
Have you read the Sonar .NET plugin details here? The Delphi, C++ and C# are also documented.
I have some projects developed with C++ builder XE.
I would like to add some unit test, but the DUnit framework installed is nice for Delphi, but the integration with C++ builder is not so good (and very limited).
What other xUnit framework can I easily work with ?
In your case I'd start by asking Embarcadero for assistance. They want to fully support the developers who use their stuff, and automated unit testing is really critical to keeping them happy.
Until then, CppUnit works on any C++ code, but does not really integrate all that well with IDEs. The approach we've used is to create a new project to contain the tests, and have its linker include the path to the existing production project's .OBJ files. We set up a a project dependency so the test project depends on the production project.
In the Test project, we'll use different main.cpp files, one each for Debug and Release, and use conditionals to include/exclude the appropriate one from the Debug and Release builds.
For some "fake" integration, at least as far as running the tests go, in the DebugMain.cpp we'll load up the MFC TestRunner GUI, so the developer can click to select the tests they want to execute. In the ReleaseMain.cpp, we'll use the command line test runner, using the CompilerOutputter object which will let the build process know of success or failure. The output is also compatible with IDEs that interpret stuff like that, so you can click on a failed test report in the Output window, and the IDE takes you to the failing test assertion.
I'm using TFS 2010, VS2010 and C#. I need to link each requirement to the unit test or tests associated with that requirement. I've found that in order to link Tests to requirements, TFS requires a Test Case for each [TestMethod] unit test. Only then can I link the Requirement to the Test Case which in turn is associated with the automated unit test. I'm looking for a way to shortcut this so that Test Cases can be created automatically for all exiting Tests. Ideally the TFS Test Case description would come from the [TestMethod] header comments.
If you just want to create a couple of test cases, you can do it directly from Visual Studio by opening the Test Window, select your test, right-click and choose "Create Test Case From Test". You must have your test projects opened in order to see your automated tests in the Test Window.
http://msdn.microsoft.com/en-us/library/dd380741.aspx#NewTestCase
If you want to import a bunch of automated tests from a test assembly, you can use the command-line tool for Test Management, called tcm.exe (you can find it under Common7\IDE\ of your Visual Studio location). The following command will do the trick:
tcm testcase /import /storage:[test assembly] /collection:[url] /teamproject:[your team project]
You can also specify the categories or the priorities of tests you want to import. For more information, see:
http://msdn.microsoft.com/en-us/library/dd465191.aspx#CreateTestCases
Hope this helps.