LeanFT在执行完成后不会破坏JVM

时间:2017-12-12 07:15:24

标签: java frameworks testng leanft

XmlSuite suite = new XmlSuite();
suite.setName("RegSuite");
XmlTest test = new XmlTest(suite);
test.setName("MyTest");
List<XmlClass> classes = new ArrayList<XmlClass>();
classes.add(new XmlClass("tests.test1"));
test.setXmlClasses(classes) ;
List<XmlSuite> suites = new ArrayList<XmlSuite>();
suites.add(suite);
TestNG tng = new TestNG();
tng.setXmlSuites(suites);
tng.run();

@test1
public void test1(){

    try{
        ModifiableSDKConfiguration config = new ModifiableSDKConfiguration();
        config.setServerAddress(new URI("ws://myServerAddress:5095"));
        SDK.init(config);
        Reporter.init();

       Browser OBrowser = BrowserFactory.Launch(BrowserType.InternetExplorer);
      Console.WriteLine("Navigating to Google.com");
      OBrowser.Navigate("Google.com");
      OBrowser.Sync();
      Reporter.ReportEvent("Browser Sync", "Browser sync completed", HP.LFT.Report.Status.Passed);
      OBrowser.Close();

      //test code

      Console.WriteLine("Generatig reports and closing SDK");

      //Generate the report and cleanup the SDK usage.
      Reporter.generateReport();
      SDK.cleanup();
    } catch(Exception e){
    }
}

在上面的场景中,我的报告已生成,一切正常,但唯一的问题是JVM永远不会终止并永远等待。请帮帮我。此外,我尝试添加@beforeclass和@afterclass方法来拆除测试和测试套件,但没有运气,同样的事情,如果尝试从Testng.XML文件运行它工作正常,但我想生成xml运行时,因为这是我的框架要求

0 个答案:

没有答案