Questions tagged [cxxtest]

CxxTest is a unit testing framework for C++

CxxTest is a unit testing framework for C++ that is similar in spirit to JUnit, CppUnit, and xUnit. CxxTest is easy to use because it does not require precompiling a CxxTest testing library, it employs no advanced features of C++ (e.g. RTTI) and it supports a very flexible form of test discovery.

40 questions
19
votes
2 answers

MinGW / CxxTest bizarre errors

I hope you can help me. I have written a small project using CxxTest on my main dev machine. Everything works great on this machine, no problems. However, I tried setting up this project on my brand new laptop and just can't get it to work! I…
Casper
  • 429
  • 1
  • 6
  • 14
5
votes
3 answers

py.test with non-python tests (specifically, with cxxtest)

I work with a team that develops MPI-based C++ numerical applications. The group uses cxxtest for constructing individual unit tests or small suites, but 1) there are some complications aggregating across directories with cxxtest's usual features…
Eli S
  • 1,379
  • 4
  • 14
  • 35
4
votes
1 answer

How can I compare two ostream objects in C++ for equality?

I overloaded the left shift operator in my class and the output works fine, so for example when I have a line which says cout << obj; I will output the fields seperated by a comma. ostream& operator<<(ostream& output, const MyClass& obj) { …
user246392
  • 2,661
  • 11
  • 54
  • 96
4
votes
5 answers

How do I write a unit test when the class to test is complicated?

I am trying to employ TDD in writing a backgammon game in C++ using VS 2010. I have set up CxxTest to write the test cases. The first class to test is class Position { public: ... ... bool IsSingleMoveValid(.....) ... ... } I 'd like to write a…
Wartin
  • 1,965
  • 5
  • 25
  • 40
3
votes
1 answer

How to force ctest only run unit tests in some subdirectories?

My cmake project has the following tree structure: ├── CMakeLists.txt ├── basis ├── build ├── deps ├── study where /deps contains all 3rd-party dependencies, /basis and /study directories contain routines I wrote. In my main CMakeLists.txt file, I…
Jeff
  • 59
  • 1
  • 8
3
votes
6 answers

Testing a class that depends on static functions of another class

I am currently working on a class that uses another class which has only static functions. Everything worked fine until I tried testing my class. Here is a simple code example of the problem: class A { static String getSometing() { …
Tal
  • 422
  • 3
  • 13
3
votes
1 answer

CMake does not find CxxTest package

I wrote the following CMakeLists.txt in order to build a tester using CxxTest (it's almost the standard example provided by FindCxxTest): cmake_minimum_required(VERSION 2.8) project(tester) set(CMAKE_INCLUDE_PATH…
cwde
  • 214
  • 1
  • 10
3
votes
1 answer

How do I write an automake file for CxxTest?

The CxxTest documentation has an example of a Makefile that generates and runs unit tests. How do I do the same for automake (Makefile.am)?
Peter Tseng
  • 13,613
  • 4
  • 67
  • 57
2
votes
0 answers

example for mocks and stubs in cxxtest

I am using cxx test for unit testing. I have the proper setup for everything and I have written test cases for some simple functions but with a lot of dependencies in the code, I am finding it difficult to write more test suites. I have searched…
Alok Kumar
  • 21
  • 1
2
votes
2 answers

Manipulating return value of inner function for unit testing?

I am currently trying to write the unit test for some legacy code. In one of my function, it calls another function. According to the return value of the inner function, three branching conditions are present. The code is written in C++ and I am…
aaroh
  • 302
  • 2
  • 14
2
votes
5 answers

How to unit test the sorting of a std::vector

I have never used unit testing before, so I'm giving CxxTest a go. I wrote a test to check if a function correctly sorts a std::vector. First I made sure the test failed when the vector wasn't sorted, and then as a sanity check I tested whether…
ThisSuitIsBlackNot
  • 23,492
  • 9
  • 63
  • 110
2
votes
1 answer

Using CxxTest with Travis-CI

Here is the portion of my .travis.yml that handles the dependency installation for my wxWidgets/CxxTest project: install: - echo | sudo apt-add-repository ppa:dhart/ppa - sudo apt-get update -qq - sudo apt-get install -qq libwxgtk2.8…
vinnydiehl
  • 1,654
  • 1
  • 13
  • 17
1
vote
0 answers

Problems keeping CxxTest GUI open

I am trying to run some test cases using CxxTests directly in the terminal and with the GUI enabled. According to documentation, The default behavior of the GUI is to close the window after the last test. by default, the GUI closes when the…
djimenez
  • 41
  • 3
1
vote
4 answers

CXX Test Framework for C++

How effective is the CXX test framework, given that you are writing unit test cases around the code that you have written. Any bug in the code might as well get translated into a bug in the unit test code as well? Isn't it something like two…
Shree
  • 4,627
  • 6
  • 37
  • 49
1
vote
1 answer

Web-CAT CxxTest Eclipse GUI for test results not showing up

I am trying to execute test cases using CxxTest framework on Eclipse. After following instructions on this website - http://web-cat.cs.vt.edu/eclipse/cxxtest/ I am able to build the test case, but when I run it, it doesn't show the GUI (green/red…
Rob
  • 147
  • 1
  • 1
  • 7
1
2 3