question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Developing service plugins: Software tests and interactive invocation

See original GitHub issue

Hi again,

@psyciknz mentioned at https://github.com/jpmens/mqttwarn/issues/516#issuecomment-863526629:

But what I might look at, and is probable a better direction for the project, is to create, in this case, a test_pushover.py test class for testing/debugging.

This can go into two directions. I hope that both variants will be helpful to you.

Software tests

8596c14a (from the “amo/service-tests” branch) adds some software tests for the pushover service plugin, with every real network interaction completely mocked. The corresponding tests can be invoked using

# Populate sandbox.
git clone https://github.com/jpmens/mqttwarn
git checkout amo/service-tests
python3 -m venv .venv
source .venv/bin/activate

# Install package for development and testing.
pip install --editable=.[test]

# Run all software tests for "pushover" service plugin.
pytest -vvv -k test_pushover

Interactive use

Since mqttwarn 0.10.0, it is possible to directly invoke notification plugins from the command line, as implemented by af3288bc. For the pushover notification plugin, that might look like

mqttwarn \
    --plugin=pushover \
    --data='{"title": "About", "message": "Hello world", "addrs": ["userkey", "token"], "priority": 6}'

For this to work, you will currently still have to configure a [config:pushover] section within your mqttwarn.ini. However, you can leave it completely empty, as the relevant parameters will be given on the command line. #527 will improve this situation once more - with that patch, service plugins can be invoked without needing any mqttwarn.ini configuration file at all.

With kind regards, Andreas.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
psyciknzcommented, Aug 22, 2022

I think all is fine. It was a while ago all this was discussed. I’ve certainly not run up against any problems recently

0reactions
amotlcommented, Aug 22, 2022

Dear @psyciknz,

a074a49af315 was needed to make the example outlined above actually work. Do you think this satisfies your needs?

With kind regards, Andreas.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Learn Unit Testing and Integration Testing - YouTube
Software testing tutorial is a must. Specifically Unit Testing and Integration testing using Java and JUnit5 testing frameworkYou will learn ...
Read more >
50 BEST Software Testing Tools List (Dec 2022 Update)
Best Software Testing Tools: ✔️ TestRail ✔️ Testpad ✔️ Xray ✔️ Practitest ✔️ Zephyr Scale ✔️ SpiraTest ✔️ TestMonitor and ...
Read more >
Testing Your Application - Quarkus
Learn how to test your Quarkus Application. This guide covers: Testing in JVM mode. Testing in native mode. Injection of resources into tests...
Read more >
Developing packages & plugins - Flutter documentation
Testing your plugin. Developing FFI plugin packages. Step 1: Create the package; Step 2: Building and bundling native code; Step 3: Binding to...
Read more >
Fundamentals of testing Android apps
This page outlines the core tenets of testing Android apps, including the central best practices and their benefits.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found