Impt test and Builder

I have created a device.nut that uses several files using Builder cli tool.
The device.nut works fine and can be deployed with no problems.

Next I have create a test system using
impt test create --dg MyGroupId --test-file “tests/myTest.test.nut” --device-file “device.nut”

The .impt.test is created.

Then when trying to execute the actual test
impt test run --tests myTest.test.nut

I receive the next error message:
[+1.40/0.95s error] Compilation Error: There was an error with compilation.
Error: Compilation Error: There was an error with compilation.
device_code error (line 709, column 1): require must precede code
device_code error (line 710, column 1): require must precede code
device_code error (line 711, column 1): require must precede code
device_code error (line 712, column 1): require must precede code

Since the device.nut code created with Builder compiles and can be deployed with no problems.
I do not understand why the error trying to executing the impt test command.

The built “device.nut” has only 4 “#requirement” statements and all of them are in the top on the code

#require “Serializer.class.nut:1.0.0”
#require “MessageManager.lib.nut:2.4.0”
#require “utilities.lib.nut:3.0.1”
#require “CRC16.class.nut:1.0.0”

Any help is appreciated.

Thanks

This is because impt injects its own code at the start of copies of source files and then proceeds to upload those copies. The impCentral compiler will then reject your own #require statements because they are no longer at the head of your source files.

For testing, you should import those four libraries using Builder’s @include directive to load the libraries you need from their source repos.

How to use Builder include directive to include

version 1.0.0
i.e to replace
#require “Serializer.class.nut:1.0.0”

?

Thanks

Will this retrieve needed libs from Github?

/*

#require “Serializer.class.nut:1.0.0”
#require “MessageManager.lib.nut:2.4.0”
#require “utilities.lib.nut:3.0.1”
#require “CRC16.class.nut:1.0.0”
*/

@include “github:electricimp/Serializer/blob/develop/Serializer.class.nut@v1.0.0”
@include “github:electricimp/MessageManager/blob/master/MessageManager.lib.nut@v2.4.0”
@include “github:electricimp/Utilities/blob/master/utilities.lib.nut@v3.0.1”
@include “github:electricimp/CRC16/blob/v1.0.0/CRC16.class.nut@v1.0.0”

That looks right, yes. I checked the tags too

This topic was automatically closed after 60 days. New replies are no longer allowed.