-
Notifications
You must be signed in to change notification settings - Fork 243
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
Run-TestsInBcContainer
sometimes does not seem to find any tests to run
#3441
Comments
I just happend to encounter it (somewhat). Here's what I did:
The I ran the following scripts, each within about 5-10sec from each other:
As you can see only the third call actually returned any output. |
Is this a timing issue? |
I was playing around a bit more and noticed the following: I did everything as explained above (new database from .bak, restart service, install stuff ...). But then, instead of using BCCH, I opened up the command line test runner page (130455) in the BC web client and repeatedly kept inserting (and removing) the ID of my codeunit in the "Test Codeunit Range" field for about 5 minutes. The tests never ever showed up in the repeater below. Then after the 5min I opened a second session and did the same, and the tests were instantly there on the first try. Then I returned to my previous session and on the first try the tests also appeared. Looks like |
OK - and if you wait 5 minutes before creating the first session - does it then appear? |
Don't know, how would I verify that?
No. The more things I try the more it gets confusing. Is it possible that an app is not really "loaded" until it is used? I am asking because until now I have (consciously) not provided an app-ID because I wanted to run all tests on the system and avoid to filter by app ID. And when not providing the app ID to When I provide the app ID however, it works on the first try. Is this intended? I would've expected the parameter |
If the AppId is not provided, I believe you must populate the test suite manually using an install codeunit or like. |
Maybe it's just a missing function call? navcontainerhelper/AppHandling/PsTestFunctions.ps1 Lines 345 to 351 in f578432
You're not setting the value from Also |
In the non-extensionId scenario it is enumerating the repeater in the page, finding lines with that codeunit id. |
I have added a few comments to your PR |
Seen that. But hold your horses, it's not even a PR yet. I am still working on it. |
:-) - you added a link to it - so I thought you wanted comments |
Not explicitly, no. But hey :) Anyway. I updated my code and pushed it again. I've opened PR #3492 so we can continue discussion there. |
#3441 Adds new parameter "testCodeunitRange" to `Get-TestFromBcContainer` and `Run-TestsInBcContainer` that allows filling the test suite by using a codeunit-filter and using the TestCodeunitRangeFilter field already present on the command line test tool. --------- Co-authored-by: The Dumb <thomas.torggler@eos-solutions.it>
Describe the issue
Run-TestsInBCContainer
(and to some extent alsoGet-TestsFromBcContainer
) sometimes fail to load the tests into the test suite even though test codeunits exist on the server.This only seems to happen if apps containing tests have been installed just moments before the cmdlets are invoked. I therefore assume it is some kind of cache/async/state issue. When I run the same exact script a few seconds later the test codeunits are correcty loaded. Maybe the client session state is not yet done loading the tests before the cmdlet returns?
One more hint that pointed me in that direction is the fact that the action "Get Test Codeunits" on the normal AL test runner (not the command-line one) usually takes a very long time the first time it is run.
I have worked around this issue by repeatedly invoking
Get-TestsFromBcContainer
until it returns something and then continue (or until it returned nothing after 3 tries and then I fail the script). However, this is a bit messy as I never really know if the tests that I found are actually the ones I wanted or tests that were present already from before.Unfortunately I cannot provide you a simple repro. This does seem to be related to the NST cache in some way. Once it happens, it's hard to reproduce. Even starting/stopping the service or the entire container not always yields this behaviour.
Scripts used to create container and cause the issue
Just install some apps (in whatever way) that contain test codeunits and then run the codeunits using
Full output of scripts
Then nothing more as BCCH seems to find no codeunits to run. As I said: I am hardly able to reproduce on-demand.
Screenshots
n/a
Additional context
The text was updated successfully, but these errors were encountered: