commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <ima...@apache.org>
Subject Re: [vfs] running unit tests for Http provider
Date Wed, 23 Jun 2004 09:55:35 GMT
Eric Pugh wrote:

>Something that
>could be an approach would be to have two modes:  Real and Mock.. 
>  
>
Well, i use the local file provider to test if i do global changes on 
vfs, it is easy to setup and the core of vfs is tested well.
For this, and if i have problems with a special filesystem i use a 
RunTest class.

If this test passes, i startup my uml-linux and trigger the whole test 
chain.

>But again, if you have a system, then that works..
>  
>
And never ever there should be a commit to vfs without testing the 
change against this system using ALL filesystems.

If you are interested in this uml-linux server, just drop me a note.


---RunTest---
package org.apache.commons.vfs.test;

import junit.framework.AssertionFailedError;
import junit.framework.Test;
import junit.framework.TestResult;
import org.apache.commons.vfs.provider.webdav.test.WebdavProviderTestCase;

import java.util.Properties;

public class RunTest
{
    public static void main(String[] args) throws Exception
    {
        Properties props = System.getProperties();
        props.setProperty("test.data.src", "src/test-data");
        props.setProperty("test.basedir", "target/test-data");
        props.setProperty("test.policy", "src/test-data/test.policy");
        props.setProperty("test.secure", "false");
        props.setProperty("test.smb.uri", 
"smb://vfsusr:vfsusr@vfstest/vfsusr/vfstest");
        props.setProperty("test.ftp.uri", 
"ftp://vfsusr:vfsusr@vfstest/vfstest");
        props.setProperty("test.http.uri", "http://vfstest/vfstest");

        props.setProperty("test.webdav.uri", 
"webdav://vfsusr:vfsusr@vfstest/vfstest");

        props.setProperty("test.sftp.uri", 
"sftp://vfsusr:vfsusr@vfstest/home/vfsusr/vfstest");

        Test test;
        // test = FtpProviderTestCase.suite();
        // test = HttpProviderTestCase.suite();
        // test = LocalProviderTestCase.suite();
        // test = JarProviderTestCase.suite();
        // test = ZipProviderTestCase.suite();
        // test = TemporaryProviderTestCase.suite();
        test = WebdavProviderTestCase.suite();
        // test = UrlProviderTestCase.suite();

        // test = SmbProviderTestCase.suite();

        // test = SftpProviderTestCase.suite();

        TestResult result = new TestResult()
        {
            public synchronized void addError(Test test, Throwable 
throwable)
            {
                throwable.printStackTrace();
            }

            public synchronized void addFailure(Test test, 
AssertionFailedError assertionFailedError)
            {
                assertionFailedError.printStackTrace();
            }
        };
        test.run(result);
    }
}
---RunTest---

-- 
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message