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

No output from the test execution #57

Open
ricardopaiva opened this issue Feb 16, 2022 · 6 comments
Open

No output from the test execution #57

ricardopaiva opened this issue Feb 16, 2022 · 6 comments

Comments

@ricardopaiva
Copy link

Hi,
I'm trying to setup and use the AL Test Runner but I'm unable to get any output from the test execution.
What I'm using:

  1. A BC 19.2 instance running on Docker;
  2. Latest BCContainerHelper installed;
  3. Latest AL Test Runner app;

What I've done:

  1. I've installed the AL Test Runner Service and the OData service seems to be exposed;
  2. Setup the config.json file to run tests on the local Docker container

What I get:
When I try to run a test from the Test Explorer, I get the following on the Terminal:
image

I've tried to manually run the Invoke-TestRunnerService.ps1 script and debug it and here's where it stops:
image

You can see that there's no message in the error so I get no output on the Terminal:
image
I was not able to understand why the Invoke-WebRequest is failing.

I have debug the AL Test Runner Service and the TestRunner codeunit (codeunit 79151 "Test Runner JP") is being called but I guess that some error is being retrieved, I just cannot find it.
On the OnAfterTestRun trigger, the Success parameter is False but GetLastErrorText() and GetLastErrorCallStack() returns no error.

I couldn't find any related error in the container Event Viewer log.

Any hint?

@jimmymcp
Copy link
Owner

Hi, some ideas:

  • Is there a dialog being shown when you open the web client e.g. that the license has expired?
  • Looks like you are trying to debug the test? Does running the test without debugging work?
  • Can you run the same test in the AL Test Tool page and does that work?

It sounds like you're all setup OK, just trying to get some more info.

@ricardopaiva
Copy link
Author

Thanks.
In the meanwhile i just noticed that i forgot to key in the TestSuiteName in the config.json file but after i did it i get the same behavior.
I will do some more testing, based on your inputs/questions and i will let you know.

@ricardopaiva
Copy link
Author

ricardopaiva commented Feb 18, 2022

It seems like I was able to make it work by doing a change on the Test-Runner-Service app.
On the Service.codeunit.al file:

trigger OnAfterTestRun(CodeunitId: Integer; CodeunitName: Text; FunctionName: Text; Permissions: TestPermissions; Success: Boolean)
begin
    if (FunctionName = '') then
        exit;

    if not Success then begin
        Error(GetLastErrorText() + '\ \' + GetLastErrorCallStack());
    end;
end;

If seems like the FunctionName parameter when the OnAfterTestRun is being called for the first time is empty and the Success parameter is false, so an error is being retrieved all the time.
I couldn't understand why this is happening. I thought it was because of the OnRun trigger on the test codeunit but after removing it the behavior was still the same.

Does this make sense to you?

@CPSTOS
Copy link
Contributor

CPSTOS commented May 3, 2023

Hey,
I'm facing a similar problem with that piece of code. I'm trying to debug a test and the debugger won't hit any breakpoint in my test. It does stop on breakpoints in "Test Runner Service JP" though.
After the failing test hits "OnAfterTestRun" th error is not being collected, since FunctionName is empty and TestName is the current tests name:

`trigger OnAfterTestRun(CodeunitId: Integer; CodeunitName: Text; FunctionName: Text; Permissions: TestPermissions; Success: Boolean)
begin
if not Success then
if (TestCodeunitId = CodeunitId) and (FunctionName = TestName) then
Error(GetLastErrorText() + GetLastErrorCallStack());

    if not Success then
        FailedTests += 1;
end;`

Also I get "Exception of type 'Microsoft.Dynamics.Nav.Types.Exceptions.NavNCLDialogException' was thrown." in the Terminal which I can not get further details on. Not in the event log, nor via application insights.

Any idea what is keeping me from attaching the debugger to the test of choice?

Best regards

Sven

@CPSTOS
Copy link
Contributor

CPSTOS commented May 3, 2023

Is it a timing issue, because the next session actually is the test runner, which uses new sessions for each test, so those are not in scope?

@jimmymcp
Copy link
Owner

Do you see any difference if you attach the debugger yourself before debugging the test? (as opposed to the extension attaching the debugger)

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