Business Central BC180 On Premise / Test environment

GeertsJGeertsJ Member Posts: 2
edited 2021-05-07 in NAV Three Tier
I am a (junior) developer in a Business Central development team, we want to set up a test environment to unittest our .al solutions. Via a Mastering BC book we find out that you have to include the following .app packages in your .alpackages folder:

Microsoft_Any.app
Microsoft_Library Assert.app
Microsoft_Library Variable Storage.app
Microsoft_System Application Test Library.app
Microsoft_Test Runner.app
Microsoft_Tests-TestLibraries.app

Then when we want to use Assert.AreEqual we see the error:

c:\work\BusinessCentral\Solution\BaseAppExt\Test\CustLedgerEntryTest.CodeUnit.al (116,13): error AL0118: The name 'Assert' does not exist in the current context.

If I download the symbols I get (no errors):

All reference symbols have been downloaded

When I inspect Microsoft_Tests-TestLibraries.app in VSCode I see at Codeunits the Codeunit Assert with id 130000, if I want to view it via Go to definition I get the error:

Object definition is not available.

In several links I Googled I think you should do Publish-NAVApp / Install-NAVApp via Powershell, but with several attempts to get this done, I have not yet succeeded.
Is there a clear description somewhere on how to activate such a test environment so that I can then use the Assert?

Answers

  • krikikriki Member, Moderator Posts: 9,115
    [Topic moved from 'Testing' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • GeertsJGeertsJ Member Posts: 2
    We have found the solution!:

    Suppose the following BC installation path is used: c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD.

    Suppose the following BV service is used: BC180

    Do the following steps in the exact order:

    1] Start Administrator Business Central Administration Shell (run as administrator)

    2] Run following (40 times Publish-NAVApp):

    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\testframework\testlibraries\Any\microsoft_any.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\testframework\testlibraries\Assert\microsoft_library assert.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\testframework\testlibraries\variable storage\microsoft_library variable storage.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\System Application\test\microsoft_System Application Test Library.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-TestLibraries.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\testframework\TestRunner\Microsoft_Test Runner.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Library-NoTransactions.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Bank.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Cash Flow.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Cost Accounting.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-CRM integration.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Data Exchange.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Dimension.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-ERM.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Fixed Asset.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-General Journal.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Graph.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Integration.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Invoicing.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Job.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Local.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Marketing.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Misc.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Monitor Sensitive Fields.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Permissions.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Physical Inventory.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Prepayment.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Rapid Start.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Report.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Resource.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Reverse.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-SCM.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-SINGLESERVER.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-SMB.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-SMTP.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-TestLibraries.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Upgrade.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-User.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-VAT.app"
    Publish-NAVApp -ServerInstance BC180 -Path "c:\install\Business Central\Dynamics.365.BC.23795.NL.DVD\Applications\BaseApp\Test\Microsoft_Tests-Workflow.app"

    3] In Business Central Administration: activate your BC180 service, section Development, toggle "Enable Test Automation". Restart the service.

    4] Start your Business Central On Premise envirionment: Extension Management. Install manually all the 40 extensions you have published.

    5] In your app.json add:

    "dependencies": [
    {
    "id": "23de40a6-dfe8-4f80-80db-d70f83ce8caf",
    "publisher": "Microsoft",
    "name": "Test Runner",
    "version": "18.0.0.0"
    },
    {
    "id": "5d86850b-0d76-4eca-bd7b-951ad998e997",
    "publisher": "Microsoft",
    "name": "Tests-TestLibraries",
    "version": "18.0.0.0"
    },
    {
    "id": "9856ae4f-d1a7-46ef-89bb-6ef056398228",
    "publisher": "Microsoft",
    "name": "System Application Test Library",
    "version": "18.0.0.0"
    },
    {
    "id": "5095f467-0a01-4b99-99d1-9ff1237d286f",
    "publisher": "Microsoft",
    "name": "Library Variable Storage",
    "version": "18.0.0.0"
    },
    {
    "id": "e7320ebb-08b3-4406-b1ec-b4927d3e280b",
    "publisher": "Microsoft",
    "name": "Any",
    "version": "18.0.0.0"
    },
    {
    "id": "dd0be2ea-f733-4d65-bb34-a28f4624fb14",
    "publisher": "Microsoft",
    "name": "Library Assert",
    "version": "18.0.0.0"
    }
    ],

    6] Download Symbols in VSCode, (re)compile and (re)publish
Sign In or Register to comment.