Search code examples
javajunitleanft

LeanFT and test in multiple browsers


I am new to LeanFT and JUnit, LeanFT docs doesn't shed much light on how to use it.

I need to run my test, written in JUnit/MeanFT mesh, in more than one browser.

Now it looks like this:

@Test
    public void testverify_Startsida() throws GeneralLeanFtException, Exception {

        //Open browser
        Browser browser = BrowserFactory.launch(BrowserType.CHROME);

The docs says that BrowsterType can be an array of browsers, but I havn't figured out how, all my tries ends in crash and burn.

I might be embarising myself with this but hey youre nice guys and all. :)


Solution

  • I think I'm in a position to answer your query. Few months back I was in the same position as yours. I banged my head while trying to get multi-threading going in leanft. For the record, LeanFT does not support multi-threading(check out the FAQ section here).

    But I have figured out a sort of work-around to get LeanFT going on multiple machines with a small help from selenium. In one of my blog post(though its in C#, the core working in Java remains the same), I have mentioned how we can work with Selenium and LeanFT in one script(this can give you tremendous power since you can use best of both worlds).

    So if you want to get multi-threading going, I would suggest you to launch multiple drivers from selenium and attach to those drivers by using the BrowserFactory.getAllOpenBrowsers() function in LeanFT. Do let me know if this helps.