PowerAssertions are a really useful feature of the groovy programming language, as they give you the full information on what is not as it is expected in the error message - the full assert statement with all information about the values.
However, when running CPS transformed, the output is less useful, as it only states what the assertion was that failed, without the values.
Take for example the following pipeline script:
Although the code is the same for NonCPS and with CPS,
NonCPS prints the following:
(I.e. the value of the whole expression and the value of b,
while the CPS transformed version prints no information whatsoever:
N.B.: running the same code in a groovysh actually gives even more information:
That one can be worked around by liberally throwing parentheses at the problem, but that again only works in the NonCPS case:
This makes the assert statement almost useless for writing test jobs for your global library methods, so it would be a really nice addition if the information could be preserved and be added to the message of the PowerAssertionError.
|Field||Original Value||New Value|
|Remote Link||This issue links to "AssertBlock.java#L47 the line where the sourceCode is passed as the error message (Web Link)" [ 15386 ]|
|Component/s||pipeline [ 21692 ]|
|Assignee||Jesse Glick [ jglick ]|
|Component/s||workflow-api-plugin [ 21711 ]|
|Component/s||workflow-cps-plugin [ 21713 ]|
|Remote Link||This issue links to "PR 64 (Web Link)" [ 20079 ]|
|Resolution||Fixed [ 1 ]|
|Status||Open [ 1 ]||Resolved [ 5 ]|