1
0
-1

I'm trying to test a service with a mock service connection, which passes in a custom endpoint, username and password.

I've followed the steps mentioned in this post: In Fluent API how do I create and add a SvcConn to a SvcDef?, and it works when I run it in the IntelliJ unit test runner, but when it's run in the Svc-Test or App-Test Ant build tasks, the svcDef.svcConn is not initialised with the parameters from my service conn json file.

What are the steps to load the test svcConn into the environment used by the Ant tasks?

    CommentAdd your comment...

    3 answers

    1.  
      1
      0
      -1

      Hi 

      Not sure if that is a bug. Command "svc-test" does not know about all the object definitions/references that should be loaded. That is why we have app-svc-test, which loads everything which is defined in the app-package-def.json.

      Please use "app-svc-test" and point to your svc connection in the app-package-def.json.

      Regards
      Rado

      PS. Here is an example

      app-package-def.json
      {
        "name": "MyAppPackage",
        "description": "TODO...",
        "clientCode": "maguire",
        "connections": [
          "/connections/svcconnection.json"
        ],
        "delivery": [],
        "forms": [
          "forms/myform/form-def.json"
        ],
        "properties": [],
        "services": [
          "com/avoka/svc/service-def.json"
        ]
      }
      1. Sean Colyer

        App-test doesn't run unit tests by default. I also can't find documentation on what the src/test-def.json should look like. Do you have any examples you can share?

      2. Sean Colyer

        Also, this seems like a strange design decision. Are you saying that there is no way to run a unit test  against a service that calls an HTTP endpoint with specified user name and password in Ant by design?

        If that's the case, what is the point of svc-test? If I can't use it to test a basic service that makes a HTTP call, what is it for? 

      3. Radoslav Ivanov

        I meant "app-svc-test". I edited the initial answer and added example.

      4. Sean Colyer

        So I have to manually declare all of my services?

      5. Sean Colyer

        Rado, I have started to test this (sorry it's taken a while, I had to attend to a few other things). When I add my service to app-package-def.json the svcCon loads the user name and password but DOES NOT load the service parameters specified in the service-def.json into the svcDef.paramsMap.

        Running the unit tests via the IntelliJ unit test runner does populate all of these however.  What do I need to do to the Ant build jobs to get this working?

        Thanks,

        Sean

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Miroslav tells me that this is a bug in the Transact SDK and it's been reported.

      Rado - are you aware of this one and can you advise on when we might see a fix please?

      Thanks,

      Sean

      1. Miroslav Botka

        hi Sean Colyer, we are discussing the issue internally with Rado. I'll let you know the outcome.

      CommentAdd your comment...
    3.  
      1
      0
      -1

      hi Sean, is your service connection deployed on the TM instance.

      I believe when you run a remote unit test of a service configured with a service connection, the test runner would fetch the service connection configured and linked in TM, not the one configured in your local service conn json (unless the same service conn is already deployed in TM as a part of a app package from your IDE).

      1. Sean Colyer

        Hi Miroslav,

        The service connection does exist on our TM instance. I'm not using the svc-test-remote Ant task though, just svc-test. Either way I'm not seeing evidence of the HTTP endpoint, username and password configured in TM appearing in my tests either (they are loaded in as null).

        It would appear that the Ant task is ignoring both my local JSON configuration and TM.

        I have not yet deployed an app package but the services are all part of the same App package in my IDE.

      CommentAdd your comment...