Questions tagged [microsoft-cpp-unit-test]
31 questions
1
vote
1 answer
vstest.console.exe gets stuck after first test when executed from TFS Build
I have my build definition for my project set up on TFS. I intend to add Task to Run C++ Unit Tests and run them after each build.
I tried and added the task. When the Tests ran on TFSBuild the first test crashed with unhandled c++ exception and did…

sparkskapil
- 56
- 8
1
vote
1 answer
How to access my code using Visual Studio CppUnitTestFramework
I wish to unit test my code. It is a proprietary step in a task I have, the code of which I already wrote.
I am using VS Community 2017 v.15.9.7. I have followed the instructions of this site to the utmost detail, line by line:…

Savvas Savvidis
- 97
- 10
1
vote
2 answers
CppUnitTest link to Windows Application
I am trying to link my Native Test Project to existing project in the same solution.
In #include I am writing path to the header of class I am trying to test.
When I Run Test in Test Explorer I get build error:
Error 1 error LNK2019: unresolved…

code4fun
- 35
- 1
- 8
1
vote
1 answer
vs 2013 : breakpoint into cppunittest test throws exception
I am testing my c++11 static lib in vs 2013 environment.
I followed this nice tutorial and testing + code coverage are working fine.
Now I need step-by-step : I added breakpoints and executed the "Debug Selected Test" command and I get the following…

norisknofun
- 859
- 1
- 8
- 24
1
vote
1 answer
How can I run VS2012 CppUnitTestFramework unit tests from an msbuild script?
I've written a native unit test dll that uses VS2012's CppUnitTestFramework. I can run these tests in the VS2012's IDE in the Test Explorer window.
But, I'd like to also run these tests from our MsBuild script. I guess I need to launch some test…

Scott Langham
- 58,735
- 39
- 131
- 204
0
votes
1 answer
Use QSignalSpy with Microsoft::VisualStudio::CppUnitTestFramework
I want to test whether a Qt Class correctly emits a signal upon function call using QSignalSpy. I use MS Visual Studio and use the Microsoft::VisualStudio::CppUnitTestFramework. Executing unit tests generally works fine, but instantiating a…

Raimund Schlüßler
- 13
- 5
0
votes
0 answers
How to configure Visual Studio CppUnitTest
I am new to using VS Unit Testing. I have a simple solution of a c program that creates a .exe executable. The test program is using the CppUnitTestFramework. The directory Structure has both the HelloWorld application to test and the UnitTest1…

JCSC
- 1
- 1
0
votes
0 answers
CPPUnit Testing failing to run
I am pretty new to C++ and am trying out Microsoft CPPunit testing with a simple Add function.
Referring to the screenshot below, I am unable to get the test to work when I click on run all.
The Add function works fine in the main function, but when…

Shaun Goh
- 3
- 3
0
votes
1 answer
Can't get test to run on Visual Studio 2019 using Microsoft CppUnitTest Framework
I've a function std::vector tokenize(const std::string& s) that I want to unit test. The Token struct is defined as follows:
enum class Token_type { plus, minus, mult, div, number };
struct Token {
Token_type type;
double value;
}
I…

csmathhc
- 205
- 2
- 12
0
votes
0 answers
CppUnitTestFramework: Test Method Fails, Stack Trace Lists Line Number at the End of Method, Debug Test Passes
I know, I know - that question title is very much all over the place. However, I am not sure what could be an issue here that is causing what I am witnessing.
I have the following method in class Project that is being unit tested:
bool…

Dash
- 306
- 1
- 3
- 16
0
votes
1 answer
Access Violation when using gmock and CppUnitTestFramework
I've seen people using gmock with Microsoft's Cpp Unit Test Framework, but whenever I try to run a test (see example below) that makes use of the EXPECT_CALL macro I get an access violation during CppUnit's cleanup of the test case. If I comment out…

vdwtanner
- 197
- 2
- 14
0
votes
2 answers
Compare enum types
I am implementing some unit test using cpp unit test framework for visual studio. I want to be able to compare enums in the test but there is always an error that keeps showing up.
This is the code that causes me the error.
ClauseEntities ent1 =…

calveeen
- 621
- 2
- 10
- 28
0
votes
1 answer
CppUnitTestingFramework with templated TEST_CLASSes
Firstly, there is a question with a similar goal described here: C++ unit test testing, using template test class.
This question is regarding my attempt to solve the same problem.
Using the Microsoft CppUnitTestFramework, we can create unit tests…

chrisb2244
- 2,940
- 22
- 44
0
votes
2 answers
Problem unit testing functions that contain file I/O using Visual Studio Native cpp Unite Testing
I have this piece of code that counts the amount of instances a phrase exists within a text file. When I call this from a main() function, it works as expected.
When I try to write a Unit Test for it, it fails upon opening the file, returning -1…

FreakyWeeks
- 1
- 2
0
votes
0 answers
Assert::AreEqual defining specialization for system::clock
I have this code in my unit test:
Assert::AreEqual(std::chrono::system_clock::now(), ntp.testntp);
and I get this error:
Error 1 error C2338: Test writer must define specialization of ToStringQ& q> for your class class…

ecain
- 1,282
- 5
- 23
- 54