SmartTester
2.0.0
Smart Tester is unit testing and regression testing framework used for testing SmartCGMS system.
|
#include <GenericUnitTester.h>
Public Member Functions | |
FilterUnitTester (GUID guid, const EntityType &type) | |
HRESULT | infoEventTest () |
HRESULT | warningEventTest () |
HRESULT | errorEventTest () |
HRESULT | warmResetEventTest () |
HRESULT | shutDownEventTest () |
void | executeConfigTest (const std::wstring &testName, const tester::FilterConfig &configuration, HRESULT expectedResult) |
void | executeAllTests () override |
Every derived class has to override this method to execute all tests. More... | |
void | executeGenericTests () |
virtual void | executeSpecificTests ()=0 |
Executes all tests for a specific filter. Needs to be implemented by derived class. | |
![]() | |
EntityUnitTester (const GUID &entityGuid) | |
bool | isEntityLoaded () const noexcept |
CDynamic_Library & | getEntityLib () noexcept |
const GUID & | getEntityGuid () const noexcept |
void | loadEntityLibrary () |
const wchar_t * | getEntityName (const std::string &symbolName) |
![]() | |
void | executeTest (const std::wstring &testName, const std::function< HRESULT(void)> &test) |
Protected Member Functions | |
HRESULT | configurationTest (const tester::FilterConfig &config, HRESULT expectedResult) |
HRESULT | shutDownTest () override |
Creates shut down event and executes it with tested filter. | |
HRESULT | configureFilter (const tester::FilterConfig &configuration) |
TestFilter & | getTestFilter () |
![]() | |
void | setEntityLib (const std::wstring &libPath) |
void | setLibraryPath (const std::wstring &libraryPath) noexcept |
const std::wstring & | getLibraryPath () const |
scgms::IFilter * | getTestedEntity () noexcept |
void | setTestedEntity (scgms::IFilter *entity) |
void | runTest (const std::function< HRESULT()> &test) override |
We need special behavior of the test execution sequence, so we override this method. More... | |
Additional Inherited Members | |
![]() | |
std::mutex | m_testMutex |
std::condition_variable | m_testCv |
HRESULT | m_lastTestResult = S_OK |
Contains generic tests for any object implementing scgms::IFilter.
|
protected |
Executes configuration test based on given parameters. Every filter should be successfully configured only if all parts of the configuration are provided. Configuration test will be evaluated as successful and return S_OK only if the result of configuration is identical with given expectedResult parameter, otherwise will return E_FAIL.
memory | configuration string |
expectedResult | expected result of this configuration |
|
protected |
Configures tested filter with given configuration and returns the result.
configuration | filter configuration |
HRESULT tester::FilterUnitTester::errorEventTest | ( | ) |
If any filter is created, executes an error event upon it. Tested filter should send the error event to the output filter, which will be TestFilter. If the event is not received by TestFilter, test ends with an error.
|
overridevirtual |
Every derived class has to override this method to execute all tests.
Executing module tests if we didn't already
When testing model, we need to run creation tests first and create model manually during specific tests
Implements tester::EntityUnitTester< scgms::IFilter >.
void tester::FilterUnitTester::executeConfigTest | ( | const std::wstring & | testName, |
const tester::FilterConfig & | configuration, | ||
HRESULT | expectedResult | ||
) |
Invokes test method passed as a parameter. Invoked method has to take in two parameters and return HRESULT as a return value. The first parameter of invoked method is string and second one is HRESULT. Main purpose of this method is to invoke configuration test method which takes in configuration string as first parameter and expected result as second parameter.
testName | name of the test which will be displayed in logs |
test | method to be invoked by this method |
HRESULT tester::FilterUnitTester::infoEventTest | ( | ) |
If any filter is created, executes an info event upon it. Tested filter should send the info event to the output filter, which will be TestFilter. If the event is not received by TestFilter, test ends with an error.
HRESULT tester::FilterUnitTester::shutDownEventTest | ( | ) |
If any filter is created, executes shut down event upon it. Tested filter should send the shut down event to the output filter, which will be TestFilter. If the event is not received by TestFilter, test ends with an error. Shut down event ends filter's execution routine and it should not accept any other event after shutting down - it's Execute method should return an error. If not, the test fails.
HRESULT tester::FilterUnitTester::warmResetEventTest | ( | ) |
If any filter is created, executes warm reset event upon it. Tested filter should send the warm reset event to the output filter, which will be TestFilter. If the event is not received by TestFilter, test ends with an error.
HRESULT tester::FilterUnitTester::warningEventTest | ( | ) |
If any filter is created, executes a warning event upon it. Tested filter should send the warning event to the output filter, which will be TestFilter. If the event is not received by TestFilter, test ends with an error.