0

We have a large automated test suites that seperates test out into 4 groups. These 4 groups are ran on different remote machines. Occasionaly, tests will start to fail and we get the following error message

HP.LFT.Communication.SocketClient.CommunicationException : Send: client is not connected

This just happens out of no where and it causes all the tests afterwards to fail. Is there anyway to fix this issue?

Tree55Topz
  • 1,102
  • 4
  • 20
  • 51
  • The question is too broad as is. Try to be more specific and let us know what SDK, if parallel execution is used, what technology, etc. – Adelin Jul 03 '18 at 07:29
  • Fair enough, this is automation for a Windows app, so WPF. We sort of fake parallel since we manually split them up into groups, but all VMs have valid licenses so there is no license issue there. We code our tests using C#. I am not sure what other failure details there is to give you as LeanFT kind of sucks in that department. Not to mention, going to the doc on this error tells you nothing – Tree55Topz Jul 03 '18 at 12:59
  • There's also WinForms, Java, etc. for a Windows app, "so WPF" is not a valid *so*. I asked about parallel execution since `client is not connected` issues are often thrown when multiple tasks are operating the exact same app and one of the tasks does a LeanFT disconnect (call to `SDK.cleanup()`) while another task still tries to query the AUT. Concurrency should be dealt with accordingly. – Adelin Jul 03 '18 at 13:06
  • You can try to debug by looking at the logs in the `%localappdata%/hewlet-packard/LeanFT/logs`. There are multiple debug levels so if you don't see much of info you might need to enable other levels. What LeanFT version are you using? – Adelin Jul 03 '18 at 13:11
  • Hmmm this may actually be the case.. I wonder if theres an issue with a group finishing first and cleaning up. Not sure. Will check out the debug, we run V 14.02 – Tree55Topz Jul 03 '18 at 13:47
  • You can [follow these 5 steps to enable higher debug levels](https://community.softwaregrp.com/t5/Unified-Functional-Testing-User/LeanFT14-0-2816-0-com-hp-lft-sdk-GeneralLeanFtException-general/m-p/1643680/highlight/true#M29152) prior to generating the issue. Inspecting the resulting log might hint you with what caused the issue in the first place. I'll post an answer to conclude this topic – Adelin Jul 03 '18 at 13:50

1 Answers1

1

client is not connected issues are often thrown when multiple tasks are operating the exact same app and one of the tasks does a LeanFT disconnect (call to SDK.cleanup()) while another task still tries to query the AUT.

These issues do not have a one-off solution. They are generally fixed case by case and needs to be debugged in the context of the very execution.

In that direction, you can increase the already existent debug log levels by following the steps mentioned in this thread:

  1. Create the following directory: %localappdata%\Hewlett-Packard\LeanFT\LogConfigurations
  2. In that directory create a file named leanft.runtime.log.config.json
  3. Enter the following text in the file and save it:

    {
      "levels": {
      "[all]": "trace"
    },
      "appenders": [{
        "type": "file",
        "absolute": true,
        "filename": "c:/hpe.leanft.runtime.log",
        "maxLogSize": 5242880,
        "backups": 5
      }]
    }
    
  4. restart the engine

  5. reproduce the issue

And

  1. Check the logs to see which step closed the connection and fix the concurrency issue.
Adelin
  • 7,809
  • 5
  • 37
  • 65
  • Ok, I went ahead and created this directory and config.json file. About to kick off the suite. It normally happens around 45 mins in. Which file should I look for to debug in the logs? – Tree55Topz Jul 11 '18 at 19:34
  • The one set at `filename`. In my sample, `hpe.leanft.runtime.log` – Adelin Jul 11 '18 at 19:37
  • Now I can not seem to reconnect to the runtime engine :( I added this directory and file but when I enable leanFT it pops up and dissapears quick – Tree55Topz Jul 11 '18 at 20:27
  • Hmm it could be that it doesn’t have write access. Try changing the filename path to a trivial one, like my documents – Adelin Jul 11 '18 at 20:29
  • One more question though, no where in our code do we call the .cleanup(). Is this something that LeanFT just does when a suite finishes? My guess is that since we have 4 seperate groups of tests running on different VMs, if one finishes it messes up all the others. Any way to adjust this? – Tree55Topz Jul 11 '18 at 20:33
  • Well, there must be some kind of file named UnitTestClassBase or something similar, in which this happens. Different vms = different engine? If not then yes, most likey that is why the issue occurs – Adelin Jul 11 '18 at 20:35
  • Yes we do have a UnitTestClassBase where we have all of our set ups. We use NUnit as the test runner, but no where in this class do we call cleanup(). – Tree55Topz Jul 11 '18 at 20:43
  • Check a bit deeper. It extends from UnitTestBase as well which gets TestTearDown method and TestSuiteTearDown, where the ‘magic’ happens – Adelin Jul 11 '18 at 20:50
  • It is saying that this UnitTestBase class comes from metadata? Looking at this, its just an abstract class. no cleanup() or anything called here as well – Tree55Topz Jul 11 '18 at 21:03
  • You should’t edit. Actually in your case you might very well be better off calling init and cleanup yourself, and no longer extend that class. [here](https://admhelp.microfocus.com/leanft/en/14.03/HelpCenter/Content/HowTo/CustomFrameworks.htm) they talk about how they do that – Adelin Jul 11 '18 at 21:06
  • Thank you! will try that! could it also be that we have some test classes that are missing the [TextFixture] tag above them? – Tree55Topz Jul 11 '18 at 21:07
  • TestFixture should be put only on classes that implements [Test] methods, and those classes should try and implement only such kind of methods – Adelin Jul 11 '18 at 21:08
  • right, but what happens if a class does not have that tag? what does it do exactly? I see a couple of classes that still run with the suite that do not have that tag. Does this mean they follow a different set of teardown rules? – Tree55Topz Jul 11 '18 at 21:09
  • or are you saying that we should not have that tag if we want it to follow the rules in UnitTestClassBase? – Tree55Topz Jul 11 '18 at 21:16
  • That tag is nunit related. It tells nunit that a specific class will have tests in it. But the tests can make use of other classes, even if they do not have that tag. That is pure c# thereafter. I might have delays in my replies until tomorrow. It’s 00:00 on this part of the earth :) – Adelin Jul 11 '18 at 21:17
  • Thank you for all your help Adelin! I think we will be able to solve this disconnect issue over time. We restarted the serve that was holding our licenses and we are not seeing this issue. We are however still seing a HP.LFT.SDK.GeneralReplayException : Exception of type 'System.OutOfMemoryException'. Do you know anything about this error? Does the engine have a certain limit of tests it can handle? – Tree55Topz Jul 12 '18 at 15:06
  • You're welcome. That sounds like a C# exception that was handled by leanft and got rethrown a bit modified. Try looking into why `System.OutOfMemoryException` is thrown at all. For example, you could [start here](https://stackoverflow.com/questions/1153702/system-outofmemoryexception-was-thrown-when-there-is-still-plenty-of-memory-fr) – Adelin Jul 13 '18 at 05:11