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

Feature - Run tests from many assemblies #423

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

benguenter
Copy link

When there are multiple assemblies of tests for an FSharp project, it is a pain to run each project of tests individually using the dotnet cli.
I think it's valuable to use the dotnet watch tooling as well which doesn't work as nicely with multiple test projects either.
This PR adds the ability to specify multiple assemblies from the test runner in the Main.fs file when calling runTestsInAssembly.
That way all the results show up in one big list and we can use useful tooling like dotnet watch on a single project.

/// Scan filtered tests marked with TestsAttribute from an assembly
let testFromAssemblyWithFilter typeFilter (assembly : Assembly) =
testListFromAssemblyWithFilter typeFilter assembly
|> listToTestListOption
Copy link
Owner

Choose a reason for hiding this comment

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

This looks like it just changed the return type of the function testFromAssemblyWithFilter from a list to whatever listToTestListOption returns?

Copy link
Author

Choose a reason for hiding this comment

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

True, we could probably compose those functions together instead. 👍
Completed!

Copy link
Owner

Choose a reason for hiding this comment

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

My point here is that you've changed a public ABI, by currying instead of providing explicit parameters. Could you explicitly declare and pass the parameters please to avoid this change? (Eta expansion) Thank you

@haf
Copy link
Owner

haf commented Mar 21, 2022

Is this ready to merge?

@benguenter
Copy link
Author

Is this ready to merge?

Sure is!

@@ -618,6 +618,15 @@ module Tests =
let tests = testFromThisAssembly() |> Option.orDefault (TestList ([], Normal))
runTestsWithArgsAndCancel ct config args tests

/// Runs tests in the specified assemblies with the supplied command-line options.
/// Returns 0 if all tests passed, otherwise 1
let runTestsInAssembliesWithCLIArgsAndCancel (ct:CancellationToken) cliArgs args assemblies =
Copy link
Collaborator

@ratsclub ratsclub Mar 15, 2023

Choose a reason for hiding this comment

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

This is mostly a style-related comment. 😜

The other functions are written as let foo (bar : baz) = .... Should this one follow the same style?

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

Successfully merging this pull request may close these issues.

None yet

3 participants