Importing java classes into Grinder script

View: New views
4 Messages — Rating Filter:   Alert me  

Importing java classes into Grinder script

by Chad Bellan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

How do I import all java classes from a package?  I have multiple My Menu classes but have to load them one by one.  I would like to load them all.

 

CURRENT

    IMPORT STATEMENT

    from com. selenium.my_menu import Test_my_ forecasts

 

    CODE TO GET THE TEST SUITE

    suite = TestSuite(Test_my_accounts().getClass())

 

WHAT I WANT AND NEED HELP TO DO

    IMPORT STATEMENT

    from com. selenium.my_menu import *

 

    CODE TO GET THE TEST SUITE

    suite = TestSuite(Test_my_ accounts().getClass())

    suite = TestSuite(Test_my_ investments().getClass())


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

Re: Importing java classes into Grinder script

by Philip Aston-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Chad Bellan wrote:

>
> How do I import all java classes from a package?  I have multiple My
> Menu classes but have to load them one by one.  I would like to load
> them all.
>
>  
>
> CURRENT
>
>     _IMPORT STATEMENT_
>
>     from com. selenium.my_menu import Test_my_ forecasts
>
>  
>
>     _CODE TO GET THE TEST SUITE _
>
>     suite = TestSuite(Test_my_accounts().getClass())
>
>  
>
> WHAT I WANT AND NEED HELP TO DO
>
>     _IMPORT STATEMENT_
>
>     from com. selenium.my_menu import *
>
>  
>
>     _CODE TO GET THE TEST SUITE _
>
>     suite = TestSuite(Test_my_ accounts().getClass())
>
>     suite = TestSuite(Test_my_ investments().getClass())
>

Are you getting messages about not being able to write to the cache dir?
E.g.

    *sys-package-mgr*: can't create package cache dir,
'/home/philipa/src/grinder3/lib/jython.jar/cachedir/packages'

If so, add the following to grinder.properties and try again:

    grinder.jvm.arguments = -Dpython.home=/blah

(Change "/blah" to an empty directory or an installation of Jython 2.2.1).

- Phil


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

Re: Importing java classes into Grinder script

by Anirvan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think what Chad meant was that he doesn't want to import specific java
classes in his test script.
Like say in Java classes we say -

import java.util.*

instead of,

import java.util.ArrayList;
import java.util.HashMap;
....

Well Chad, I'm not sure whether Jython allows you to do that, but one thing
you can surely do is -

from java.util import ArrayList, HashMap

I agree it's not much of an improvement, but it's a shade better at least :]

----------
anirvan

|-----Original Message-----
|From: Philip Aston [mailto:philipa@...]
|Sent: 02 September 2009 23:27
|To: grinder-use
|Subject: Re: [Grinder-use] Importing java classes into Grinder script
|
|Chad Bellan wrote:
|>
|> How do I import all java classes from a package?  I have multiple My
|> Menu classes but have to load them one by one.  I would like to load
|> them all.
|>
|>
|>
|> CURRENT
|>
|>     _IMPORT STATEMENT_
|>
|>     from com. selenium.my_menu import Test_my_ forecasts
|>
|>
|>
|>     _CODE TO GET THE TEST SUITE _
|>
|>     suite = TestSuite(Test_my_accounts().getClass())
|>
|>
|>
|> WHAT I WANT AND NEED HELP TO DO
|>
|>     _IMPORT STATEMENT_
|>
|>     from com. selenium.my_menu import *
|>
|>
|>
|>     _CODE TO GET THE TEST SUITE _
|>
|>     suite = TestSuite(Test_my_ accounts().getClass())
|>
|>     suite = TestSuite(Test_my_ investments().getClass())
|>
|
|Are you getting messages about not being able to write to the cache dir?
|E.g.
|
|    *sys-package-mgr*: can't create package cache dir,
|'/home/philipa/src/grinder3/lib/jython.jar/cachedir/packages'
|
|If so, add the following to grinder.properties and try again:
|
|    grinder.jvm.arguments = -Dpython.home=/blah
|
|(Change "/blah" to an empty directory or an installation of Jython
|2.2.1).
|
|- Phil
|
|
|------------------------------------------------------------------------
|------
|Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-
|Day
|trial. Simplify your report design, integration and deployment - and
|focus on
|what you do best, core application coding. Discover what's new with
|Crystal Reports now.  http://p.sf.net/sfu/bobj-july
|_______________________________________________
|grinder-use mailing list
|grinder-use@...
|https://lists.sourceforge.net/lists/listinfo/grinder-use


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

Re: Importing java classes into Grinder script

by Philip Aston-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jython does support import * for Java classes, but only if they have
been successfully parsed cached. That's why I suggested checking that
the caching is working.

- Phil

Anirvan Majumdar wrote:

> I think what Chad meant was that he doesn't want to import specific java
> classes in his test script.
> Like say in Java classes we say -
>
> import java.util.*
>
> instead of,
>
> import java.util.ArrayList;
> import java.util.HashMap;
> ....
>
> Well Chad, I'm not sure whether Jython allows you to do that, but one thing
> you can surely do is -
>
> from java.util import ArrayList, HashMap
>
> I agree it's not much of an improvement, but it's a shade better at least :]
>
> ----------
> anirvan
>
> |-----Original Message-----
> |From: Philip Aston [mailto:philipa@...]
> |Sent: 02 September 2009 23:27
> |To: grinder-use
> |Subject: Re: [Grinder-use] Importing java classes into Grinder script
> |
> |Chad Bellan wrote:
> |>
> |> How do I import all java classes from a package?  I have multiple My
> |> Menu classes but have to load them one by one.  I would like to load
> |> them all.
> |>
> |>
> |>
> |> CURRENT
> |>
> |>     _IMPORT STATEMENT_
> |>
> |>     from com. selenium.my_menu import Test_my_ forecasts
> |>
> |>
> |>
> |>     _CODE TO GET THE TEST SUITE _
> |>
> |>     suite = TestSuite(Test_my_accounts().getClass())
> |>
> |>
> |>
> |> WHAT I WANT AND NEED HELP TO DO
> |>
> |>     _IMPORT STATEMENT_
> |>
> |>     from com. selenium.my_menu import *
> |>
> |>
> |>
> |>     _CODE TO GET THE TEST SUITE _
> |>
> |>     suite = TestSuite(Test_my_ accounts().getClass())
> |>
> |>     suite = TestSuite(Test_my_ investments().getClass())
> |>
> |
> |Are you getting messages about not being able to write to the cache dir?
> |E.g.
> |
> |    *sys-package-mgr*: can't create package cache dir,
> |'/home/philipa/src/grinder3/lib/jython.jar/cachedir/packages'
> |
> |If so, add the following to grinder.properties and try again:
> |
> |    grinder.jvm.arguments = -Dpython.home=/blah
> |
> |(Change "/blah" to an empty directory or an installation of Jython
> |2.2.1).
> |
> |- Phil
> |
> |



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use