SmartTester  2.0.0
Smart Tester is unit testing and regression testing framework used for testing SmartCGMS system.
Public Member Functions | Protected Member Functions | List of all members
tester::FilterUnitTester Class Referenceabstract

#include <GenericUnitTester.h>

Inheritance diagram for tester::FilterUnitTester:
Inheritance graph
[legend]
Collaboration diagram for tester::FilterUnitTester:
Collaboration graph
[legend]

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.
 
- Public Member Functions inherited from tester::EntityUnitTester< scgms::IFilter >
 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)
 
- Public Member Functions inherited from tester::TestRunner
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)
 
TestFiltergetTestFilter ()
 
- Protected Member Functions inherited from tester::EntityUnitTester< scgms::IFilter >
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

- Protected Attributes inherited from tester::TestRunner
std::mutex m_testMutex
 
std::condition_variable m_testCv
 
HRESULT m_lastTestResult = S_OK
 

Detailed Description

Contains generic tests for any object implementing scgms::IFilter.

Member Function Documentation

◆ configurationTest()

HRESULT tester::FilterUnitTester::configurationTest ( const tester::FilterConfig config,
HRESULT  expectedResult 
)
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.

Parameters
memoryconfiguration string
expectedResultexpected result of this configuration
Returns
S_OK only if the result of given configuration is identical with given expectedResult parameter, otherwise E_FAIL

◆ configureFilter()

HRESULT tester::FilterUnitTester::configureFilter ( const tester::FilterConfig configuration)
protected

Configures tested filter with given configuration and returns the result.

Parameters
configurationfilter configuration
Returns
configuration result

◆ errorEventTest()

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.

◆ executeAllTests()

void tester::FilterUnitTester::executeAllTests ( )
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 >.

◆ executeConfigTest()

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.

Parameters
testNamename of the test which will be displayed in logs
testmethod to be invoked by this method

◆ infoEventTest()

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.

◆ shutDownEventTest()

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.

◆ warmResetEventTest()

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.

◆ warningEventTest()

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.


The documentation for this class was generated from the following files: