org.testng.ITest Java Examples

The following examples show how to use org.testng.ITest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestReorderInterceptor.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: TestReorderInterceptor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #3
Source File: TestReorderInterceptor.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #4
Source File: TestReorderInterceptor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #5
Source File: TestReorderInterceptor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #6
Source File: TestReorderInterceptor.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #7
Source File: TestReorderInterceptor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #8
Source File: TestReorderInterceptor.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #9
Source File: TestReorderInterceptor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #10
Source File: ScriptTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #11
Source File: TomcatTestCase.java    From sqoop-on-spark with Apache License 2.0 5 votes vote down vote up
@BeforeMethod(alwaysRun = true)
public void findMethodName(Method method) {
	if (this instanceof ITest) {
		name = ((ITest) this).getTestName();
	} else {
		name = method.getName();
	}
}
 
Example #12
Source File: ScriptTest.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #13
Source File: ScriptTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #14
Source File: ScriptTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #15
Source File: ScriptTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #16
Source File: ScriptTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #17
Source File: ScriptTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #18
Source File: ScriptTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #19
Source File: ScriptTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}