Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Query] Best practices for integration testing? #1747

Open
rcdailey opened this issue Sep 10, 2019 · 0 comments
Open

[Query] Best practices for integration testing? #1747

rcdailey opened this issue Sep 10, 2019 · 0 comments

Comments

@rcdailey
Copy link

Right now I use Catch for unit testing: If I have a class Foo, I write a test to verify the interface and observable behavior of class Foo. I mock out dependencies that Foo has in order to keep unit tests deterministic and free from outside interference.

The next phase of testing, integration testing, would allow me to make sure class Foo and Bar work well together. In Catch terms, this could also be a test case. It would be a really big one, because you'd have to do a lot of application "set-up" stuff, to initialize subsystems and prepare for the actual high-level behavior to be run. You'd have to potentially mock network services, databases, files, and other things.

Assuming that Catch is suitable for this, in what way would you structure your CI process to execute these two tiers of tests? One way I can think of is to come up with some global tags. For example, [UnitTest] and [IntegrationTest]. Then my CI script might do this:

#!/usr/bin/env bash
set -e # Script should stop if any test step fails

# Execute unit tests
MyTests.exe [UnitTest]

# Execute integration tests, only if the above didn't fail
MyTests.exe [IntegrationTest]

This would allow your lower-level tests to execute prior to your high-level tests. The justification here is that you don't want to waste time running integration tests if the foundations on which they are built are also dysfunctional.

The more simple, possibly "faster" option would be to just do MyTests.exe, with no tag specified, to run everything together.

Has anyone set up a continuous integration pipeline with these two tiers of tests? How have you structured it? What do the catch developers themselves recommend?

I realize this is a bit off-topic, as it's more focused on best practices with Catch involved, but I can't think of a better place to ask. Thanks in advance.

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

No branches or pull requests

1 participant