microsoft / navcontainerhelper

Official Microsoft repository for BcContainerHelper, a PowerShell module, which makes it easier to work with Business Central Containers on Docker.
MIT License
385 stars 246 forks source link

Run-TestsInBCContainer -returnTrueIfAllPassed #660

Closed ralf-escher closed 5 years ago

ralf-escher commented 5 years ago

Hello @freddydk,

I am using Run-TestsInBCContainer to test my integration test functions and I am a little confused about the -returnTrueIfAllPassed parameter

If I use the Run-TestsInBCContainer without that parameter it shows no output (if I assign XUnitResultFileName I can check the result file)

If I now add the -returnTrueIfAllPassed parameter it shows the executed codeunits with success/failure and if all functions have passed true at the very end.

I would have expected that the routine shows the executed codeunits without the -returnTrueIfAllPassed parameter and with the parameter only "true" if all functions have passed. Or I am wrong?

my example:

  1. Standard Passed (no output)
  2. Standard Passed with -returnTrueIfAllPassed
    Codeunit 5043082 Automotive Test Sales Success (115.742 seconds)
    True
  3. Standard Failed (no output)
  4. Standard Failed with -returnTrueIfAllPassed
    Codeunit 5043083 Automotive Test Purchase Failure (10.322 seconds)
    Testfunction InboundPurchaseInvoice Failure (4.127 seconds)

navcontainerhelper 0.6.4.9 docker image mcr.microsoft.com/businesscentral/onprem:1910-de-ltsc2019

freddydk commented 5 years ago

What other parameters are you using?

Hent Outlook til iOShttps://aka.ms/o0ukef


Fra: Ralf Escher notifications@github.com Sendt: Friday, October 11, 2019 9:12:37 AM Til: microsoft/navcontainerhelper navcontainerhelper@noreply.github.com Cc: Freddy Kristiansen Freddy.Kristiansen@microsoft.com; Mention mention@noreply.github.com Emne: [microsoft/navcontainerhelper] Run-TestsInBCContainer -returnTrueIfAllPassed (#660)

Hello @freddydkhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffreddydk&data=02%7C01%7Cfreddy.kristiansen%40microsoft.com%7Cb9e06c2141f640f2208308d74e1a65cd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637063747593239558&sdata=PZJ9Vj7jByT1A8c0ztu2qnAi756FrM9tbS%2BkLQ1bB3o%3D&reserved=0,

I am using Run-TestsInBCContainer to test my integration test functions and I am a little confused about the -returnTrueIfAllPassed parameter

If I use the Run-TestsInBCContainer without that parameter it shows no output (if I assign XUnitResultFileName I can check the result file)

If I now add the -returnTrueIfAllPassed parameter it shows the executed codeunits with success/failure and if all functions have passed true at the very end.

I would have expected that the routine shows the executed codeunits without the -returnTrueIfAllPassed parameter and with the parameter only "true" if all functions have passed. Or I am wrong?

my example:

  1. Standard Passed (no output)

  2. Standard Passed with -returnTrueIfAllPassed

    Codeunit 5043082 Automotive Test Sales Success (115.742 seconds) True

  3. Standard Failed (no output)

  4. Standard Failed with -returnTrueIfAllPassed

    Codeunit 5043083 Automotive Test Purchase Failure (10.322 seconds) Testfunction InboundPurchaseInvoice Failure (4.127 seconds)

navcontainerhelper 0.6.4.9 docker image mcr.microsoft.com/businesscentral/onprem:1910-de-ltsc2019

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fnavcontainerhelper%2Fissues%2F660%3Femail_source%3Dnotifications%26email_token%3DACSGUA4I5GF5NRBSMNOGNM3QOAROLA5CNFSM4I7V63WKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HRECCHQ&data=02%7C01%7Cfreddy.kristiansen%40microsoft.com%7Cb9e06c2141f640f2208308d74e1a65cd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637063747593239558&sdata=TzhZQGiZXnV5KIKJLIoKk%2FJHljp7oFJZJdLqL4%2F0d9E%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACSGUA6G7X3T3Y3MDQJCES3QOAROLANCNFSM4I7V63WA&data=02%7C01%7Cfreddy.kristiansen%40microsoft.com%7Cb9e06c2141f640f2208308d74e1a65cd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637063747593249557&sdata=odVIwgEDA%2FKFA1fu6l%2FvCNqeQ6ftq7vVMtMhkw%2B5XD0%3D&reserved=0.

freddydk commented 5 years ago

Reason for asking is, that the returntrueifallpassed will only affect one thing - and that is the return value from the function. So you must have an error in the script - please include your full command, then I can maybe see what you do wrong?

ralf-escher commented 5 years ago
Run-TestsInBCContainer `
    -containerName $containerName `
    -companyName $companyName `
    -testCodeunit $codeunitID  `
    -returnTrueIfAllPassed
PS C:\> Run-TestsInBCContainer -containerName Industry27 -companyName TESTMANDANT -testCodeunit 5043081
PS C:\> Run-TestsInBCContainer -containerName Industry27 -companyName TESTMANDANT -testCodeunit 5043081 -returnTrueIfAllPassed
  Codeunit 5043081 Automotive Test Basic Success (0.225 seconds)
True
PS C:\> Run-TestsInBCContainer -containerName Industry27 -companyName TESTMANDANT -testCodeunit 5043083
PS C:\> Run-TestsInBCContainer -containerName Industry27 -companyName TESTMANDANT -testCodeunit 5043083 -returnTrueIfAllPassed
  Codeunit 5043083 Automotive Test Purchase Failure (7.553 seconds)
    Testfunction InboundPurchaseInvoice Failure (2.993 seconds)

Going to use -XUnitResultFileName which doesn't change the behavior.

freddydk commented 5 years ago

Are you running as administrator?

ralf-escher commented 5 years ago

No.

Now as administrator:

PS C:\BE-terna\PowerShell> Run-TestsInBCContainer -containerName Industry27 -companyName TESTMANDANT -testCodeunit 5043081
  Codeunit 5043081 Automotive Test Basic Success (0.237 seconds)
PS C:\BE-terna\PowerShell> Run-TestsInBCContainer -containerName Industry27 -companyName TESTMANDANT -testCodeunit 5043081 -returnTrueIfAllPassed
  Codeunit 5043081 Automotive Test Basic Success (0.205 seconds)
True
freddydk commented 5 years ago

Got it - that is a bug. Not that it doesn't display it - but the return value will actually be an array if you use -returntrue and run as non-admin

freddydk commented 5 years ago

Fix included in 0.6.4.10