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

Add a public initializer for Testing.Test #521

Open
younata opened this issue Jul 3, 2024 · 2 comments
Open

Add a public initializer for Testing.Test #521

younata opened this issue Jul 3, 2024 · 2 comments
Labels
enhancement New feature or request public-api Affects public API tools integration Integration of swift-testing into tools/IDEs

Comments

@younata
Copy link

younata commented Jul 3, 2024

Description

I'm in the process of creating a BDD-style DSL on top of Swift Testing (Quick/Quick#1292), and I'm looking at creating Testing.Tests. I could use Testing.Test.__function, but that's explicitly discouraged (though that's definitely what I'll be using for the time being).

I'd like for the Test struct initializers to be made public, so that I have an explicitly supported way to generate Test objects.

@younata younata added the enhancement New feature or request label Jul 3, 2024
@grynspan grynspan added tools integration Integration of swift-testing into tools/IDEs public-api Affects public API labels Jul 5, 2024
@Uncommon
Copy link

I think it would also be useful to have a public API for creating suites. Currently, Test.isSuite is computed based on the value of containingTypeInfo, so the concept of a suite is directly and exclusively connected to actually using the @Suite macro.

On the whole, there seems to be a lot of tight coupling between macros and test implementation. Are there plans to loosen this up?

@grynspan
Copy link
Contributor

grynspan commented Jan 28, 2025

I think it would also be useful to have a public API for creating suites.

Suites are tests from the point of view of Swift Testing. It's just a question of whether there's an associated sequence of Test.Case instances that makes it a test function instead. (This is in part an artifact of earlier stages of Swift Testing's development, and in part a simplification to let us have heterogenous collections of test content.)

On the whole, there seems to be a lot of tight coupling between macros and test implementation. Are there plans to loosen this up?

Not in the way you're thinking. Very broadly, the plan is to allow third-party libraries to define their own test content records that can either be picked up directly by Swift Testing or discovered at runtime by some other library that runs as a peer of Swift Testing (and utilizes some, but not all, of its API.)

We haven't fully fleshed out this plan yet, but parts of it have landed on main. See for example #893, #880, and #928.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request public-api Affects public API tools integration Integration of swift-testing into tools/IDEs
Projects
None yet
Development

No branches or pull requests

3 participants