Skip to content

Adds integration test scaffolding#176

Merged
JasonTheAdams merged 3 commits intotrunkfrom
add/integration-tests
Jan 23, 2026
Merged

Adds integration test scaffolding#176
JasonTheAdams merged 3 commits intotrunkfrom
add/integration-tests

Conversation

@JasonTheAdams
Copy link
Copy Markdown
Member

This introduces integration tests for running actual prompts against the models. As this has grown it's become more obvious that the only way to really catch Provider issues is by running prompts. While we would do some basic testing locally, having a proper suite of tests is really useful for catching things and avoiding regressions.

These tests can't be run automatically as they require credentials. As such, we'll want to run this manually periodically when developing, and every time before publishing a new release.

API keys can be loaded as part of the environment or put in a .env file.

NOTE:
There is a purposely failing test for OpenAI function calling. This will be resolved in #175 as a broader effort to correct issues with function calling across the provider APIs.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 21, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: JasonTheAdams <jason_the_adams@git.wordpress.org>
Co-authored-by: felixarntz <flixos90@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@felixarntz felixarntz added this to the 0.4.1 milestone Jan 22, 2026
Copy link
Copy Markdown
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@JasonTheAdams Almost LGTM, just two things.

Other than that, for the Anthropic testFunctionCallingWithNoArguments, I know that'll be fixed in the other PR.

Preemptively approving, pending my feedback below.

'say_hi_to',
'Says hi to a specific person by name',
[
'type' => 'string',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This test fails for me, and I think it should? According to what I could gather from the docs, Anthropic requires object as type. So this shouldn't be expected to pass?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good note! I'm going to address and get all function-related tests passing in a subsequent PR. 👍

'say_hi_to',
'Says hi to a specific person by name',
[
'type' => 'string',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here, for OpenAI I don't think this is allowed. So maybe we'll want to expect an exception here? Just to make sure we still cover it for these providers that don't support it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think it is. Hahah! But I'm starting with stupid tests and will fix/add/address them in the next PR.

// Args should be null or empty for a no-argument function
$args = $functionCall->getArgs();
$this->assertTrue(
$args === null || $args === [] || $args === (object) [],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should make this more concrete, i.e. let's see what the API actually returns in this case. Unless it varies between distinct requests, we should expect that concrete result. While this is extremely nit-picky, we'll want to know when something related to this changes in the API, so being as precise as possible helps here, I'd argue.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Noted! I'll address this subsequently.

// Args should be null or empty for a no-argument function
$args = $functionCall->getArgs();
$this->assertTrue(
$args === null || $args === [] || $args === (object) [],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See above.

// Args should be null or empty for a no-argument function
$args = $functionCall->getArgs();
$this->assertTrue(
$args === null || $args === [] || $args === (object) [],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See above.

@JasonTheAdams JasonTheAdams merged commit 6ecd3cb into trunk Jan 23, 2026
17 checks passed
@JasonTheAdams JasonTheAdams deleted the add/integration-tests branch January 23, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants