Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Entwicklung
    4. Integrationstest für IOB

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Integrationstest für IOB

    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      killroy2 last edited by

      Hallo
      ich komme gerade von dieser Seite: https://github.com/ioBroker/testing

      ein einfacher Test ohne Logik läuft soweit, Adapter startet auf und kann sentTo Befehle empfangen.
      Mit dem Test will ich prüfen wie Objekte geschrieben werden.

      Mit dem Code test ich grundsätzlich mal die Funktion ohne meinen Adapter in der Loop:

          const {
              adapter,
              database
          } = utils.unit.createMocks();
          const {
              assertObjectExists
          } = utils.unit.createAsserts(
              database,
              adapter,
          );
      
      
              it("works", () => {
                  // Create an object in the fake db we will use in this test
                  const theObject = {
                      _id: "whatever",
                      type: "state",
                      common: {
                          role: "whatever",
                      },
                  };
      

      ...

                  database.publishObject(theObject);
                  console.dir(database.states);
                  // Do something that should be tested
                  // Assert that the object still exists
                  assertObjectExists(theObject._id);
              });
      

      Problem ist dass er die Objete nicht anlegt und das Assert schlägt mit
      TypeError: Cannot read property 'equal' of undefined
      fehl.
      Hilfreich wäre auchh ein Beispiel wo so Sachen umgesetzt wurden.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      Support us

      ioBroker
      Community Adapters
      Donate

      823
      Online

      31.7k
      Users

      79.8k
      Topics

      1.3m
      Posts

      1
      1
      123
      Loading More Posts
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      Community
      Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
      The ioBroker Community 2014-2023
      logo