Skip to main content

Testing your Extension

Once your extension is available to be executed, Insomnia ( a Chrome Extension) is a useful tool that help us to execute our services easily and quickly.

As we need a Session, we need to start with a login, then we are able to execute our Extension.

Extension Testing

In example below, I have replaced my actual password and apiKey by "*******" but you have to write your actual tenantId, password and apiKey.



Testing Extension Behaviour


At the beginning, you can test your Extension with a simple main method until get a "good enough" version.

Testing Extension Behaviour

JAVA
public class ScriptExtension {
    
    public static void main(String[] args) throws IOException{
        ServiceProvider sp = new ServiceProvider();                        
        ObjectMapper mapper = new ObjectMapper();
        String jsonScript="{\n" +
"    \"name\":\"ScriptServiceRequest\",\n" +
"    \"cantaraVersion\":\"5.0\",\n" +
"    \"path\":\"/Users/pbrizuela/\",\n" +
"    \"tenantId\":\"100032\",\n" +
"    \"apiKey\":\"123\",\n" +
"    \"workingDirectory\":\"/Users/pbrizuela/wd/\",\n" +
"    \"script\":\"test.sh\",\n" +
"    \"params\":[ \"pedro\", \"lilo\" ]\n" +
"}";
        ScriptRequest request = mapper.readValue(jsonScript, ScriptRequest.class);         
        ScriptResponse scriptResponse = sp.executeScriptRequest(request, null);
    }
}




























JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.