类org.testng.ITest源码实例Demo

下面列出了怎么用org.testng.ITest的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: TencentKona-8   文件: TestReorderInterceptor.java
@Override
public List<IMethodInstance> intercept(final List<IMethodInstance> methods, final ITestContext context) {
    Collections.sort(methods, new Comparator<IMethodInstance>() {
        @Override
        public int compare(final IMethodInstance mi1, final IMethodInstance mi2) {
            // get test instances to order the tests.
            final Object o1 = mi1.getInstance();
            final Object o2 = mi2.getInstance();
            if (o1 instanceof ITest && o2 instanceof ITest) {
                return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName());
            }
            // something else, don't care about the order
            return 0;
        }
    });

    return methods;
}
 
源代码2 项目: jdk8u60   文件: TestReorderInterceptor.java
@Override
public List<IMethodInstance> intercept(final List<IMethodInstance> methods, final ITestContext context) {
    Collections.sort(methods, new Comparator<IMethodInstance>() {
        @Override
        public int compare(final IMethodInstance mi1, final IMethodInstance mi2) {
            // get test instances to order the tests.
            final Object o1 = mi1.getInstance();
            final Object o2 = mi2.getInstance();
            if (o1 instanceof ITest && o2 instanceof ITest) {
                return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName());
            }
            // something else, don't care about the order
            return 0;
        }
    });

    return methods;
}
 
源代码3 项目: openjdk-jdk8u   文件: TestReorderInterceptor.java
@Override
public List<IMethodInstance> intercept(final List<IMethodInstance> methods, final ITestContext context) {
    Collections.sort(methods, new Comparator<IMethodInstance>() {
        @Override
        public int compare(final IMethodInstance mi1, final IMethodInstance mi2) {
            // get test instances to order the tests.
            final Object o1 = mi1.getInstance();
            final Object o2 = mi2.getInstance();
            if (o1 instanceof ITest && o2 instanceof ITest) {
                return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName());
            }
            // something else, don't care about the order
            return 0;
        }
    });

    return methods;
}
 
@Override
public List<IMethodInstance> intercept(final List<IMethodInstance> methods, final ITestContext context) {
    Collections.sort(methods, new Comparator<IMethodInstance>() {
        @Override
        public int compare(final IMethodInstance mi1, final IMethodInstance mi2) {
            // get test instances to order the tests.
            final Object o1 = mi1.getInstance();
            final Object o2 = mi2.getInstance();
            if (o1 instanceof ITest && o2 instanceof ITest) {
                return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName());
            }
            // something else, don't care about the order
            return 0;
        }
    });

    return methods;
}
 
源代码5 项目: openjdk-jdk9   文件: TestReorderInterceptor.java
@Override
public List<IMethodInstance> intercept(final List<IMethodInstance> methods, final ITestContext context) {
    Collections.sort(methods, new Comparator<IMethodInstance>() {
        @Override
        public int compare(final IMethodInstance mi1, final IMethodInstance mi2) {
            // get test instances to order the tests.
            final Object o1 = mi1.getInstance();
            final Object o2 = mi2.getInstance();
            if (o1 instanceof ITest && o2 instanceof ITest) {
                return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName());
            }
            // something else, don't care about the order
            return 0;
        }
    });

    return methods;
}
 
源代码6 项目: hottub   文件: TestReorderInterceptor.java
@Override
public List<IMethodInstance> intercept(final List<IMethodInstance> methods, final ITestContext context) {
    Collections.sort(methods, new Comparator<IMethodInstance>() {
        @Override
        public int compare(final IMethodInstance mi1, final IMethodInstance mi2) {
            // get test instances to order the tests.
            final Object o1 = mi1.getInstance();
            final Object o2 = mi2.getInstance();
            if (o1 instanceof ITest && o2 instanceof ITest) {
                return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName());
            }
            // something else, don't care about the order
            return 0;
        }
    });

    return methods;
}
 
源代码7 项目: openjdk-8-source   文件: TestReorderInterceptor.java
@Override
public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context) {
    Collections.sort(methods, new Comparator<IMethodInstance>() {
        @Override
        public int compare(final IMethodInstance mi1, final IMethodInstance mi2) {
            // get test instances to order the tests.
            final Object o1 = mi1.getInstance();
            final Object o2 = mi2.getInstance();
            if (o1 instanceof ITest && o2 instanceof ITest) {
                return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName());
            } else {
                // something else, don't care about the order
                return 0;
            }
        }
    });

    return methods;
}
 
源代码8 项目: openjdk-8   文件: TestReorderInterceptor.java
@Override
public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context) {
    Collections.sort(methods, new Comparator<IMethodInstance>() {
        @Override
        public int compare(final IMethodInstance mi1, final IMethodInstance mi2) {
            // get test instances to order the tests.
            final Object o1 = mi1.getInstance();
            final Object o2 = mi2.getInstance();
            if (o1 instanceof ITest && o2 instanceof ITest) {
                return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName());
            } else {
                // something else, don't care about the order
                return 0;
            }
        }
    });

    return methods;
}
 
源代码9 项目: jdk8u_nashorn   文件: TestReorderInterceptor.java
@Override
public List<IMethodInstance> intercept(final List<IMethodInstance> methods, final ITestContext context) {
    Collections.sort(methods, new Comparator<IMethodInstance>() {
        @Override
        public int compare(final IMethodInstance mi1, final IMethodInstance mi2) {
            // get test instances to order the tests.
            final Object o1 = mi1.getInstance();
            final Object o2 = mi2.getInstance();
            if (o1 instanceof ITest && o2 instanceof ITest) {
                return ((ITest)o1).getTestName().compareTo(((ITest)o2).getTestName());
            }
            // something else, don't care about the order
            return 0;
        }
    });

    return methods;
}
 
源代码10 项目: TencentKona-8   文件: ScriptTest.java
/**
 * Creates a test factory for the set of .js source tests.
 *
 * @return a Object[] of test objects.
 * @throws Exception upon failure
 */
@SuppressWarnings("static-method")
@Factory
public Object[] suite() throws Exception {
    Locale.setDefault(new Locale(""));

    final List<ITest> tests = new ArrayList<>();
    final Set<String> orphans = new TreeSet<>();

    final TestFactory<ITest> testFactory = new TestFactory<ITest>() {
        @Override
        public ITest createTest(final String framework, final File testFile, final List<String> engineOptions, final Map<String, String> testOptions, final List<String> scriptArguments) {
            return new ScriptRunnable(framework, testFile, engineOptions, testOptions,  scriptArguments);
        }

        @Override
        public void log(final String msg) {
            org.testng.Reporter.log(msg, true);
        }
    };

    TestFinder.findAllTests(tests, orphans, testFactory);

    if (System.getProperty(TEST_JS_INCLUDES) == null) {
        tests.add(new OrphanTestFinder(orphans));
    }

    return tests.toArray();
}
 
源代码11 项目: jdk8u60   文件: ScriptTest.java
/**
 * Creates a test factory for the set of .js source tests.
 *
 * @return a Object[] of test objects.
 * @throws Exception upon failure
 */
@SuppressWarnings("static-method")
@Factory
public Object[] suite() throws Exception {
    Locale.setDefault(new Locale(""));

    final List<ITest> tests = new ArrayList<>();
    final Set<String> orphans = new TreeSet<>();

    final TestFactory<ITest> testFactory = new TestFactory<ITest>() {
        @Override
        public ITest createTest(final String framework, final File testFile, final List<String> engineOptions, final Map<String, String> testOptions, final List<String> scriptArguments) {
            return new ScriptRunnable(framework, testFile, engineOptions, testOptions,  scriptArguments);
        }

        @Override
        public void log(final String msg) {
            org.testng.Reporter.log(msg, true);
        }
    };

    TestFinder.findAllTests(tests, orphans, testFactory);

    if (System.getProperty(TEST_JS_INCLUDES) == null) {
        tests.add(new OrphanTestFinder(orphans));
    }

    return tests.toArray();
}
 
源代码12 项目: openjdk-jdk8u   文件: ScriptTest.java
/**
 * Creates a test factory for the set of .js source tests.
 *
 * @return a Object[] of test objects.
 * @throws Exception upon failure
 */
@SuppressWarnings("static-method")
@Factory
public Object[] suite() throws Exception {
    Locale.setDefault(new Locale(""));

    final List<ITest> tests = new ArrayList<>();
    final Set<String> orphans = new TreeSet<>();

    final TestFactory<ITest> testFactory = new TestFactory<ITest>() {
        @Override
        public ITest createTest(final String framework, final File testFile, final List<String> engineOptions, final Map<String, String> testOptions, final List<String> scriptArguments) {
            return new ScriptRunnable(framework, testFile, engineOptions, testOptions,  scriptArguments);
        }

        @Override
        public void log(final String msg) {
            org.testng.Reporter.log(msg, true);
        }
    };

    TestFinder.findAllTests(tests, orphans, testFactory);

    if (System.getProperty(TEST_JS_INCLUDES) == null) {
        tests.add(new OrphanTestFinder(orphans));
    }

    return tests.toArray();
}
 
源代码13 项目: openjdk-jdk8u-backup   文件: ScriptTest.java
/**
 * Creates a test factory for the set of .js source tests.
 *
 * @return a Object[] of test objects.
 * @throws Exception upon failure
 */
@SuppressWarnings("static-method")
@Factory
public Object[] suite() throws Exception {
    Locale.setDefault(new Locale(""));

    final List<ITest> tests = new ArrayList<>();
    final Set<String> orphans = new TreeSet<>();

    final TestFactory<ITest> testFactory = new TestFactory<ITest>() {
        @Override
        public ITest createTest(final String framework, final File testFile, final List<String> engineOptions, final Map<String, String> testOptions, final List<String> scriptArguments) {
            return new ScriptRunnable(framework, testFile, engineOptions, testOptions,  scriptArguments);
        }

        @Override
        public void log(final String msg) {
            org.testng.Reporter.log(msg, true);
        }
    };

    TestFinder.findAllTests(tests, orphans, testFactory);

    if (System.getProperty(TEST_JS_INCLUDES) == null) {
        tests.add(new OrphanTestFinder(orphans));
    }

    return tests.toArray();
}
 
源代码14 项目: openjdk-jdk9   文件: ScriptTest.java
/**
 * Creates a test factory for the set of .js source tests.
 *
 * @return a Object[] of test objects.
 * @throws Exception upon failure
 */
@SuppressWarnings("static-method")
@Factory
public Object[] suite() throws Exception {
    Locale.setDefault(new Locale(""));

    final List<ITest> tests = new ArrayList<>();
    final Set<String> orphans = new TreeSet<>();

    final TestFactory<ITest> testFactory = new TestFactory<ITest>() {
        @Override
        public ITest createTest(final String framework, final File testFile, final List<String> engineOptions, final Map<String, String> testOptions, final List<String> scriptArguments) {
            return new ScriptRunnable(framework, testFile, engineOptions, testOptions,  scriptArguments);
        }

        @Override
        public void log(final String msg) {
            org.testng.Reporter.log(msg, true);
        }
    };

    TestFinder.findAllTests(tests, orphans, testFactory);

    if (System.getProperty(TEST_JS_INCLUDES) == null) {
        tests.add(new OrphanTestFinder(orphans));
    }

    return tests.toArray();
}
 
源代码15 项目: hottub   文件: ScriptTest.java
/**
 * Creates a test factory for the set of .js source tests.
 *
 * @return a Object[] of test objects.
 * @throws Exception upon failure
 */
@SuppressWarnings("static-method")
@Factory
public Object[] suite() throws Exception {
    Locale.setDefault(new Locale(""));

    final List<ITest> tests = new ArrayList<>();
    final Set<String> orphans = new TreeSet<>();

    final TestFactory<ITest> testFactory = new TestFactory<ITest>() {
        @Override
        public ITest createTest(final String framework, final File testFile, final List<String> engineOptions, final Map<String, String> testOptions, final List<String> scriptArguments) {
            return new ScriptRunnable(framework, testFile, engineOptions, testOptions,  scriptArguments);
        }

        @Override
        public void log(final String msg) {
            org.testng.Reporter.log(msg, true);
        }
    };

    TestFinder.findAllTests(tests, orphans, testFactory);

    if (System.getProperty(TEST_JS_INCLUDES) == null) {
        tests.add(new OrphanTestFinder(orphans));
    }

    return tests.toArray();
}
 
源代码16 项目: openjdk-8-source   文件: ScriptTest.java
/**
 * Creates a test factory for the set of .js source tests.
 *
 * @return a Object[] of test objects.
 */
@Factory
public Object[] suite() throws Exception {
    Locale.setDefault(new Locale(""));

    final List<ITest> tests = new ArrayList<>();
    final Set<String> orphans = new TreeSet<>();

    final TestFactory<ITest> testFactory = new TestFactory<ITest>() {
        @Override
        public ITest createTest(final String framework, final File testFile, final List<String> engineOptions, final Map<String, String> testOptions, final List<String> scriptArguments) {
            return new ScriptRunnable(framework, testFile, engineOptions, testOptions,  scriptArguments);
        }

        @Override
        public void log(String msg) {
            org.testng.Reporter.log(msg, true);
        }
    };

    TestFinder.findAllTests(tests, orphans, testFactory);

    if (System.getProperty(TEST_JS_INCLUDES) == null) {
        tests.add(new OrphanTestFinder(orphans));
    }

    return tests.toArray();
}
 
源代码17 项目: openjdk-8   文件: ScriptTest.java
/**
 * Creates a test factory for the set of .js source tests.
 *
 * @return a Object[] of test objects.
 */
@Factory
public Object[] suite() throws Exception {
    Locale.setDefault(new Locale(""));

    final List<ITest> tests = new ArrayList<>();
    final Set<String> orphans = new TreeSet<>();

    final TestFactory<ITest> testFactory = new TestFactory<ITest>() {
        @Override
        public ITest createTest(final String framework, final File testFile, final List<String> engineOptions, final Map<String, String> testOptions, final List<String> scriptArguments) {
            return new ScriptRunnable(framework, testFile, engineOptions, testOptions,  scriptArguments);
        }

        @Override
        public void log(String msg) {
            org.testng.Reporter.log(msg, true);
        }
    };

    TestFinder.findAllTests(tests, orphans, testFactory);

    if (System.getProperty(TEST_JS_INCLUDES) == null) {
        tests.add(new OrphanTestFinder(orphans));
    }

    return tests.toArray();
}
 
源代码18 项目: jdk8u_nashorn   文件: ScriptTest.java
/**
 * Creates a test factory for the set of .js source tests.
 *
 * @return a Object[] of test objects.
 * @throws Exception upon failure
 */
@SuppressWarnings("static-method")
@Factory
public Object[] suite() throws Exception {
    Locale.setDefault(new Locale(""));

    final List<ITest> tests = new ArrayList<>();
    final Set<String> orphans = new TreeSet<>();

    final TestFactory<ITest> testFactory = new TestFactory<ITest>() {
        @Override
        public ITest createTest(final String framework, final File testFile, final List<String> engineOptions, final Map<String, String> testOptions, final List<String> scriptArguments) {
            return new ScriptRunnable(framework, testFile, engineOptions, testOptions,  scriptArguments);
        }

        @Override
        public void log(final String msg) {
            org.testng.Reporter.log(msg, true);
        }
    };

    TestFinder.findAllTests(tests, orphans, testFactory);

    if (System.getProperty(TEST_JS_INCLUDES) == null) {
        tests.add(new OrphanTestFinder(orphans));
    }

    return tests.toArray();
}
 
源代码19 项目: sqoop-on-spark   文件: TomcatTestCase.java
@BeforeMethod(alwaysRun = true)
public void findMethodName(Method method) {
	if (this instanceof ITest) {
		name = ((ITest) this).getTestName();
	} else {
		name = method.getName();
	}
}
 
 类所在包
 同包方法