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

Write the NUnit arguements to a temp file and pass that to NUnit console #2114

Merged
merged 2 commits into from
Oct 10, 2018

Conversation

BlythMeister
Copy link
Contributor

Description

Another option for #2113 to always write NUnit args to a file and call nunit with the path to the args.

@BlythMeister
Copy link
Contributor Author

Not sure why this or the other fail ..

@matthid
Copy link
Member

matthid commented Sep 27, 2018

I guess this (and the other one) wants pull from release/next as well

@BlythMeister
Copy link
Contributor Author

Ok I'll sort that all tomorrow. Laptop is off for the night now 👍

@BlythMeister
Copy link
Contributor Author

Still don't get why this is failing...I included the latest...

Copy link
Member

@matthid matthid left a comment

Choose a reason for hiding this comment

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

Some ideas

@@ -325,6 +329,9 @@ let run (setParams : NUnit3Params -> NUnit3Params) (assemblies : string seq) =
FileName = tool
WorkingDirectory = getWorkingDir parameters
Arguments = args }) >> Process.withFramework) processTimeout

File.Delete(path)
Copy link
Member

Choose a reason for hiding this comment

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

maybe try-finally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, will update

@@ -316,7 +316,11 @@ let run (setParams : NUnit3Params -> NUnit3Params) (assemblies : string seq) =
let assemblies = assemblies |> Seq.toArray
if Array.isEmpty assemblies then failwith "NUnit: cannot run tests (the assembly list is empty)."
let tool = parameters.ToolPath
let args = buildArgs parameters assemblies
let generatedArgs = buildArgs parameters assemblies
let path = Path.Combine(Path.GetTempPath(), (sprintf "%s.txt" (Guid.NewGuid().ToString())))
Copy link
Member

Choose a reason for hiding this comment

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

What about Path.GetTempFileName()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't know that was a thing. Will update (and update a lot of other code too 😂)

@matthid
Copy link
Member

matthid commented Sep 27, 2018

nevermind the failures, mono is stupid as usually. Added a new test and after fixing it on windows it still fails on mono. Should work soon

@BlythMeister
Copy link
Contributor Author

@matthid i think this is just that build error you told me to ignore :)

@BlythMeister BlythMeister mentioned this pull request Oct 3, 2018
@BlythMeister
Copy link
Contributor Author

@matthid any chance of getting this into 5.8.2?

@matthid
Copy link
Member

matthid commented Oct 5, 2018

@BlythMeister Yes let me first try to get stuff green again then I'll look over everything again. Maybe it will be 5.8.0 or some other random patch version :)

@matthid
Copy link
Member

matthid commented Oct 5, 2018

Honestly I want to get some other smaller fixes in as well, but I don't want to be held back into feature creep :) So I guess we probably should release something and then try to get the rest in and release again...

@matthid
Copy link
Member

matthid commented Oct 5, 2018

Could we add a small integration test, or would that add to much headache (I'd be fine with restricting the test to CIs where .NET or mono is available)?

@BlythMeister
Copy link
Contributor Author

I'm not really sure how to do this.
Can you advise?

@matthid matthid closed this Oct 6, 2018
@matthid matthid reopened this Oct 6, 2018
@matthid
Copy link
Member

matthid commented Oct 6, 2018

I'm not really sure how to do this.

I'd just add a new test to the "Fake.Core.IntegrationTests" project, add a project reference to Fake.DotNet.Testing.NUnit and run nunit with it (on some prepared project you can check-in)

@BlythMeister
Copy link
Contributor Author

@matthid i started looking at this and got lost in the whole getting the nunit console runner in place.
Also, would this test not actually be testing the nunit runner...and not the fake implementation.

@matthid
Copy link
Member

matthid commented Oct 8, 2018

@BlythMeister Yes generally I feel like we need an easy way to mock the Fake.Core.Process API, this way we could add unit-tests for the cli generation. But I have not come up with a good way yet.

@BlythMeister
Copy link
Contributor Author

@matthid would you be ok to accept this without that test...or do i need to work out how to get this functioning :(

@matthid
Copy link
Member

matthid commented Oct 8, 2018

@BlythMeister I'm ok if you say you tested it manually :) Problem is that new features like this might break people and having at least some rudimentary test-infrastructure in place makes it much easier for me and others to add regression tests if needed.

I'm just in the process of trying to improve azure devops integration into PRs (which is red at the moment), which might make it easier to deploy on staging from a PR to test stuff, but its a lot of overhead for stuff which I think could/should be tested more "locally"

@BlythMeister
Copy link
Contributor Author

I've run this in a mock rig without full FAKE running (linqpad script) to make sure it calls nunit ok.

But i agree, there should be a nicer way to test that the arguments being run in a process are correct without actually needing the process...but that feels really hard with the way Fake.Core.Process works,.

@BlythMeister
Copy link
Contributor Author

The other thing making this tricky is that the file created has a temporary name...and is deleted once finished...

@matthid
Copy link
Member

matthid commented Oct 8, 2018

@BlythMeister I think the following could work (will try to get some POC working locally later, maybe even with this PR):

Add another (internal) overload which gets some "process starter interface", this overload could be used for unit testing and the public one just calls this internal method with the default process api.

@BlythMeister
Copy link
Contributor Author

@matthid i've never done that sort of thing in F# before, would be interested to see it in action if you could add to this PR :D

matthid added a commit that referenced this pull request Oct 8, 2018
@matthid
Copy link
Member

matthid commented Oct 8, 2018

@BlythMeister It would look like #2131

@BlythMeister
Copy link
Contributor Author

Ooo nice, does that pr mean this one is redundant? Both can go in together?

@matthid
Copy link
Member

matthid commented Oct 9, 2018

@BlythMeister Yes I think github will mark this one as merged when I merge the other one.

Can you test if the stuff I did over there still works (I have not added a full integration test)?

@BlythMeister
Copy link
Contributor Author

@matthid the stuff over there looks good. I think the test you added does show the expected behaviour.
Granted not with all the arugument flags but the logic to generate args has not changed.

@matthid matthid merged commit da51bea into fsprojects:release/next Oct 10, 2018
@matthid matthid mentioned this pull request Oct 12, 2018
@BlythMeister BlythMeister deleted the nunitFileBasedAlways branch May 11, 2021 15:58
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.

2 participants