![]() Then choose the Native Unit Test Project. In the Add a New Project dialog, set Language to C++ and type "test" into the search box. On the File menu, choose New > Project.If the DLL project exports the functions that you want to test, then you can add a reference to the code project from the test project. To reference exported DLL functions from the test project ![]() Set Configuration Type to Static Library (.lib).Ĭontinue with the procedure To link the tests to the object or library files. The project Properties window opens.Ĭhoose Configuration Properties > General. In Solution Explorer, on the shortcut menu of the project under test, choose Properties. If your tests must use members that aren't exported by the DLL project, and the project under test is built as a dynamic library, consider converting it to a static library. Create the tests To change the DLL to a static library ![]() Go to the procedure To add unit tests in the same project. The unit tests must call non-member functions that aren't exported, and the code must be built as a dynamic link library (DLL):Īdd unit tests in the same project as the product code. Go to the procedure To change the DLL to a static library. This approach has the benefit of allowing your tests to use non-exported members, but still keep the tests in a separate project. Add a separate test project that references the project under test. The unit tests call non-member functions that aren't exported from the DLL, and the DLL can be built as a static library:Ĭhange the DLL project so that it's compiled to a. Go to the procedure To link the tests to the object or library files. Go to the procedure To reference exported functions from the DLL project.Īdd a separate test project. In the test project, add a reference to the DLL project. The unit tests call only functions that are exported from the DLL:Īdd a separate test project as described in Write unit tests for C/C++. There are several ways to test DLL code, depending on whether it exports the functions that you want to test.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |