• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ITestClass类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.testng.ITestClass的典型用法代码示例。如果您正苦于以下问题:Java ITestClass类的具体用法?Java ITestClass怎么用?Java ITestClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ITestClass类属于org.testng包,在下文中一共展示了ITestClass类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onBeforeClass

import org.testng.ITestClass; //导入依赖的package包/类
@Override
public void onBeforeClass(ITestClass testClass) {
    try {
        String device = testClass.getXmlClass().getAllParameters().get("device").toString();
        String className = testClass.getRealClass().getSimpleName();
        deviceAllocationManager.allocateDevice(device,
                deviceAllocationManager.getNextAvailableDeviceId());
        if (getClass().getAnnotation(Description.class) != null) {
            testDescription = getClass().getAnnotation(Description.class).value();
        }
        reportManager.createParentNodeExtent(className,
                testDescription);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:saikrishna321,项目名称:AppiumTestDistribution,代码行数:17,代码来源:AppiumParallelTestListener.java


示例2: onBeforeClass

import org.testng.ITestClass; //导入依赖的package包/类
public void onBeforeClass(final ITestClass testClass) {
    final String uuid = UUID.randomUUID().toString();
    final TestResultContainer container = new TestResultContainer()
            .withUuid(uuid)
            .withName(testClass.getName());
    getLifecycle().startTestContainer(container);
    classContainerUuidStorage.put(testClass, uuid);
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:9,代码来源:AllureTestNg.java


示例3: onAfterClass

import org.testng.ITestClass; //导入依赖的package包/类
public void onAfterClass(final ITestClass testClass) {
    if (!classContainerUuidStorage.containsKey(testClass)) {
        return;
    }
    final String uuid = classContainerUuidStorage.get(testClass);
    getLifecycle().stopTestContainer(uuid);
    getLifecycle().writeTestContainer(uuid);
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:9,代码来源:AllureTestNg.java


示例4: onStart

import org.testng.ITestClass; //导入依赖的package包/类
/**
 * Invoked when tests from a new class are about to start 
 * @param testClass the class under test
 */
public void onStart( ITestClass testClass ) {

    if (ActiveDbAppender.getCurrentInstance() != null) {

        String suiteName = testClass.getName();
        String suiteSimpleName = suiteName.substring(suiteName.lastIndexOf('.') + 1);

        String packageName = getPackageName(suiteName);
        logger.startSuite(packageName, suiteSimpleName);
        lastSuiteName = suiteName;
    }
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:17,代码来源:AtsTestngClassListener.java


示例5: onBeforeClass

import org.testng.ITestClass; //导入依赖的package包/类
/**
 * [IClassListener]
 * Invoked after the test class is instantiated and before
 * {@link org.testng.annotations.BeforeClass @BeforeClass} 
 * configuration methods are called.
 * 
 * @param testClass TestNG representation for the current test class
 */
@Override
public void onBeforeClass(ITestClass testClass) {
    synchronized (classListeners) {
        for (IClassListener classListener : Lists.reverse(classListeners)) {
            classListener.onBeforeClass(testClass);
        }
    }
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:17,代码来源:ListenerChain.java


示例6: onAfterClass

import org.testng.ITestClass; //导入依赖的package包/类
/**
 * [IClassListener]
 * Invoked after all of the test methods of the test class have been invoked
 * and before {@link org.testng.annotations.AfterClass @AfterClass}
 * configuration methods are called.
 * 
 * @param testClass TestNG representation for the current test class
 */
@Override
public void onAfterClass(ITestClass testClass) {
    synchronized (classListeners) {
        for (IClassListener classListener : classListeners) {
            classListener.onAfterClass(testClass);
        }
    }
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:17,代码来源:ListenerChain.java


示例7: beforeInvocation

import org.testng.ITestClass; //导入依赖的package包/类
@Override
public void beforeInvocation(IInvokedMethod method, ITestResult testResult) {
	PreConfiguration preconfigure = null;
	ITestClass testClass=method.getTestMethod().getTestClass();
	Class<?> webClass=testClass.getRealClass();

	if(testResult.getMethod().isBeforeClassConfiguration() && testResult.getMethod().getMethodName().equalsIgnoreCase("beforeClass")) {
		preconfigure=webClass.getAnnotation(PreConfiguration.class);
	}

	//Set session as testNG attribute for after configuration methods
	try{
		testResult.setAttribute("session", SessionContext.session());}
	catch(Exception ex) {}

	if(method.getTestMethod().isTest()){
		log.debug("Set assertion type parameter for test method: {}!!!", method.getTestMethod().getMethodName());
		SeleniumTest seleniumTest=AnnotationUtils.findAnnotation(method.getTestMethod().getConstructorOrMethod().getMethod(), SeleniumTest.class);
		ApplicationContextProvider.getApplicationContext().getBean(ApplicationContextProvider.class).publishTestNGEvent(seleniumTest, "Initialize objects for the @Test method: "+method.getTestMethod().getMethodName()); 
		preconfigure = method.getTestMethod().getConstructorOrMethod().getMethod().getAnnotation(PreConfiguration.class);
	}

	//Execute Method from Page Object or Page Facade prior to @Test execution
	if(preconfigure!=null && method.getTestMethod().getCurrentInvocationCount()==0) {
		log.debug("Preconfiguration steps will be executed now for @Test {} !!!",method.getTestMethod().getMethodName());
		executionConfiguration(preconfigure);
	}
}
 
开发者ID:GiannisPapadakis,项目名称:seletest,代码行数:29,代码来源:InitListener.java


示例8: onTestStart

import org.testng.ITestClass; //导入依赖的package包/类
@Override
@SuppressWarnings({"Indentation", "PMD.ExcessiveMethodLength"})
public void onTestStart(final ITestResult testResult) {
    Current current = currentTestResult.get();
    if (current.isStarted()) {
        current = refreshContext();
    }
    current.test();
    final String parentUuid = getUniqueUuid(testResult.getTestContext());
    final ITestNGMethod method = testResult.getMethod();
    final ITestClass testClass = method.getTestClass();
    final List<Label> labels = new ArrayList<>();
    labels.addAll(Arrays.asList(
            //Packages grouping
            new Label().withName("package").withValue(testClass.getName()),
            new Label().withName("testClass").withValue(testClass.getName()),
            new Label().withName("testMethod").withValue(method.getMethodName()),

            //xUnit grouping
            new Label().withName("parentSuite").withValue(safeExtractSuiteName(testClass)),
            new Label().withName("suite").withValue(safeExtractTestTag(testClass)),
            new Label().withName("subSuite").withValue(safeExtractTestClassName(testClass)),

            //Timeline grouping
            new Label().withName("host").withValue(getHostName()),
            new Label().withName("thread").withValue(getThreadName())
    ));
    labels.addAll(getLabels(testResult));
    final List<Parameter> parameters = getParameters(testResult);
    final TestResult result = new TestResult()
            .withUuid(current.getUuid())
            .withHistoryId(getHistoryId(method, parameters))
            .withName(getMethodName(method))
            .withFullName(getQualifiedName(method))
            .withStatusDetails(new StatusDetails()
                    .withFlaky(isFlaky(testResult))
                    .withMuted(isMuted(testResult)))
            .withParameters(parameters)
            .withLinks(getLinks(testResult))
            .withLabels(labels);
    processDescription(getClass().getClassLoader(), method.getConstructorOrMethod().getMethod(), result);
    getLifecycle().scheduleTestCase(parentUuid, result);
    getLifecycle().startTestCase(current.getUuid());

    final String uuid = current.getUuid();
    Optional.of(testResult)
            .map(ITestResult::getMethod)
            .map(ITestNGMethod::getTestClass)
            .map(classContainerUuidStorage::get)
            .ifPresent(testClassContainerUuid -> getLifecycle().updateTestContainer(
                    testClassContainerUuid,
                    container -> container.getChildren().add(uuid)
            ));
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:55,代码来源:AllureTestNg.java


示例9: safeExtractSuiteName

import org.testng.ITestClass; //导入依赖的package包/类
private static String safeExtractSuiteName(final ITestClass testClass) {
    final Optional<XmlTest> xmlTest = Optional.ofNullable(testClass.getXmlTest());
    return xmlTest.map(XmlTest::getSuite).map(XmlSuite::getName).orElse("Undefined suite");
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:5,代码来源:AllureTestNg.java


示例10: safeExtractTestTag

import org.testng.ITestClass; //导入依赖的package包/类
private static String safeExtractTestTag(final ITestClass testClass) {
    final Optional<XmlTest> xmlTest = Optional.ofNullable(testClass.getXmlTest());
    return xmlTest.map(XmlTest::getName).orElse("Undefined testng tag");
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:5,代码来源:AllureTestNg.java


示例11: safeExtractTestClassName

import org.testng.ITestClass; //导入依赖的package包/类
private static String safeExtractTestClassName(final ITestClass testClass) {
    return firstNonEmpty(testClass.getTestName(), testClass.getName()).orElse("Undefined class name");
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:4,代码来源:AllureTestNg.java


示例12: onBeforeClass

import org.testng.ITestClass; //导入依赖的package包/类
@Override
public void onBeforeClass(ITestClass testClass) {
    beforeClass.add(testClass.getRealClass().getSimpleName());
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:5,代码来源:ChainedListener.java


示例13: onAfterClass

import org.testng.ITestClass; //导入依赖的package包/类
@Override
public void onAfterClass(ITestClass testClass) {
    afterClass.add(testClass.getRealClass().getSimpleName());
}
 
开发者ID:Nordstrom,项目名称:TestNG-Foundation,代码行数:5,代码来源:ChainedListener.java


示例14: resultSummary

import org.testng.ITestClass; //导入依赖的package包/类
/**
 * @param tests
 */
private void resultSummary(IResultMap tests, String testname, String style, String details)
{
    if (tests.getAllResults().size() > 0)
    {
        StringBuffer buff = new StringBuffer();
        String lastClassName = "";
        int mq = 0;
        int cq = 0;
        for (ITestNGMethod method : getMethodSet(tests))
        {
            m_row += 1;
            m_methodIndex += 1;
            ITestClass testClass = method.getTestClass();
            String className = testClass.getName();
            if (mq == 0)
            {
                titleRow(testname + " &#8212; " + style + details, 4);
            }
            if (!className.equalsIgnoreCase(lastClassName))
            {
                if (mq > 0)
                {
                    cq += 1;
                    m_out.println("<tr class=\"" + style
                            + (cq % 2 == 0 ? "even" : "odd") + "\">" + "<td rowspan=\""
                            + mq + "\">" + lastClassName + buff);
                }
                mq = 0;
                buff.setLength(0);
                lastClassName = className;
            }
            Set<ITestResult> resultSet = tests.getResults(method);
            long end = Long.MIN_VALUE;
            long start = Long.MAX_VALUE;
            for (ITestResult testResult : tests.getResults(method))
            {
                if (testResult.getEndMillis() > end)
                {
                    end = testResult.getEndMillis();
                }
                if (testResult.getStartMillis() < start)
                {
                    start = testResult.getStartMillis();
                }
            }
            mq += 1;
            if (mq > 1)
            {
                buff.append("<tr class=\"" + style + (cq % 2 == 0 ? "odd" : "even")
                        + "\">");
            }
            String description = method.getDescription();
            String testInstanceName = resultSet.toArray(new ITestResult[]{})[0].getTestName();
            buff.append("<td><a href=\"#m" + m_methodIndex + "\">"
                    + qualifiedName(method)
                    + " " + (description != null && description.length() > 0
                    ? "(\"" + description + "\")"
                    : "")
                    + "</a>" + (null == testInstanceName ? "" : "<br>(" + testInstanceName + ")")
                    + "</td>" + "<td class=\"numi\">"
                    + resultSet.size() + "</td><td class=\"numi\">" + (end - start)
                    + "</td></tr>");
        }
        if (mq > 0)
        {
            cq += 1;
            m_out.println("<tr class=\"" + style + (cq % 2 == 0 ? "even" : "odd")
                    + "\">" + "<td rowspan=\"" + mq + "\">" + lastClassName + buff);
        }
    }
}
 
开发者ID:basavaraj1985,项目名称:DolphinNG,代码行数:75,代码来源:EmailableReporter.java


示例15: onAfterClass

import org.testng.ITestClass; //导入依赖的package包/类
@Override
public void onAfterClass(ITestClass iTestClass, IMethodInstance iMethodInstance) {
    MockInitialContextFactory.destroy();
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:5,代码来源:CarbonBasedTestListener.java


示例16: getTestClass

import org.testng.ITestClass; //导入依赖的package包/类
@Override
public ITestClass getTestClass()
{
    return delegate.getTestClass();
}
 
开发者ID:prestodb,项目名称:tempto,代码行数:6,代码来源:DelegateTestNGMethod.java


示例17: setTestClass

import org.testng.ITestClass; //导入依赖的package包/类
@Override
public void setTestClass(ITestClass cls)
{
    delegate.setTestClass(cls);
}
 
开发者ID:prestodb,项目名称:tempto,代码行数:6,代码来源:DelegateTestNGMethod.java


示例18: onAfterClass

import org.testng.ITestClass; //导入依赖的package包/类
@Override
public void onAfterClass(ITestClass iTestClass) {
    ExtentManager.getExtent().flush();
    deviceAllocationManager.freeDevice();
}
 
开发者ID:saikrishna321,项目名称:AppiumTestDistribution,代码行数:6,代码来源:AppiumParallelTestListener.java


示例19: afterInvocation

import org.testng.ITestClass; //导入依赖的package包/类
@Override
public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
	PostConfiguration postconfigure = null;
	ITestClass testClass=method.getTestMethod().getTestClass();
	Class<?> webClass=testClass.getRealClass();

	if(testResult.getMethod().isAfterClassConfiguration() && testResult.getMethod().getMethodName().equalsIgnoreCase("afterClass")) {
		postconfigure=webClass.getAnnotation(PostConfiguration.class);
	}

	try{
		testResult.setAttribute("session", SessionContext.session());}
	catch(Exception ex){}

	if(method.getTestMethod().isTest()){

		//Wait for verifications to complete before finishing @Test (only for SoftAssert)
		if(SessionContext.getSession().getAssertion().getAssertion() instanceof SoftAssert){
			for(Future<?> a : (ArrayList<Future<?>>) SessionContext.getSession().getVerifications()){
				while(!a.isDone()){
					try {
						Thread.sleep(10);
					} catch (InterruptedException e) {
						log.error("Exception waiting future task to complete: "+e);
					}
				}
			}
			log.debug("Async verifications finished for @Test {}",method.getTestMethod().getMethodName());
		}

		postconfigure = method.getTestMethod().getConstructorOrMethod().getMethod().getAnnotation(PostConfiguration.class);
		PerformanceUtils perf=SessionContext.session().getPerformance();
		SessionControl.verifyController().assertAll();
		if(perf!=null) {
			perf.getPerformanceData(perf.getServer());
			perf.writePerformanceData(new File("./target/surefire-reports/logs/"+testResult.getName()+".har").getAbsolutePath(), perf.getHar());
			perf.stopServer(perf.getServer());
			log.debug("Performance data collected for test method: {} !!!",method.getTestMethod().getMethodName());
		}
	}

	//Execute Method from Page Object or Page Facade prior to @Test execution
	if(postconfigure!=null && method.getTestMethod().getCurrentInvocationCount()==0) {
		log.debug("Postconfiguration steps will be executed now for @Test {} !!!",method.getTestMethod().getMethodName());
		executionConfiguration(postconfigure);
	}
}
 
开发者ID:GiannisPapadakis,项目名称:seletest,代码行数:48,代码来源:InitListener.java



注:本文中的org.testng.ITestClass类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EquivalentAddressGroup类代码示例发布时间:2022-05-22
下一篇:
Java TaskAttemptListener类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap