Skip to content

Add full integration test#24

Merged
jgeudens merged 1 commit intomasterfrom
dev/integration_test
Apr 5, 2026
Merged

Add full integration test#24
jgeudens merged 1 commit intomasterfrom
dev/integration_test

Conversation

@jgeudens
Copy link
Copy Markdown
Member

@jgeudens jgeudens commented Apr 5, 2026

Summary by CodeRabbit

  • Tests
    • Enhanced integration test coverage for the dummy adapter, including validation of register data reads, multiple read cycle consistency, and session lifecycle events.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 5, 2026

Walkthrough

Three new integration test methods have been added to the dummy adapter test suite to validate register read operations, repeated read cycles, and stop session signal emission. The test header declarations and corresponding implementations were added with supporting configuration for TCP connections.

Changes

Cohort / File(s) Summary
Test declarations
tests/integration/tst_dummyadapter.h
Added three private slot declarations: readRegistersReturnsValidData(), multipleReadCyclesAllSucceed(), and stopSessionEmitsSessionStopped().
Test implementations
tests/integration/tst_dummyadapter.cpp
Implemented three integration test methods with TCP connection constants and realConfig() JSON generator, testing register reads with valid data assertion, repeated read cycle consistency, and session-stopped signal emission.

Possibly related PRs

  • Support adapter #5: Introduces ResultDoubleList type and adapter session readData/stop behaviour that is directly exercised by the newly added integration test methods.
🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Add full integration test' is vague and generic, using non-descriptive terms that don't clearly convey what specific functionality or component is being tested. Revise the title to be more specific about the integration test's focus, e.g., 'Add integration tests for dummy adapter register reads and session lifecycle' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev/integration_test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/integration/tst_dummyadapter.cpp (1)

176-215: Consider asserting sessionError in the remaining new tests for clearer diagnostics.

multipleReadCyclesAllSucceed() and stopSessionEmitsSessionStopped() currently verify success signals but do not explicitly rule out concurrent sessionError emissions.

Suggested patch
 void TestDummyAdapter::multipleReadCyclesAllSucceed()
 {
     auto* process = new AdapterProcess();
     AdapterClient client(process);

@@
     connect(&client, &AdapterClient::describeResult, &client,
             [&client, &registers]() { client.provideConfig(realConfig(), registers); });

     QSignalSpy spyStarted(&client, &AdapterClient::sessionStarted);
+    QSignalSpy spyError(&client, &AdapterClient::sessionError);
     client.prepareAdapter(QString::fromUtf8(DUMMY_ADAPTER_EXECUTABLE));
     QVERIFY2(spyStarted.wait(cSessionTimeoutMs), "sessionStarted not emitted");
+    QCOMPARE(spyError.count(), 0);

@@
     client.stopSession();
 }

 void TestDummyAdapter::stopSessionEmitsSessionStopped()
 {
@@
     connect(&client, &AdapterClient::describeResult, &client,
             [&client]() { client.provideConfig(realConfig(), QStringList()); });

     QSignalSpy spyStarted(&client, &AdapterClient::sessionStarted);
+    QSignalSpy spyError(&client, &AdapterClient::sessionError);
     client.prepareAdapter(QString::fromUtf8(DUMMY_ADAPTER_EXECUTABLE));
     QVERIFY2(spyStarted.wait(cSessionTimeoutMs), "sessionStarted not emitted");
+    QCOMPARE(spyError.count(), 0);

     QSignalSpy spyStopped(&client, &AdapterClient::sessionStopped);
     client.stopSession();
     QVERIFY2(spyStopped.wait(cSessionTimeoutMs), "sessionStopped not emitted after stopSession");
+    QCOMPARE(spyError.count(), 0);
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/integration/tst_dummyadapter.cpp` around lines 176 - 215, Add
assertions that AdapterClient::sessionError is not emitted in both tests: create
a QSignalSpy spyError(&client, &AdapterClient::sessionError) before starting the
session in multipleReadCyclesAllSucceed() and stopSessionEmitsSessionStopped(),
then after each asynchronous wait (after spyStarted.wait, after each
spyData.wait in multipleReadCyclesAllSucceed, and after spyStopped.wait in
stopSessionEmitsSessionStopped) assert spyError.count() == 0 (or
QVERIFY2(spyError.isEmpty(), "sessionError emitted")) to fail fast if an error
was raised concurrently; use the existing cSessionTimeoutMs/cReadTimeoutMs time
windows when verifying outcomes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/integration/tst_dummyadapter.cpp`:
- Around line 176-215: Add assertions that AdapterClient::sessionError is not
emitted in both tests: create a QSignalSpy spyError(&client,
&AdapterClient::sessionError) before starting the session in
multipleReadCyclesAllSucceed() and stopSessionEmitsSessionStopped(), then after
each asynchronous wait (after spyStarted.wait, after each spyData.wait in
multipleReadCyclesAllSucceed, and after spyStopped.wait in
stopSessionEmitsSessionStopped) assert spyError.count() == 0 (or
QVERIFY2(spyError.isEmpty(), "sessionError emitted")) to fail fast if an error
was raised concurrently; use the existing cSessionTimeoutMs/cReadTimeoutMs time
windows when verifying outcomes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: afe28601-63d6-4e0f-a593-51049aa827d4

📥 Commits

Reviewing files that changed from the base of the PR and between ecf857b and 94a2c80.

📒 Files selected for processing (2)
  • tests/integration/tst_dummyadapter.cpp
  • tests/integration/tst_dummyadapter.h

@jgeudens jgeudens merged commit 7f17904 into master Apr 5, 2026
10 checks passed
@jgeudens jgeudens deleted the dev/integration_test branch April 5, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant