You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Christofer Dutz <ch...@c-ware.de> on 2018/10/22 16:03:25 UTC

Support for Groovy in tests ...

Hi all,

I just wanted to tell you about the latest addition to the build.
As I am not a big fan for mixed production code, when it comes to testing, Groovy with it’s support for custom DSLs.
I tried adding groovy compiler support for test code as well as added a first test with a few basic Groovy tests using the Spock framework.

You can find this in plc4j/protocols/driver-bases/base/src/test/groovy

I wrote a Spock test, that pushes the test-coverage of all of the Default FieldItems to almost 100% (Still need to define the input for the last two types)
While at it I found quite a number of errors and inconsistencies (When relying on the DefaultByteFieldItem.getByte method … this now works differently but more in line with all the others)

Feel free to check out these changes and please provide any problems you have with this.

This is just an example on how we could utilize it.

Chris

PS: I know the build is breaking, but this is due to a config problem infra is having … guess as soon as they fix their sonarqube config, it should be back to green.

Re: Support for Groovy in tests ...

Posted by Christofer Dutz <ch...@c-ware.de>.
So as there currently seems to be some problems with the Asf Sonar server (They activated authentication yesterday).
I temporarily disabled the step in order to get SNAPSHOTS out again.

Chris

Am 22.10.18, 17:03 schrieb "Christofer Dutz" <ch...@c-ware.de>:

    Hi all,
    
    I just wanted to tell you about the latest addition to the build.
    As I am not a big fan for mixed production code, when it comes to testing, Groovy with it’s support for custom DSLs.
    I tried adding groovy compiler support for test code as well as added a first test with a few basic Groovy tests using the Spock framework.
    
    You can find this in plc4j/protocols/driver-bases/base/src/test/groovy
    
    I wrote a Spock test, that pushes the test-coverage of all of the Default FieldItems to almost 100% (Still need to define the input for the last two types)
    While at it I found quite a number of errors and inconsistencies (When relying on the DefaultByteFieldItem.getByte method … this now works differently but more in line with all the others)
    
    Feel free to check out these changes and please provide any problems you have with this.
    
    This is just an example on how we could utilize it.
    
    Chris
    
    PS: I know the build is breaking, but this is due to a config problem infra is having … guess as soon as they fix their sonarqube config, it should be back to green.