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

#include <LogReplayFilterUnitTester.h>

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

Public Member Functions

void executeSpecificTests () override
 Executes all tests for a specific filter. Needs to be implemented by derived class. More...
 
HRESULT invalidHeaderLogFileTest ()
 
HRESULT invalidBodyLogFileTest ()
 
HRESULT emittedEventCountTest ()
 
HRESULT emitShutdownFlagTest ()
 
HRESULT logReplayFolderTest ()
 
HRESULT filenameAsSegmentIdTest ()
 
- Public Member Functions inherited from tester::FilterUnitTester
 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 ()
 
- 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)
 

Additional Inherited Members

- Protected Member Functions inherited from tester::FilterUnitTester
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...
 
- Protected Attributes inherited from tester::TestRunner
std::mutex m_testMutex
 
std::condition_variable m_testCv
 
HRESULT m_lastTestResult = S_OK
 

Detailed Description

Derived class for execution of log replay filter unit tests.

Member Function Documentation

◆ emitShutdownFlagTest()

HRESULT tester::LogReplayFilterUnitTester::emitShutdownFlagTest ( )

When configured with Emit_Shutdown_Message = true, at the end of the log processing, shut down event should be sent. This test checks, if this shut down event is sent in the end.

Returns
S_OK if the shut down event is sent, otherwise E_FAIL

◆ emittedEventCountTest()

HRESULT tester::LogReplayFilterUnitTester::emittedEventCountTest ( )

When configured with valid log, number of emitted events from LogReplay filter should be the same as the number of non-header lines in the log file. This test checks, whether the number of emitted events is the same as the number of log lines.

Returns
S_OK if the event count checks, otherwise false

◆ executeSpecificTests()

void tester::LogReplayFilterUnitTester::executeSpecificTests ( )
overridevirtual

Executes all tests for a specific filter. Needs to be implemented by derived class.

Configuration tests

Implements tester::FilterUnitTester.

◆ filenameAsSegmentIdTest()

HRESULT tester::LogReplayFilterUnitTester::filenameAsSegmentIdTest ( )

When configured with a Interpret_Filename_As_Segment_ID = true, segment id's in every log file should be rewritten to a unique one. This test checks, whether the number of unique segment id's on received events is higher or equal to the number of log files replayed.

Returns
S_OK if the number of unique segment id's on received events id higher or equal to the number of replayed log files, otherwise E_FAIL

◆ invalidBodyLogFileTest()

HRESULT tester::LogReplayFilterUnitTester::invalidBodyLogFileTest ( )

When configured with invalid log, that cannot be parsed, LogReplay filter should send an error event to indicate parsing error. This test checks, whether the error event is sent or not.

Returns
S_OK if the error event is sent, otherwise E_FAIL

◆ invalidHeaderLogFileTest()

HRESULT tester::LogReplayFilterUnitTester::invalidHeaderLogFileTest ( )

When configured with log that has invalid header, LogReplay filter should send a warning event to indicate that the header is corrupted. This test checks whether the warning event is sent or not.

Returns
S_OK if the warning event is sent, otherwise E_FAIL

◆ logReplayFolderTest()

HRESULT tester::LogReplayFilterUnitTester::logReplayFolderTest ( )

When configured with a folder as an input, LogReplay filter should replay all valid logs in that folder. This test checks, if all valid logs were replayed.

Returns
S_OK if all logs were replayed, otherwise E_FAIL

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