Pass parameter dynamically across testMethods

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

Pass parameter dynamically across testMethods

by threecuptea :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have the following group of tests in specific order.  Also insertNMProgram need to pass created programId to  insertNMEpisode and insertNMEpisode need to pass created episodeId to insertProduct and insertProduct need to pass created productId to verifyInsertProductChain.  I think that I can use instance variables to pass variables.  Is there better way or best practice to do it?  Can a method programatically insert a parameter then other method pick it up?  

@Test(groups ="persistence-pandads-prgmgrp-insert")
    public void insertNMProgram() {
    }

@Test(groups ="persistence-pandads-prgmgrp-insert", dependsOnMethods="insertNMProgram")
    public void insertNMEpisode() {
    }
@Test(groups ="persistence-pandads-prgmgrp-insert", dependsOnMethods="insertNMEpisode")
    public void insertProduct() {
   }
 @Test(groups ="persistence-pandads-prgmgrp-insert", dependsOnMethods="insertProduct")
    public void verifyInsertProductChain() {
}


Re: Pass parameter dynamically across testMethods

by Cédric Beust ♔ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, an instance field is probably the best way to pass information to dependent methods.

--
Cédric



On Sat, Oct 24, 2009 at 3:18 PM, threecuptea <sonya_ling1947@...> wrote:


I have the following group of tests in specific order.  Also insertNMProgram
need to pass created programId to  insertNMEpisode and insertNMEpisode need
to pass created episodeId to insertProduct and insertProduct need to pass
created productId to verifyInsertProductChain.  I think that I can use
instance variables to pass variables.  Is there better way or best practice
to do it?  Can a method programatically insert a parameter then other method
pick it up?

@Test(groups ="persistence-pandads-prgmgrp-insert")
   public void insertNMProgram() {
   }

@Test(groups ="persistence-pandads-prgmgrp-insert",
dependsOnMethods="insertNMProgram")
   public void insertNMEpisode() {
   }
@Test(groups ="persistence-pandads-prgmgrp-insert",
dependsOnMethods="insertNMEpisode")
   public void insertProduct() {
  }
 @Test(groups ="persistence-pandads-prgmgrp-insert",
dependsOnMethods="insertProduct")
   public void verifyInsertProductChain() {
}


--
View this message in context: http://www.nabble.com/Pass-parameter-dynamically-across-testMethods-tp26000874p26000874.html
Sent from the testng-users mailing list archive at Nabble.com.







--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng-users@...
To unsubscribe from this group, send email to testng-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---