Package org.testng.annotations

Examples of org.testng.annotations.Test


    protected final Log log = LogFactory.getLog(this.getClass());

    @BeforeClass
    @Parameters(value = { "channel.conf", "use_blocking" })
    protected void initializeBase(@Optional("udp.xml") String chconf, @Optional("false") String use_blocking) throws Exception {
        Test annotation = this.getClass().getAnnotation(Test.class);
        // this should never ever happen!
        if (annotation == null)
            throw new Exception("Test is not marked with @Test annotation");

        StackType type=Util.getIpStackType();
        bind_addr=type == StackType.IPv6 ? "::1" : "127.0.0.1";

        List<String> groups = Arrays.asList(annotation.groups());
        boolean testRequiresFlush = groups.contains(Global.FLUSH);

        this.use_blocking = testRequiresFlush || Boolean.parseBoolean(use_blocking);
        this.use_flush = testRequiresFlush;
        this.channel_conf = chconf;
View Full Code Here


  @SuppressWarnings({"deprecation"})
  private IAnnotation createTestTag(Class cls, Annotation a,
      IAnnotationTransformer transformer)
  {
    TestAnnotation result = new TestAnnotation();
    Test test = (Test) a;
   
    result.setEnabled(test.enabled());
    result.setGroups(join(test.groups(), findInheritedStringArray(cls, Test.class, "groups")));
    result.setParameters(test.parameters());
    result.setDependsOnGroups(join(test.dependsOnGroups(),
        findInheritedStringArray(cls, Test.class, "dependsOnGroups")));
    result.setDependsOnMethods(join(test.dependsOnMethods(),
        findInheritedStringArray(cls, Test.class, "dependsOnMethods")));
    result.setTimeOut(test.timeOut());
    result.setInvocationCount(test.invocationCount());
    result.setThreadPoolSize(test.threadPoolSize());
    result.setSuccessPercentage(test.successPercentage());
    result.setDataProvider(test.dataProvider());
    result.setDataProviderClass(test.dataProviderClass() != Object.class ?
        test.dataProviderClass() : null);
    result.setAlwaysRun(test.alwaysRun());
    result.setDescription(test.description());
    result.setExpectedExceptions(test.expectedExceptions());
    result.setSuiteName(test.suiteName());
    result.setTestName(test.testName());
    result.setSequential(test.sequential());
   
    return result;
  }
View Full Code Here

    private int enabledMethods(ITestNGMethod[] testMethods) {
        int count = testMethods.length;
        for(ITestNGMethod testNGMethod:testMethods) {
            Method m = testNGMethod.getMethod();
            if(m.isAnnotationPresent(Test.class)){
              Test annotation=m.getAnnotation(Test.class)
              if(!annotation.enabled()){
                  count --;
              }
            }
        }
        return count;
View Full Code Here

    private static void writeFailure(String type,
                                     Method method,
                                     Throwable ex,
                                     String msg,
                                     FileWriter out) throws IOException {
        Test annotation=method.getAnnotation(Test.class);
        if(annotation != null && ex != null) {
            Class[] expected_exceptions=annotation.expectedExceptions();
            for(int i=0;i < expected_exceptions.length;i++) {
                Class expected_exception=expected_exceptions[i];
                if(expected_exception.equals(ex.getClass())) {
                    return;
                }
View Full Code Here

    public static final String[] defaultTestFileNames = { "/a", "/A", "/b", "/B", "/c", "/C", "/aa", "/aA", "/Aa",
        "/AA", "/.a", "/-", "/*" };

    public void testStar() {
        //this shouldn't match the ".a" file
        new Test("/*", defaultTestFileNames, new String[] { "/a", "/A", "/b", "/B", "/c", "/C", "/aa", "/aA", "/Aa",
            "/AA", "/-", "/*" }).execute();
    }
View Full Code Here

        new Test("/*", defaultTestFileNames, new String[] { "/a", "/A", "/b", "/B", "/c", "/C", "/aa", "/aA", "/Aa",
            "/AA", "/-", "/*" }).execute();
    }

    public void testQuestionMark() {
        new Test("/?", defaultTestFileNames, new String[] { "/a", "/A", "/b", "/B", "/c", "/C", "/-", "/*" }).execute();
    }
View Full Code Here

    public void testQuestionMark() {
        new Test("/?", defaultTestFileNames, new String[] { "/a", "/A", "/b", "/B", "/c", "/C", "/-", "/*" }).execute();
    }

    public void testDotFilesMatch() {
        new Test("/.*", defaultTestFileNames, new String[] { "/.a" }).execute();
    }
View Full Code Here

    public void testDotFilesMatch() {
        new Test("/.*", defaultTestFileNames, new String[] { "/.a" }).execute();
    }

    public void testRanges() {
        new Test("/[a-c]*", defaultTestFileNames, new String[] { "/a", "/b", "/c", "/aa", "/aA" });
        new Test("/[-a]", defaultTestFileNames, new String[] { "/a", "/-" });
        new Test("/[*]", defaultTestFileNames, new String[] { "/*" });
    }
View Full Code Here

    private static TestMetadata findTestMetadata( Class testClass )
    {
        TestMetadata result = new TestMetadata();
        if ( HAS_TEST_ANNOTATION_ON_CLASSPATH )
        {
            Test testAnnotation = findAnnotation( testClass, Test.class );
            if ( null != testAnnotation )
            {
                if ( !StringUtils.isBlank( testAnnotation.suiteName() ) )
                {
                    result.suiteName = testAnnotation.suiteName();
                }

                if ( !StringUtils.isBlank( testAnnotation.testName() ) )
                {
                    result.testName = testAnnotation.testName();
                }
            }
        }
        return result;
    }
View Full Code Here

    private int enabledMethods(ITestNGMethod[] testMethods) {
        int count = testMethods.length;
        for(ITestNGMethod testNGMethod:testMethods) {
            Method m = testNGMethod.getMethod();
            if(m.isAnnotationPresent(Test.class)){
              Test annotation=m.getAnnotation(Test.class)
              if(!annotation.enabled()){
                  count --;
              }
            }
        }
        return count;
View Full Code Here

TOP

Related Classes of org.testng.annotations.Test

Copyright © 2018 www.massapicom. 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.