junit - JUint - How to construct a Test Object -



junit - JUint - How to construct a Test Object -

our test framework based on junit 3.x.

i trying check current framework if can execute junit 4 test cases.

there different ways execute test case in our framework command line or ui, testservlet

1)by passing testsuite - qualified name 2)by passing testsuite ( qualified name) , individual test case (to execute 1 test case suite)..

i trying fit in juint4 tests in our proprietary framework using joint 3.x)

i stuck 1 piece .

new test cases in junit 4 , using junit4testadapter .

question : how can build test object when know annotated junit 4 method.

code class suiteclass = classutil.classforname(suitename); object o = classutil.newinstance(suiteclass); //the suite name passed contains junit4 tests if ( !(o instanceof testsuite)&& isjunit4testcase(o)) { // see if method exists in class method method; seek { method = suiteclass.getmethod(testname); } grab (nosuchmethodexception e) { log.harness.debug("method: %s not found in %s",testname, nametouse); homecoming null; } test m_test = null; if (method.isannotationpresent(org.junit.test.class)) { /*here need build test object , stuck junit.framework.test need object returned */ m_test = (test)method; homecoming m_test; } else homecoming null;

can utilize junit4testadapter.filter(filter)? have selection of writing own filter or using filter.matchmethoddescription(description). matching description gets easy when utilize createtestdescription(class<?> testclass, string methodname) static mill method.

because junit4testadapter implements test, can pass filtered junit4testadapter straight method needs test instance. instances should easy create passing in junit4 test class junit4testadapter constructor.

(in fact, can avoid of reflection have in answer, , hand off junit instead.)

junit

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -