< Back

ConvertTo-ALTestCodeunit

Fri Jan 10, 2020 9:13 pm

NAME ConvertTo-ALTestCodeunit



SYNOPSIS

Converts one or more test features to an AL codeunit.





SYNTAX

ConvertTo-ALTestCodeunit [-CodeunitID] <Int32> [-CodeunitName] <String> [-Feature <TestFeature[]>]

[-GivenFunctionName <String>] [-InitializeFunction] [-ThenFunctionName <String>] [-WhenFunctionName <String>]

[<CommonParameters>]





DESCRIPTION

Converts one or more test features to an AL codeunit. Each scenario contained in a feature will result in 1 test

function. Each given , when and then tag in a scenario will result in a helper function placeholder to be

completed by manual AL coding.





PARAMETERS

-CodeunitID <Int32>

ID of the new test codeunit



Required? true

Position? 0

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-CodeunitName <String>

Name of the new test codeunit



Required? true

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Feature <TestFeature[]>

The feature(s) whose scenarios must be included in the test codeunit



Required? false

Position? named

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-GivenFunctionName <String>

Specify the format for the AL function that is created for a Given element. Use the placeholder {0} to specify

where you want the Given's situation description to go. Leaving a space between the placeholder and the rest

of your text ensures that it's seen as a separate word, and therefore gets an initial capital letter when

converting to title case, e.g. 'Create {0}' for a Given whose situation is 'a Customer' will lead to

'CreateACustomer' as the function name.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InitializeFunction [<SwitchParameter>]

Include this switch if you want to have an Initialize function setup for the test codeunit



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-ThenFunctionName <String>

Specify the format for the AL function that is created for a Then element. Use the placeholder {0} to specify

where you want the Then's expected result description to go. Leaving a space between the placeholder and the

rest of your text ensures that it's seen as a separate word, and therefore gets an initial capital letter when

converting to title case, e.g. 'Verify {0}' for a Given whose situation is 'customer exists' will lead to

'VerifyCustomerExists' as the function name.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-WhenFunctionName <String>

Specify the format for the AL function that is created for a When element. Use the placeholder {0} to specify

where you want the When's condition description to go. Leaving a space between the placeholder and the rest of

your text ensures that it's seen as a separate word, and therefore gets an initial capital letter when

converting to title case.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

ATDD.TestScriptor.TestFeature[]







OUTPUTS

System.Object







NOTES









-------------------------- Example 1 --------------------------



PS C:\\> Feature 'My Feature' { Scenario 1 'My Scenario' { Given Foo; When Baz; Then Bar } } |

ConvertTo-ALTestCodeunit -CodeunitID 81000 -CodeunitName 'My Test Codeunit'

codeunit 81000 "My Test Codeunit"







RELATED LINKS