Login | Register
My pages Projects Community openCollabNet

Discussions > users > Re: [maxq-users] multiple directories for tests

maxq
Discussion topic

Back to topic list

Re: [maxq-users] multiple directories for tests

Author christophe blin <cblin at tennaxia dot com>
Full name christophe blin <cblin at tennaxia dot com>
Date 2005-04-14 01:34:40 PDT
Message having this directory configuration:
maxq-0.98/
    bin/
       maxq
    conf/
       maxq.properties ----> python.path=d\:/tests/common
    ...
tests/
    common/
       action_login.py
       valid_home.py
   test_login.py



$> cd tests
$> ..\maxq-0.98\bin\maxq -r test_login.py
14 avr. 2005 10:24:44 com.bitmechanic.maxq.Main runTests
INFO: Running: test_login.py
Traceback (innermost last):
  File "test_login.py", line 4, in ?
ImportError: no module named PyHttpTestCase

setting python.path to python.path=d\:/max​q-0.98/jython:d\:/t​ests/common
gives the same result

Please can you help me a little more.
Is there a problem with windows syntax (d\:) ?
The python files should be compiled or something else?

Any help appreciated. Thanks


Oliver Bock wrote:

> Hi Chris,
>
> To get Jython to search other directories for source files, add your
> other directories to python.path in maxq.properties.
>
>
> Oliver
>
> --
> On 14/04/2005, at 01:25, christophe blin wrote:
>
>> Hi,
>>
>> I want to modularize my test scripts.
>> So I have multiple files : action_login.py to log on my app,
>> valid_home.py to check that the current page is the home page
>> and the file doing the test test_login.py.
>> action_* and valid_* are so reusable in all the tests (ex: having a
>> test_logout.py calling first action_login then valid_home and
>> finally doing the disconnection)
>>
>> When all the files are in the same directory, the script is
>> perfectly working (action_login and valid_home are correctly imported).
>> What I did not manage to do is to put the files in different
>> directories.
>> ex :
>> tests/
>> common/
>> action_login.py
>> valid_home.py
>> test_login.py
>>
>> when executing in the tests directory :
>> $>..\maxq-0.98\bin\maxq -r test_login.py
>> 13 avr. 2005 16:55:30 com.bitmechanic.maxq.Main runTests
>> INFO: Running: test_login.py
>> Traceback (innermost last):
>> File "test_login.py", line 6, in ?
>> ImportError: cannot import name action_login
>>
>> I have tried to replace the test_login.py, line 6 ('import
>> action_login') by
>> 'from common import action_login'
>> 'from common.action_login import action_login'
>>
>> But none are working ! I do not understand how the modules are
>> imported because doing
>> "from org.python.modules import re" is working with this class in
>> jython.jar
>>
>> Any help appreciated.
>>
>> ////////////////////​////////////////////​////////////////////​//////////
>> ////////////////////​////////////////////​////////////////////​//////////
>> //////////////////////////
>> action_login.py :
>> #
>> # login into XXX with (thelogin, thepwd) for (login, password)
>> #
>> def login(test, thelogin, thepwd):
>> params = [
>> ('''id_lien''', ''''''),
>> ('''reso''', '''1280x1024; ColorDepth=32'''),
>> ('''login_auth''', thelogin),
>> ('''password_auth''', thepwd),
>> ('''authentication''', '''Validez'''),]
>> test.msg("Testing login")
>> url = "http://wwwdev-mysql4​0/private/index.php"
>> test.post(url, params)
>> test.msg("Response code: %s" % test.getResponseCode())
>> test.assertEquals("Assert login failed", 200,
>> test.getResponseCode())
>>
>>
>> ////////////////////​////////////////////​////////////////////​//////////
>> ////////////////////​////////////////////​////////////////////​//////////
>> //////////////////////////
>> valid_home.py :
>> #
>> # validate that the main frame is the home page
>> #
>> def validHomePage(test):
>> params = [
>> ('''frameset''', '''main'''),]
>> test.msg("Testing home page")
>> url = "http://wwwdev-mysql4​0/private/index.php"
>> test.get(url, params) test.msg("Response code: %s" %
>> test.getResponseCode())
>> test.assertEquals("Assert test home page failed (bad code)", 200,
>> test.getResponseCode())
>> test.assertTrue("Assert test home page failed",
>> test.responseContain​s("Bienvenue"))
>> ////////////////////​////////////////////​////////////////////​//////////
>> ////////////////////​////////////////////​////////////////////​//////////
>> //////////////////////////
>> test_login.py :
>> #
>> # A test to check that after a succesful login we go to the home page
>> #
>> from PyHttpTestCase import PyHttpTestCase
>>
>> import action_login
>> import valid_home
>> import valid_menu
>>
>> # definition of test class
>> class testLogin(PyHttpTestCase):
>>
>> def runTest(self):
>> self.msg('Test login started')
>> action_login.login(self, 'usr', 'pwd')
>> valid_home.validHomePage(self)
>>
>> # Code to load and run the test
>> if __name__ == 'main':
>> test = testLogin("connexion test")
>> test.Run()
>>
>> --------------------​--------------------​--------------------​---------
>> To unsubscribe, e-mail: users-unsubscribe@ma​xq.tigris.org
>> For additional commands, e-mail: users-help at maxq dot tigris dot org
>>
>>
>
>
> --------------------​--------------------​--------------------​---------
> To unsubscribe, e-mail: users-unsubscribe@ma​xq.tigris.org
> For additional commands, e-mail: users-help at maxq dot tigris dot org
>
>
>


--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: users-unsubscribe@ma​xq.tigris.org
For additional commands, e-mail: users-help at maxq dot tigris dot org

« Previous message in topic | 3 of 3 | Next message in topic »

Messages

Show all messages in topic

[maxq-users] multiple directories for tests christophe blin <cblin at tennaxia dot com> christophe blin <cblin at tennaxia dot com> 2005-04-13 08:25:29 PDT
     Re: [maxq-users] multiple directories for tests oliverbock Oliver Bock 2005-04-13 17:15:02 PDT
         Re: [maxq-users] multiple directories for tests christophe blin <cblin at tennaxia dot com> christophe blin <cblin at tennaxia dot com> 2005-04-14 01:34:40 PDT
Messages per page: