Package org.testng

Examples of org.testng.TestNG.run()


    TestListenerAdapter tla = new TestListenerAdapter();
    TestNG tng = create();
    String testngXmlPath = getPathToResource("sanitycheck/test-b.xml");
    tng.setTestSuites(Arrays.asList(testngXmlPath));
    tng.addListener(tla);
    tng.run();
    Assert.assertEquals(tla.getPassedTests().size(), 4);
  }

  /**
   * Checks that suites created programmatically also run as expected
View Full Code Here


    result.getXmlClasses().add(new XmlClass(SampleTest2.class.getCanonicalName()));

    TestNG tng = new TestNG();
    tng.setVerbose(0);
    tng.setXmlSuites(Arrays.asList(new XmlSuite[] { xmlSuite }));
    tng.run();
  }
}
View Full Code Here

    XmlSuite suite = createSuite("DistributedSuite1", new Class[] { Test1.class, Test2.class });
    tng.setXmlSuites(Arrays.asList(new XmlSuite[] { suite }));
   
    TestListenerAdapter result = new TestListenerAdapter();
    tng.addListener(result);
    tng.run();
   
    String[] passed = {
        "f1", "f2"
    };
    String[] failed = {};
View Full Code Here

    TestListenerAdapter tla = new TestListenerAdapter();
    TestNG tng = create();
    String testngXmlPath = getPathToResource("sanitycheck/test-s-b.xml");
    tng.setTestSuites(Arrays.asList(testngXmlPath));
    tng.addListener(tla);
    tng.run();
    Assert.assertEquals(tla.getPassedTests().size(), 4);
  }

  /**
   * Child suites have same names
View Full Code Here

  @Test(expectedExceptions = TestNGException.class, expectedExceptionsMessageRegExp = "\\s*Two suites cannot have the same name.*")
  public void checkChildSuitesFails() {
    TestNG tng = create();
    String testngXmlPath = getPathToResource("sanitycheck/test-s-a.xml");
    tng.setTestSuites(Arrays.asList(testngXmlPath));
    tng.run();
  }

  /**
   * Checks that suites created programmatically also fails as expected
   */
 
View Full Code Here

    testng.setTestClasses(new Class[] {FailingIterableDataProvider.class});
    TestListenerAdapter tla = new TestListenerAdapter();
    testng.addListener(tla);
    testng.setVerbose(0);
    try {
      testng.run();
    } catch (RuntimeException e) {
      Assert.fail("Exceptions thrown during tests should always be caught!", e);
    }
    Assert.assertEquals(tla.getFailedTests().size(), 1,
      "Should have 1 failure from a bad data-provider iteration");
View Full Code Here

      result.getXmlClasses().add(new XmlClass(SampleTest2.class.getCanonicalName()));
    }

    TestNG tng = create();
    tng.setXmlSuites(Arrays.asList(xmlSuite1, xmlSuite2));
    tng.run();
  }
}
View Full Code Here

      tng.setMethodInterceptor(new FastTestsFirstInterceptor());
    }
    TestListenerAdapter tla = new TestListenerAdapter();
//    tng.setParallel("methods");
    tng.addListener(tla);
    tng.run();

    Assert.assertEquals(tla.getPassedTests().size(), 3);
    ITestResult first = tla.getPassedTests().get(0);

    String method = "zzzfast";
View Full Code Here

  @Test(description = "Ensure that if a listener is present, we get test(), onSuccess()," +
      " afterMethod()")
  public void listenerShouldBeCalledBeforeConfiguration() {
    TestNG tng = create(OrderedListenerSampleTest.class);
    tng.run();
    Assert.assertEquals(SimpleListener.m_list, Arrays.asList(1, 2, 3, 4));
  }

  @Test(description = "TESTNG-400: onTestFailure should be called before @AfterMethod")
  public void failureBeforeAfterMethod() {
View Full Code Here

  }

  @Test(description = "TESTNG-400: onTestFailure should be called before @AfterMethod")
  public void failureBeforeAfterMethod() {
    TestNG tng = create(FailingSampleTest.class);
    tng.run();
    Assert.assertEquals( SimpleListener.m_list, Arrays.asList(4, 5, 6));
  }

  @Test(description = "Inherited @Listeners annotations should aggregate")
  public void aggregateListeners() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.