hp-ufthp-almleanft

LeanFT license status when JAR file is executed


How could LeanFT check licensing status, when JAR file is generated from a LeanFT project and executed without use of an IDE? In this case LeanFT runtime engine isn't started and URL of license server is not stored in jar file.


Solution

  • LeanFT is more than just that .jar file, and the engine logic takes place somewhere else. Roughly, LeanFT consists of two main parts:

    1. LeanFT client
      • is the SDK with all the tests. In your case, a .jar file, but could've been a .cs or .js test and would have acted just the same.
      • has code like Browser.launch and Element.click.
      • these are commands that are sent to the LeanFT engine
    2. LeanFT engine
      • among others, is a websocket server that listens to commands, interprets and executes them

    The whole journey a command makes is roughly something as follows:

    1. LFT.init is executed somewhere in the code.

      • It initiates the connection with the right socket server, configured either in a properties file (for java, it is leanft.properties file), or at runtime, via a configuration object (for java, it is a ModifiableSDKConfiguration object). Some minimal guidance regarding this configuration can be found here
      • this server can be on any computer on the accessible network, but the engine must be there too! (there are a lot of details regarding this here)
      • Without this command, the test will fail because any command (like click) can't execute as there is no WS connection
    2. Element.click is executed somewhere later in the code
    3. SDK constructs and sends a message to the engine (through websocket connection)
    4. The engine checks if it has a valid license and if all good it performs the command.

    Visualized, it is something like this:

    enter image description here