diff --git a/tests/src/mocks/report_mock.hpp b/tests/src/mocks/report_mock.hpp
index 2f6ffac..f3eafba 100644
--- a/tests/src/mocks/report_mock.hpp
+++ b/tests/src/mocks/report_mock.hpp
@@ -7,17 +7,12 @@
 class ReportMock : public interfaces::Report
 {
   public:
-    ReportMock(std::string reportName)
+    ReportMock(std::string name)
     {
         using namespace testing;
 
-        ON_CALL(*this, getName).WillByDefault([reportName] {
-            return reportName;
-        });
-        ON_CALL(*this, getPath).WillByDefault([reportName] {
-            return "/" + reportName;
-        });
-
+        ON_CALL(*this, getName).WillByDefault([name] { return name; });
+        ON_CALL(*this, getPath).WillByDefault([name] { return "/" + name; });
         EXPECT_CALL(*this, Die).Times(AnyNumber());
     }
 
diff --git a/tests/src/mocks/trigger_factory_mock.hpp b/tests/src/mocks/trigger_factory_mock.hpp
new file mode 100644
index 0000000..b714a44
--- /dev/null
+++ b/tests/src/mocks/trigger_factory_mock.hpp
@@ -0,0 +1,51 @@
+#pragma once
+
+#include "interfaces/trigger_factory.hpp"
+#include "mocks/trigger_mock.hpp"
+#include "params/trigger_params.hpp"
+
+#include <gmock/gmock.h>
+
+class TriggerFactoryMock : public interfaces::TriggerFactory
+{
+  public:
+    TriggerFactoryMock()
+    {
+        using namespace testing;
+
+        ON_CALL(*this, make(_, _, _, _, _, _, _, _, _))
+            .WillByDefault(WithArgs<0>(Invoke([](const std::string& name) {
+                return std::make_unique<NiceMock<TriggerMock>>(name);
+            })));
+    }
+
+    MOCK_METHOD(std::unique_ptr<interfaces::Trigger>, make,
+                (const std::string& name, bool isDiscrete, bool logToJournal,
+                 bool logToRedfish, bool updateReport,
+                 (const std::vector<std::pair<sdbusplus::message::object_path,
+                                              std::string>>& sensors),
+                 const std::vector<std::string>& reportNames,
+                 const TriggerThresholdParams& thresholds,
+                 interfaces::TriggerManager& triggerManager),
+                (const, override));
+
+    auto& expectMake(
+        std::optional<std::reference_wrapper<const TriggerParams>> paramsOpt,
+        const testing::Matcher<interfaces::TriggerManager&>& tm)
+    {
+        if (paramsOpt)
+        {
+            const TriggerParams& params = *paramsOpt;
+            return EXPECT_CALL(
+                *this, make(params.name(), params.isDiscrete(),
+                            params.logToJournal(), params.logToRedfish(),
+                            params.updateReport(), params.sensors(),
+                            params.reportNames(), params.thresholds(), tm));
+        }
+        else
+        {
+            using testing::_;
+            return EXPECT_CALL(*this, make(_, _, _, _, _, _, _, _, tm));
+        }
+    }
+};
diff --git a/tests/src/mocks/trigger_manager_mock.hpp b/tests/src/mocks/trigger_manager_mock.hpp
new file mode 100644
index 0000000..9377d2a
--- /dev/null
+++ b/tests/src/mocks/trigger_manager_mock.hpp
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "interfaces/trigger_manager.hpp"
+
+#include <gmock/gmock.h>
+
+class TriggerManagerMock : public interfaces::TriggerManager
+{
+  public:
+    MOCK_METHOD(void, removeTrigger, (const interfaces::Trigger* trigger),
+                (override));
+};
diff --git a/tests/src/mocks/trigger_mock.hpp b/tests/src/mocks/trigger_mock.hpp
new file mode 100644
index 0000000..d8eddd2
--- /dev/null
+++ b/tests/src/mocks/trigger_mock.hpp
@@ -0,0 +1,27 @@
+#pragma once
+
+#include "interfaces/trigger.hpp"
+
+#include <gmock/gmock.h>
+
+class TriggerMock : public interfaces::Trigger
+{
+  public:
+    TriggerMock(std::string name)
+    {
+        using namespace testing;
+
+        ON_CALL(*this, getName).WillByDefault([name] { return name; });
+        ON_CALL(*this, getPath).WillByDefault([name] { return "/" + name; });
+        EXPECT_CALL(*this, Die).Times(AnyNumber());
+    }
+
+    virtual ~TriggerMock()
+    {
+        Die();
+    }
+
+    MOCK_METHOD(std::string, getName, (), (const, override));
+    MOCK_METHOD(std::string, getPath, (), (const, override));
+    MOCK_METHOD(void, Die, ());
+};
diff --git a/tests/src/params/trigger_params.hpp b/tests/src/params/trigger_params.hpp
new file mode 100644
index 0000000..340f9b3
--- /dev/null
+++ b/tests/src/params/trigger_params.hpp
@@ -0,0 +1,67 @@
+#pragma once
+
+#include "interfaces/trigger_types.hpp"
+
+#include <utility>
+
+class TriggerParams
+{
+  public:
+    TriggerParams& name(std::string val)
+    {
+        nameProperty = std::move(val);
+        return *this;
+    }
+
+    const std::string& name() const
+    {
+        return nameProperty;
+    }
+
+    bool isDiscrete() const
+    {
+        return discreteProperty;
+    }
+
+    bool logToJournal() const
+    {
+        return logToJournalProperty;
+    }
+
+    bool logToRedfish() const
+    {
+        return logToRedfishProperty;
+    }
+
+    bool updateReport() const
+    {
+        return updateReportProperty;
+    }
+
+    const std::vector<std::pair<sdbusplus::message::object_path, std::string>>&
+        sensors() const
+    {
+        return sensorsProperty;
+    }
+
+    const std::vector<std::string>& reportNames() const
+    {
+        return reportNamesProperty;
+    }
+
+    const TriggerThresholdParams& thresholds() const
+    {
+        return thresholdsProperty;
+    }
+
+  private:
+    std::string nameProperty = "Trigger1";
+    bool discreteProperty = false;
+    bool logToJournalProperty = false;
+    bool logToRedfishProperty = false;
+    bool updateReportProperty = false;
+    std::vector<std::pair<sdbusplus::message::object_path, std::string>>
+        sensorsProperty = {};
+    std::vector<std::string> reportNamesProperty = {};
+    TriggerThresholdParams thresholdsProperty = {};
+};
diff --git a/tests/src/test_trigger.cpp b/tests/src/test_trigger.cpp
new file mode 100644
index 0000000..0f2d752
--- /dev/null
+++ b/tests/src/test_trigger.cpp
@@ -0,0 +1,91 @@
+#include "dbus_environment.hpp"
+#include "helpers.hpp"
+#include "mocks/trigger_manager_mock.hpp"
+#include "params/trigger_params.hpp"
+#include "trigger.hpp"
+#include "utils/set_exception.hpp"
+
+using namespace testing;
+using namespace std::literals::string_literals;
+
+class TestTrigger : public Test
+{
+  public:
+    TriggerParams triggerParams;
+
+    std::unique_ptr<TriggerManagerMock> triggerManagerMockPtr =
+        std::make_unique<NiceMock<TriggerManagerMock>>();
+    std::unique_ptr<Trigger> sut;
+
+    void SetUp() override
+    {
+        sut = std::make_unique<Trigger>(
+            DbusEnvironment::getIoc(), DbusEnvironment::getObjServer(),
+            triggerParams.name(), triggerParams.isDiscrete(),
+            triggerParams.logToJournal(), triggerParams.logToRedfish(),
+            triggerParams.updateReport(), triggerParams.sensors(),
+            triggerParams.reportNames(), triggerParams.thresholds(),
+            *triggerManagerMockPtr);
+    }
+
+    template <class T>
+    static T getProperty(const std::string& path, const std::string& property)
+    {
+        std::promise<T> propertyPromise;
+        sdbusplus::asio::getProperty<T>(
+            *DbusEnvironment::getBus(), DbusEnvironment::serviceName(), path,
+            Trigger::triggerIfaceName, property,
+            [&propertyPromise](boost::system::error_code) {
+                utils::setException(propertyPromise, "GetProperty failed");
+            },
+            [&propertyPromise](T t) { propertyPromise.set_value(t); });
+        return DbusEnvironment::waitForFuture(propertyPromise.get_future());
+    }
+
+    boost::system::error_code deleteTrigger(const std::string& path)
+    {
+        std::promise<boost::system::error_code> methodPromise;
+        DbusEnvironment::getBus()->async_method_call(
+            [&methodPromise](boost::system::error_code ec) {
+                methodPromise.set_value(ec);
+            },
+            DbusEnvironment::serviceName(), path, Trigger::deleteIfaceName,
+            "Delete");
+        return DbusEnvironment::waitForFuture(methodPromise.get_future());
+    }
+};
+
+TEST_F(TestTrigger, checkIfPropertiesAreSet)
+{
+    EXPECT_THAT(getProperty<bool>(sut->getPath(), "Discrete"),
+                Eq(triggerParams.isDiscrete()));
+    EXPECT_THAT(getProperty<bool>(sut->getPath(), "LogToJournal"),
+                Eq(triggerParams.logToJournal()));
+    EXPECT_THAT(getProperty<bool>(sut->getPath(), "LogToRedfish"),
+                Eq(triggerParams.logToRedfish()));
+    EXPECT_THAT(getProperty<bool>(sut->getPath(), "UpdateReport"),
+                Eq(triggerParams.updateReport()));
+    EXPECT_THAT((getProperty<std::vector<
+                     std::pair<sdbusplus::message::object_path, std::string>>>(
+                    sut->getPath(), "Sensors")),
+                Eq(triggerParams.sensors()));
+    EXPECT_THAT(
+        getProperty<std::vector<std::string>>(sut->getPath(), "ReportNames"),
+        Eq(triggerParams.reportNames()));
+    EXPECT_THAT(
+        getProperty<TriggerThresholdParams>(sut->getPath(), "Thresholds"),
+        Eq(triggerParams.thresholds()));
+}
+
+TEST_F(TestTrigger, deleteTrigger)
+{
+    EXPECT_CALL(*triggerManagerMockPtr, removeTrigger(sut.get()));
+    auto ec = deleteTrigger(sut->getPath());
+    EXPECT_THAT(ec, Eq(boost::system::errc::success));
+}
+
+TEST_F(TestTrigger, deletingNonExistingTriggerReturnInvalidRequestDescriptor)
+{
+    auto ec = deleteTrigger(Trigger::triggerDir + "NonExisting"s);
+    EXPECT_THAT(ec.value(), Eq(EBADR));
+}
diff --git a/tests/src/test_trigger_manager.cpp b/tests/src/test_trigger_manager.cpp
new file mode 100644
index 0000000..71314fa
--- /dev/null
+++ b/tests/src/test_trigger_manager.cpp
@@ -0,0 +1,127 @@
+#include "dbus_environment.hpp"
+#include "helpers.hpp"
+#include "mocks/trigger_factory_mock.hpp"
+#include "mocks/trigger_mock.hpp"
+#include "params/trigger_params.hpp"
+#include "trigger_manager.hpp"
+
+using namespace testing;
+
+class TestTriggerManager : public Test
+{
+  public:
+    std::pair<boost::system::error_code, std::string>
+        addTrigger(const TriggerParams& params)
+    {
+        std::promise<std::pair<boost::system::error_code, std::string>>
+            addTriggerPromise;
+        DbusEnvironment::getBus()->async_method_call(
+            [&addTriggerPromise](boost::system::error_code ec,
+                                 const std::string& path) {
+                addTriggerPromise.set_value({ec, path});
+            },
+            DbusEnvironment::serviceName(), TriggerManager::triggerManagerPath,
+            TriggerManager::triggerManagerIfaceName, "AddTrigger",
+            params.name(), params.isDiscrete(), params.logToJournal(),
+            params.logToRedfish(), params.updateReport(), params.sensors(),
+            params.reportNames(), params.thresholds());
+        return DbusEnvironment::waitForFuture(addTriggerPromise.get_future());
+    }
+
+    TriggerParams triggerParams;
+    std::unique_ptr<TriggerFactoryMock> triggerFactoryMockPtr =
+        std::make_unique<NiceMock<TriggerFactoryMock>>();
+    TriggerFactoryMock& triggerFactoryMock = *triggerFactoryMockPtr;
+    std::unique_ptr<TriggerMock> triggerMockPtr =
+        std::make_unique<NiceMock<TriggerMock>>(triggerParams.name());
+    TriggerMock& triggerMock = *triggerMockPtr;
+    std::unique_ptr<TriggerManager> sut = std::make_unique<TriggerManager>(
+        std::move(triggerFactoryMockPtr),
+        std::move(DbusEnvironment::getObjServer()));
+    MockFunction<void(std::string)> checkPoint;
+};
+
+TEST_F(TestTriggerManager, addTrigger)
+{
+    triggerFactoryMock.expectMake(triggerParams, Ref(*sut))
+        .WillOnce(Return(ByMove(std::move(triggerMockPtr))));
+
+    auto [ec, path] = addTrigger(triggerParams);
+    EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
+    EXPECT_THAT(path, Eq(triggerMock.getPath()));
+}
+
+TEST_F(TestTriggerManager, failToAddTriggerTwice)
+{
+    triggerFactoryMock.expectMake(triggerParams, Ref(*sut))
+        .WillOnce(Return(ByMove(std::move(triggerMockPtr))));
+
+    addTrigger(triggerParams);
+
+    auto [ec, path] = addTrigger(triggerParams);
+    EXPECT_THAT(ec.value(), Eq(boost::system::errc::file_exists));
+    EXPECT_THAT(path, Eq(std::string()));
+}
+
+TEST_F(TestTriggerManager, failToAddTriggerWhenMaxTriggerIsReached)
+{
+    triggerFactoryMock.expectMake(std::nullopt, Ref(*sut))
+        .Times(TriggerManager::maxTriggers);
+
+    for (size_t i = 0; i < TriggerManager::maxTriggers; i++)
+    {
+        triggerParams.name(triggerParams.name() + std::to_string(i));
+
+        auto [ec, path] = addTrigger(triggerParams);
+        EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
+    }
+
+    triggerParams.name(triggerParams.name() +
+                       std::to_string(TriggerManager::maxTriggers));
+    auto [ec, path] = addTrigger(triggerParams);
+    EXPECT_THAT(ec.value(), Eq(boost::system::errc::too_many_files_open));
+    EXPECT_THAT(path, Eq(std::string()));
+}
+
+TEST_F(TestTriggerManager, removeTrigger)
+{
+    {
+        InSequence seq;
+        triggerFactoryMock.expectMake(triggerParams, Ref(*sut))
+            .WillOnce(Return(ByMove(std::move(triggerMockPtr))));
+        EXPECT_CALL(triggerMock, Die());
+        EXPECT_CALL(checkPoint, Call("end"));
+    }
+
+    addTrigger(triggerParams);
+    sut->removeTrigger(&triggerMock);
+    checkPoint.Call("end");
+}
+
+TEST_F(TestTriggerManager, removingTriggerThatIsNotInContainerHasNoEffect)
+{
+    {
+        InSequence seq;
+        EXPECT_CALL(checkPoint, Call("end"));
+        EXPECT_CALL(triggerMock, Die());
+    }
+
+    sut->removeTrigger(&triggerMock);
+    checkPoint.Call("end");
+}
+
+TEST_F(TestTriggerManager, removingSameTriggerTwiceHasNoSideEffect)
+{
+    {
+        InSequence seq;
+        triggerFactoryMock.expectMake(triggerParams, Ref(*sut))
+            .WillOnce(Return(ByMove(std::move(triggerMockPtr))));
+        EXPECT_CALL(triggerMock, Die());
+        EXPECT_CALL(checkPoint, Call("end"));
+    }
+
+    addTrigger(triggerParams);
+    sut->removeTrigger(&triggerMock);
+    sut->removeTrigger(&triggerMock);
+    checkPoint.Call("end");
+}
