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

Running tests locally #26

Open
bjarkihall opened this issue Oct 22, 2020 · 6 comments
Open

Running tests locally #26

bjarkihall opened this issue Oct 22, 2020 · 6 comments

Comments

@bjarkihall
Copy link
Contributor

Hi and thanks for a great extension!
I've been wondering for a while if it's possible to run the tests locally instead of in a container?

I know it's docker-based:
https://github.com/jimmymcp/al-test-runner/blob/master/PowerShell/Invoke-RunTests.ps1

which invokes:
https://github.com/microsoft/navcontainerhelper/blob/master/AppHandling/Run-TestsInNavContainer.ps1

which then uses:
https://github.com/microsoft/navcontainerhelper/blob/master/AppHandling/PsTestFunctions.ps1

So I've been wondering if the local option would be possible by optionally running the scripts straight from PsTestFunctions instead of doing it inside a container?
This is generally a question if it's possible and how you would approach it in this repo, would I even be able to submit a PR?

@jimmymcp
Copy link
Owner

Hi Bjarki,

I'm sure it would be possible to run those scripts against a local installation, rather than a Docker container. I don't have time to investigate that myself at the moment, but you'd be very welcome to implement it yourself and submit a PR.

I suppose there would need to a new config key to indicate that the BC server isn't running inside a container. Ideally we'd reuse some functions in the bccontainerhelper function to run the tests but I'm not aware that there are any functions for running tests outside containers?

@bjarkihall
Copy link
Contributor Author

Yeah, PsTestFunctions's "Run-Tests" interacts with a client context that uses the service dlls to interact with the test page.

I was going to reference the file directly but some paths are hardcoded, since BcContainerHelper assumes certain things to be in certain places, but it seems like it would technically be possible to write a file like Run-TestsInNavContainer.ps1 which just runs a script similar to PsTestFunctions.ps1 straight away, instead of using Invoke-ScriptInBCContainer.

I might experiment by cloning this repo and Freddy's scripts and see where it leads me (e.g. how much of the scripts could be left unmodified) and I was mainly curious how these kind of files would fit within the project before starting, and if you'd tried local setup before. Thanks for your feedback. :) I'll let you know if I do this.

I've also heard rumors that MS is going to implement a testing dev-endpoint with an API for vscode, so maybe I'll just be waiting for that. Might not be soon though since there are still things missing like code-coverage, etc.

Btw. do you want me to close the issue or keep it open?

@jimmymcp
Copy link
Owner

Thanks. It might make sense to speak to Freddy about this first, see what he thinks about including a new function in bccontainerhelper to run tests against a local service tier. He might also have more info about when they will implement a new way to execute tests and whether it is worth pursuing this in the meantime.

We can leave this issue open for now to remind me the conversation is ongoing!

@freddydk
Copy link

What version are you going to run tests in?

@freddydk
Copy link

Run-Tests has a parameter called -connectFromHost and -useUrl - with those two set, the function is almost able to run without a container (it still copies something from a container I think, but you could find those on the dvd - newtonsoft and one more)

@bjarkihall
Copy link
Contributor Author

What version are you going to run tests in?

We're currently only planning on testing on latest releases, so we're on BC 17 now and update as MS releases new versions - so there's no need to backport to e.g. versions 14/15/16, if that helps.

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

3 participants