geary/test
Niels De Graef 81859bd3c3 Adapt vala-unit and tests to GLib 2.70 and later
`GLib.TestSuite` is a special type of object, as it doesn't actually
have an associated copy function or a reference/unreference function.
In practice, that actually means there's no way to actually have 2
strong references to such an object, or to copy it somehow. Due to the
way GObject properties in Vala work, that means you can't really use
them either.

Ever since vala commit 5f0a146f65, this got reflected properly in the
internally maintained GLib VAPI (as people were experiencing double
frees otherwise), but it was added only conditionally for GLib 2.70 or
later. In practice, that means you only get vala compiler issues if you
(impliclty) set `--target-glib=2.70` (or a later version).

To fix this for vala-unit and our own Geary tests, this commit changes
the `ValaUnit.TestCase` class to only allow "stealing" the strong
reference to the `GLib.TestSuite`, rather than somehowing allowing
people to hold a weak reference, and by also making it a protected field
rather than a property.

Since this changes the API of ValaUnit, we also bump the version. In
general though, I hope people aren't using ValaUnit externally, since
these types of API/ABI breaks can happen with Vala libraries.

Link: 5f0a146f65
2025-12-07 11:37:22 +01:00
..
client Create a config.vapi for config.h 2025-12-07 01:32:32 +01:00
data build: Reduce verbosity of meson vars by removing geary_ prefixes 2020-08-13 19:51:33 +10:00
engine Create a config.vapi for config.h 2025-12-07 01:32:32 +01:00
integration engine: Detect mime encoding constraint from server EHLO 2025-08-27 08:03:38 +00:00
js client: Always load email once view is mapped 2023-08-20 21:41:24 +00:00
mock engine: Cancel any remote folders update before marking a message 2022-09-26 11:03:13 +02:00
meson.build Adapt vala-unit and tests to GLib 2.70 and later 2025-12-07 11:37:22 +01:00
README.md Add initial integration test famework and IMAP client session tests 2019-03-31 02:05:14 +11:00
test-case.vala Update existing tests to work with ValaUnit 2020-06-30 17:31:07 +10:00
test-client.vala Adapt vala-unit and tests to GLib 2.70 and later 2025-12-07 11:37:22 +01:00
test-engine.vala Adapt vala-unit and tests to GLib 2.70 and later 2025-12-07 11:37:22 +01:00
test-integration.vala Adapt vala-unit and tests to GLib 2.70 and later 2025-12-07 11:37:22 +01:00
test-js.vala Adapt vala-unit and tests to GLib 2.70 and later 2025-12-07 11:37:22 +01:00
test-server.vala test/test-server.vala: Fix build warning 2020-05-06 14:58:56 +10:00

Automated Test Infrastructure

Geary currently supports three types of automated tests:

  • Engine unit tests
  • Client (GTK and JavaScript) unit tests
  • Server integration tests

Unit tests

Unit tests test individual functions, in general avoid doing any I/O so they are fast, and can be run automatically.

The engine and client unit tests are hooked up to the Meson build, so you can use Meson's test infrastructure to build and run them. These are run automatically as part of the Gitlab CI process and if you use the development Makefile, you can execute them locally by simply calling:

make test

The engine tests can be run headless (i.e. without an X11 or Wayland session), but the client tests require a functioning display since they execute GTK code.

Integration tests

Integration tests run Geary's network code against actual servers, to ensure that the code also works in the real world.

The integration tests are built by default, but not currently hooked up to Meson and are not automatically run by Gitlab CI, since they require multiple working servers, network connection to the servers, and login credentials.

You can run them manually however against any server you have a test account on, using the following form:

build/test/test-integration PROTOCOL PROVIDER [HOSTNAME] LOGIN PASSWORD

For example, to test against GMail's IMAP service:

build/test/test-integration imap gmail test@gmail.com p455w04d

If PROVIDER is other, then HOSTNAME is required.

The easiest way to test against a number of different servers at the moment is to create a test account for each, then write a shell script or similar to execute the tests against each in turn.