How to unit test non-exported class in UWP component (C++/WinRT)
up vote
0
down vote
favorite
I'm looking for some guidance on my strategy for unit testing UWP components.
I am developing a UWP component using the C++/WinRT projection. This component contains a helper class that manages communication with a Bluetooth device. I would like to write unit tests for that helper class (BthDevice) without exporting them to the UWP component's interface.
I started by following some guidelines for testing non-exported DLL classes. Specifically, I created a new UWP unit test project. I explicitly added my project's include directory, included BthDevice.h, and added the class' BthDevice.obj to the linker settings. I fought a few linker errors, and now it's falling over because I'm using precompiled headers in the UWP component. I've given up for now.
It feels like this should be a simple task, and that I'm going about it the wrong way. Any guidance is welcome! Thanks.
visual-c++ uwp c++-winrt
New contributor
add a comment |
up vote
0
down vote
favorite
I'm looking for some guidance on my strategy for unit testing UWP components.
I am developing a UWP component using the C++/WinRT projection. This component contains a helper class that manages communication with a Bluetooth device. I would like to write unit tests for that helper class (BthDevice) without exporting them to the UWP component's interface.
I started by following some guidelines for testing non-exported DLL classes. Specifically, I created a new UWP unit test project. I explicitly added my project's include directory, included BthDevice.h, and added the class' BthDevice.obj to the linker settings. I fought a few linker errors, and now it's falling over because I'm using precompiled headers in the UWP component. I've given up for now.
It feels like this should be a simple task, and that I'm going about it the wrong way. Any guidance is welcome! Thanks.
visual-c++ uwp c++-winrt
New contributor
You can immediately access an implementation type, as long as the API is implemented in the consuming project.
– IInspectable
2 days ago
In my case, I'm trying to unit test an implementation type from a UWP Unit Test project. So, the implementation type is NOT implemented in the consuming project.
– Sean Kelly
yesterday
If you#include
the implementation file into a compilation unit of your test project, then that implementation type is implemented in the consuming project. At least that appears to be a workable solution, although I never used the built-in testing framework.
– IInspectable
yesterday
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm looking for some guidance on my strategy for unit testing UWP components.
I am developing a UWP component using the C++/WinRT projection. This component contains a helper class that manages communication with a Bluetooth device. I would like to write unit tests for that helper class (BthDevice) without exporting them to the UWP component's interface.
I started by following some guidelines for testing non-exported DLL classes. Specifically, I created a new UWP unit test project. I explicitly added my project's include directory, included BthDevice.h, and added the class' BthDevice.obj to the linker settings. I fought a few linker errors, and now it's falling over because I'm using precompiled headers in the UWP component. I've given up for now.
It feels like this should be a simple task, and that I'm going about it the wrong way. Any guidance is welcome! Thanks.
visual-c++ uwp c++-winrt
New contributor
I'm looking for some guidance on my strategy for unit testing UWP components.
I am developing a UWP component using the C++/WinRT projection. This component contains a helper class that manages communication with a Bluetooth device. I would like to write unit tests for that helper class (BthDevice) without exporting them to the UWP component's interface.
I started by following some guidelines for testing non-exported DLL classes. Specifically, I created a new UWP unit test project. I explicitly added my project's include directory, included BthDevice.h, and added the class' BthDevice.obj to the linker settings. I fought a few linker errors, and now it's falling over because I'm using precompiled headers in the UWP component. I've given up for now.
It feels like this should be a simple task, and that I'm going about it the wrong way. Any guidance is welcome! Thanks.
visual-c++ uwp c++-winrt
visual-c++ uwp c++-winrt
New contributor
New contributor
New contributor
asked 2 days ago
Sean Kelly
22
22
New contributor
New contributor
You can immediately access an implementation type, as long as the API is implemented in the consuming project.
– IInspectable
2 days ago
In my case, I'm trying to unit test an implementation type from a UWP Unit Test project. So, the implementation type is NOT implemented in the consuming project.
– Sean Kelly
yesterday
If you#include
the implementation file into a compilation unit of your test project, then that implementation type is implemented in the consuming project. At least that appears to be a workable solution, although I never used the built-in testing framework.
– IInspectable
yesterday
add a comment |
You can immediately access an implementation type, as long as the API is implemented in the consuming project.
– IInspectable
2 days ago
In my case, I'm trying to unit test an implementation type from a UWP Unit Test project. So, the implementation type is NOT implemented in the consuming project.
– Sean Kelly
yesterday
If you#include
the implementation file into a compilation unit of your test project, then that implementation type is implemented in the consuming project. At least that appears to be a workable solution, although I never used the built-in testing framework.
– IInspectable
yesterday
You can immediately access an implementation type, as long as the API is implemented in the consuming project.
– IInspectable
2 days ago
You can immediately access an implementation type, as long as the API is implemented in the consuming project.
– IInspectable
2 days ago
In my case, I'm trying to unit test an implementation type from a UWP Unit Test project. So, the implementation type is NOT implemented in the consuming project.
– Sean Kelly
yesterday
In my case, I'm trying to unit test an implementation type from a UWP Unit Test project. So, the implementation type is NOT implemented in the consuming project.
– Sean Kelly
yesterday
If you
#include
the implementation file into a compilation unit of your test project, then that implementation type is implemented in the consuming project. At least that appears to be a workable solution, although I never used the built-in testing framework.– IInspectable
yesterday
If you
#include
the implementation file into a compilation unit of your test project, then that implementation type is implemented in the consuming project. At least that appears to be a workable solution, although I never used the built-in testing framework.– IInspectable
yesterday
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sean Kelly is a new contributor. Be nice, and check out our Code of Conduct.
Sean Kelly is a new contributor. Be nice, and check out our Code of Conduct.
Sean Kelly is a new contributor. Be nice, and check out our Code of Conduct.
Sean Kelly is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53225095%2fhow-to-unit-test-non-exported-class-in-uwp-component-c-winrt%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
You can immediately access an implementation type, as long as the API is implemented in the consuming project.
– IInspectable
2 days ago
In my case, I'm trying to unit test an implementation type from a UWP Unit Test project. So, the implementation type is NOT implemented in the consuming project.
– Sean Kelly
yesterday
If you
#include
the implementation file into a compilation unit of your test project, then that implementation type is implemented in the consuming project. At least that appears to be a workable solution, although I never used the built-in testing framework.– IInspectable
yesterday