I'm implementing the suggested Template Pattern for the
Component-test-framework

I have some doubts whether the template should be common to all the test
cases or it should be specific to each type of test
e.g.
Endpoint, Proxy-service
and for functional and Admin service

I have written a common template for all the test cases as follows
If there are issues please suggest for improvements


public abstract class TestTemplate extends TestCase {
    protected String sessionCookie = null;
    private ServerLogin serverLogin = new ServerLogin();

    // The template method
    @Test
    public void test() {
        // the three different kind of tests that need to tested.

        // The common configs for all the tests
        config();

        //Test without login
        runFailingTest();

        sessionCookie = login();

        //Test with login
        runPassingTest();

        logout();

        //Test with logout
        runFailingTest();

        // Cleaning up the configurations
        cleanup();

    }

    public abstract void config();

    //for the test that is expected to pass(in login mode)
    public abstract void runPassingTest();

    //for the test that is expected to fail(without login and after logout)
    public abstract void runFailingTest();

    public abstract void cleanup();

    //the concrete method for logout
    protected String logout() {
        try {
            return serverLogin.logout();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return sessionCookie;
    }

    //the concrete method for login
    public String login() {
        try {
            return serverLogin.login();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

}


Suho

>
> On 22 July 2010 16:41, Suhothayan Sriskandarajah <[email protected]> wrote:
>
>> I have made the proposed changes to the endpoint module.
>> To run the test framework you need to start the Axis2 server manually
>> with SimpleStockQuoteService and MTOMSwASampleService
>> at port 9000
>>
>> Now by default this test framework will not test load balancing and
>> fail-over tests
>> To run load balancing and fail-over tests run Maven with
>> -Dtest.suite=TestsWithAxis2Server
>>
>> suho
>>
>>
>> On 22 July 2010 14:36, Chamara Silva <[email protected]> wrote:
>>
>>> To run latest test framework you need to manually start axis2 server
>>> with SimpleStockQuoteService other than above instructions.
>>>
>>> Thank you,
>>> Regards,
>>> Chamara
>>>
>>>
>>> On Wed, Jul 21, 2010 at 9:38 AM, Chamara Silva <[email protected]> wrote:
>>> > +1
>>> >
>>> > On Wed, Jul 21, 2010 at 7:01 AM, Charitha Kankanamge <
>>> [email protected]> wrote:
>>> >> +1.
>>> >>
>>> >> Charitha
>>> >>
>>> >>
>>> >> On Wed, Jul 21, 2010 at 6:33 AM, Samisa Abeysinghe <[email protected]>
>>> wrote:
>>> >>>
>>> >>>
>>> >>> On Wed, Jul 21, 2010 at 1:41 AM, Asela Pathberiya <[email protected]>
>>> wrote:
>>> >>>>
>>> >>>> Hi,
>>> >>>>
>>> >>>> Are we using server's default admin user to authorize all the admin
>>> >>>> services? I think it would be better, if we can create a authorized
>>> user for
>>> >>>> each admin service and execute the test rather than using default
>>> admin. As
>>> >>>> an example, in every test class, we create role and assign relevant
>>> >>>> permissions and then execute the test.  WDYT?
>>> >>>
>>> >>> Well, I think, to make it more real, we need to test with both the
>>> >>> default, as well as a new. The reason being that we have to verify
>>> that both
>>> >>> default as well as a new admin work, and that gives best test
>>> coverage.
>>> >>>
>>> >>> Thanks,
>>> >>> Samisa...
>>> >>>
>>> >>> Samisa Abeysinghe
>>> >>> VP Engineering
>>> >>> WSO2 Inc.
>>> >>> http://wso2.com
>>> >>> http://wso2.org
>>> >>>
>>> >>>
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > Suminda Chamara Silva
>>> > Senior Software Engineer - QA
>>> > WSO2 Inc.
>>> > Mobile: +94 718 302858
>>> > blog: http://chamaras.blogspot.com
>>> >
>>>
>>>
>>>
>>> --
>>> Suminda Chamara Silva
>>> Senior Software Engineer - QA
>>> WSO2 Inc.
>>> Mobile: +94 718 302858
>>> blog: http://chamaras.blogspot.com
>>>
>>
>>
>
_______________________________________________
Carbon-dev mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to