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 the test in normal mode overwrites the config.json file. #98

Closed
alexandr-gladkiy opened this issue Jun 27, 2023 · 6 comments
Closed

Comments

@alexandr-gladkiy
Copy link

Hello James.

I'm trying to set up Test Runer and I'm running into a problem.

Running the test in normal mode completely overwrites the config.json file.

As a result, an error occurs due to the fact that the password is not specified.

Can you tell me what can be done about it? Is this a bug or is there a setting missing somewhere?

@jimmymcp
Copy link
Owner

Hi, could you give me some more information please?

When you run a test it should

  • create a new terminal
  • select the server from your launch configuration (or ask you to select the right config)
  • prompt you to choose the company to run the tests in
  • prompt you for credentials
  • run the test and download the result

What actually happens?

@alexandr-gladkiy
Copy link
Author

Hi.
Clicking on RunTest creates a new config.json in the root directory.
The test is in "running" mode until it is manually disabled.

image

image

When you click on DebugTest in the terminal is created, the choice of the server is offered, the choice of the company is offered. Crashes on testing.

Created a repository with an example.
https://github.com/SaNe4Ek123/Test

Look, please, if possible.

@jimmymcp
Copy link
Owner

jimmymcp commented Jul 3, 2023

I guess that you have the publishing from powershell option enabled in the settings. In that case you should also set the "test folder name" setting (with the name of the folder which contains your tests). You need to restart VS Code after changing this setting.

Alternatively try disabling the powershell publishing option.

@vengo2021
Copy link

vengo2021 commented Jul 3, 2023

Hello, I have the same issue.
My powershell publishing option is disabled.

======================
When you run a test it should
1. create a new terminal
image

2. select the server from your launch configuration (or ask you to select the right config) - prompts to select a config when I open a test app as folder, not in a workspace

prompt you to choose the company to run the tests in

nothing happens

prompt you for credentials

nothing happens

run the test and download the result

nothing happens

@alexandr-gladkiy
Copy link
Author

alexandr-gladkiy commented Jul 4, 2023

Good day.

I was able to achieve the launch of testing, but the test still hangs.

In the terminal, you can see that the test passes successfully, does not stop.

Apparently due to a write error in codecoverage.json

Running tests on BC-TEST, company CRONUS UK Ltd., tenant default, codeunit 800102, function TestSayHello, extension ALProject2, test runner 130450, culture en-US
WARNING: TaskScheduler is running in the container, this can lead to test failures. Specify -EnableTaskScheduler:$false to disable Task Scheduler.

Connecting to https://localhost:443/BC/cs?tenant=default&company=CRONUS%20UK%20Ltd.
Codeunit 800102 Test Hello World
Testfunction TestSayHello Success (0.007 seconds)

Downloading code coverage to .//.altestrunner//codecoverage.json
Cannot bind argument to parameter 'InputObject' because it is null.
ConvertFrom-Json : Cannot bind argument to parameter 'InputObject' because it is null.
C:\Users\sane4.vscode\extensions\jamespearson.al-test-runner-10.8.7\PowerShell\Get-CodeCoverage.ps1:24 token:59
... Result = (Invoke-InvokeWebRequest $Params).Content | ConvertFrom-Json

    CategoryInfo : InvalidData: (:) [ConvertFrom-Json], ParameterBindingValidationException
    FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertFromJsonCommand

Error occurred (Cannot validate argument for parameter 'InputObject'. Argument is NULL. Please provide a valid argument value, and then retry the command.)
Testing company set in config file exists in the container
PS 

@jimmymcp
Copy link
Owner

jimmymcp commented Jul 4, 2023

Please check the testRunnerServiceUrl setting in the AL Test Runner config file. The extension will attempt to fill this URL in but it looks like it is wrong. This is the REST endpoint to download the code coverage file from.

The InputObject being null is a bit of an obscure error indicating that the script was not able to download anything from that endpoint. You might need to correct the port and or server address.

Alternatively you can disable the code coverage option in the settings in the meantime.

Cheers,

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