@Factory or @DataProvider?

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

@Factory or @DataProvider?

tarun3kumar

Hello, Dear gentlemen!

I've unsuccessfully trying to build my testing framework, using TestNG 5.5, sequentially both functionalities but don't get the problem solved.
I need to walk through an objects array, containing file path each one, check if it exists and find some line by a key in each one. Therefore, it would be DataProvider returns its Object[][], further @Test 1 receives each Object[], checks if a file exists, then @Test 2 would check it inside, but Test 1 won't give the control, till walk through all the file Objects array. How could I build my tests to create a dependancy like:
 "Test File (ok) --> Test content(fail)
  Test File(fail) --> next File;"

I've tried to use @Factory:

public class Factory {
public Object[] createInstances() {
.........
 return check_files.toArray();
}}

public class CheckFile {
@Test(groups={"File"})
     public void testFile(){...}

@Test(groups={"Key"}, dependsOnMethods = {"testFile"}, alwaysRun = false )
    public void testKey() { .....}

but there is the same behaviour - first testFile is going through all files and then moves to their contents, that has no sense. Could you please help me here?
Thank you in advance,
Michael
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=127317#127317


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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

Cédric Beust ♔
Hi Michael,

If I understood correctly, here is one way to do it:

public Object[][] filePaths() {
  return new Object[][] {
    { "file1" },
    { "file 2" }
  }
}

@Test(dataProvider = "filePaths")
public verify(String filePath) {
  File f = new File(filePath);
  assertTrue(f.exists());
  // then look for the key
}

--
Cedric


On 2/25/07, Michael <[hidden email]> wrote:

Hello, Dear gentlemen!

I've unsuccessfully trying to build my testing framework, using TestNG 5.5, sequentially both functionalities but don't get the problem solved.
I need to walk through an objects array, containing file path each one, check if it exists and find some line by a key in each one. Therefore, it would be DataProvider returns its Object[][], further @Test 1 receives each Object[], checks if a file exists, then @Test 2 would check it inside, but Test 1 won't give the control, till walk through all the file Objects array. How could I build my tests to create a dependancy like:
"Test File (ok) --> Test content(fail)
  Test File(fail) --> next File;"

I've tried to use @Factory:

public class Factory {
public Object[] createInstances() {
.........
return check_files.toArray();
}}

public class CheckFile {
@Test(groups={"File"})
     public void testFile(){...}

@Test(groups={"Key"}, dependsOnMethods = {"testFile"}, alwaysRun = false )
    public void testKey() { .....}

but there is the same behaviour - first testFile is going through all files and then moves to their contents, that has no sense. Could you please help me here?
Thank you in advance,
Michael
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=127317#127317


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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

tarun3kumar
In reply to this post by tarun3kumar

Hi Cedric,
thank you for the answer! Actually I've hoped there is a way to separate these two tests: if 1st("file") fails, 2nd("key") is "skipped". The way you suggested I won't get it - it always will be the same test. So when could I use the "passed-skipped-failed" functionality? Is it usable for "hard coded" in testng.xml test data only?
Thanks
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=127336#127336


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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

Alexandru Popescu ☀

On 2/25/07, Michael <[hidden email]> wrote:
>
> Hi Cedric,
> thank you for the answer! Actually I've hoped there is a way to separate these two tests: if 1st("file") fails, 2nd("key") is "skipped". The way you suggested I won't get it - it always will be the same test. So when could I use the "passed-skipped-failed" functionality? Is it usable for "hard coded" in testng.xml test data only?

Not sure I have fully understand your problem, but you can probably do
something like:

@Factory(dataProvider=dp)
public Object[] createTest(String fileName) {
   return new CheckFile(fileName);
}


HTH,

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator

> Thanks
> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=127336#127336
>
>
> >
>

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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

Cédric Beust ♔
In reply to this post by tarun3kumar
Michael,

The problem with what you are trying to achieve is that you want method A to depend on method B but only if they are passed the same parameters by a data provider, which is not supported at the moment.

Hence my suggestion to put your file check and then your test in the same method...

--
Cedric


On 2/25/07, Michael <[hidden email]> wrote:

Hi Cedric,
thank you for the answer! Actually I've hoped there is a way to separate these two tests: if 1st("file") fails, 2nd("key") is "skipped". The way you suggested I won't get it - it always will be the same test. So when could I use the "passed-skipped-failed" functionality? Is it usable for "hard coded" in testng.xml test data only?
Thanks
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=127336#127336







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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

tarun3kumar
In reply to this post by Alexandru Popescu ☀

@Factory does not allow dataProvider paramter, sorry.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=127487#127487


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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

tarun3kumar
In reply to this post by Cédric Beust ♔

Hi Cedric,
yeah, I got it. But how can I stop the tests running? Though such a test failes ("file not found"), data provider keeps on to supply data and calls the test method again. It might be good, but have I a control on this?
Thanks,
Michael
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=127493#127493


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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

Alexandru Popescu ☀
In reply to this post by tarun3kumar

On 2/26/07, Michael <[hidden email]> wrote:
>
> @Factory does not allow dataProvider paramter, sorry.

The trunk has this feature, so you can give it a try.

However, you are not specifying from where you obtain this data. If
you are using a stable version then you can retrieve this data
directly in your @Factory method and use the approach I have
suggested.

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator

> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=127487#127487
>
>
> >
>

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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

tarun3kumar

Hi Alex,

I didn't really get you. I'm using TestNG 5.5(downloaded), @Factory creating file-objects array, the object's class contains @Test method checking a file and then passing on to check its content in the same method. As I got from Cedric, I cannot specify another @Test method, that will check the content, being skipping if a file does not exist.
Thanks,
Michael.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=127597#127597


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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

Alexandru Popescu ☀

Michael, as I already said it I am not sure if I fully understand your
explanations, but here is how I would try to address the problem:

public class MyTestFactory {
   @Factory
   public Object[] createTests() {
        File[] files = getFiles();
        MyTest[] tests= new MyTest[files.length];
        for(int i= 0; i < files.length; i++) {
               tests[i]= new MyTest(files[i]);
        }

        return tests;
   }

   protected File[] getFiles() {
      // the code from your current @DataProvider
   }
}


public class MyTest {
     private File fileUnderTest;

     public MyTest(File f) { fileUnderTest = f; }

     @Test
     public void checkFileExistence() {
     }

    @Test(dependsOnMethods={"checkFileExistence"})
    public void otherChecks() {
    }
}

So, the @Factory creates test instances initialized with the data.
Each test instance is run (MyTest) and while run the fail-skip
sequence is correct and you are using the same data for both methods.

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator

On 2/26/07, Michael <[hidden email]> wrote:

>
> Hi Alex,
>
> I didn't really get you. I'm using TestNG 5.5(downloaded), @Factory creating file-objects array, the object's class contains @Test method checking a file and then passing on to check its content in the same method. As I got from Cedric, I cannot specify another @Test method, that will check the content, being skipping if a file does not exist.
> Thanks,
> Michael.
> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=127597#127597
>
>
> >
>

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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

tarun3kumar

Hi Alex,
it looks very pretty. Thank you very much
Michael
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=127903#127903


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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

Alexandru Popescu ☀

On 2/27/07, Michael <[hidden email]> wrote:
>
> Hi Alex,
> it looks very pretty. Thank you very much
> Michael

Glad you liked it and found it usefull.

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator

> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=127903#127903
>
>
> >
>

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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

tarun3kumar

Hi Alex,
sorry to report you, but this way I did not succeed. In instance, I had tried the scenario before to refer you and that's Cedric answered to as not supported and suggested to call "checkContent" from within "checkFile", i.e. I cannot use tests dependancy between test methods in a class, which Factory or DataProvider is using. In our case, first test method (checkFile) runs on each test data and the second test method begins upon the first finished to pass on all failes.
My conclusion: if I'm using Factory/DataProvider functionality, I cannot use test dependancy/test performing order control, in other words, most of TestNG advantages.
Michael.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=128593#128593


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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

Alexandru Popescu ☀

Michael, I must confess that you lost me. Can you share the code that
you are saying is not working and tell us what would you expect and
what do you actually see?

toodle oo,

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator


On 3/1/07, Michael <[hidden email]> wrote:

>
> Hi Alex,
> sorry to report you, but this way I did not succeed. In instance, I had tried the scenario before to refer you and that's Cedric answered to as not supported and suggested to call "checkContent" from within "checkFile", i.e. I cannot use tests dependancy between test methods in a class, which Factory or DataProvider is using. In our case, first test method (checkFile) runs on each test data and the second test method begins upon the first finished to pass on all failes.
> My conclusion: if I'm using Factory/DataProvider functionality, I cannot use test dependancy/test performing order control, in other words, most of TestNG advantages.
> Michael.
> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=128593#128593
>
>
> >
>

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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

tarun3kumar

Hi Alex,
I'd checked the code you provided-like or that the TestNG manual provides and got my conclusion verification - when Factory or DataProvider is used, the tests running control by dependancy setting cannot be used.
Let's look the code:

 public class TestFactory {
    @Factory
    public Object[] createInstances() {
        Object[] result = new Object[3];
        for (int i = 0; i < 3; i++)
            result[i] = new MyTest();
        return result;    
    }
 }

public class MyTest {

    @Test( )
    public void test1() {
       System.out.println("I'm the first");
        assertTrue("Failure", false);
    }

    @Test( dependsOnMethods = {"test1"} )
    public void test2() {
        System.out.println("I'm the second");
    }
}

testng.xml content:

<!DOCTYPE suite SYSTEM "D:/TestNG/src/main/testng-1.0.dtd">
   <suite name="My Factory Test" verbose="2">
     <test name="MyTest1">
         <!--  -->
         <classes>
           <class name="MyTest"/>
         </classes>
     </test>
    <!-- -->
     <test name="MyTest2">
         <classes>
           <class name="MyTest"/>
        </classes>
     </test>
   </suite>

Here I don't use Factory class and got all the prettiness of TestNG control - when test1 fails, the second is skipped. If I change <class name> to Factory class the tests running flow is: first 3 runs of test1 sequentially and only then test2 appears as "skipped". But I'd expected "test1-test2" pairs sequence, just like when I don't use Factory (or specify only one object creating in Factory), therefore increasing testng.xml file by adding a lot of <test> and parameters.
I'm dissapointed to discover it, since I think that's the main important feature of automation testing - "test data - control" separation and I've expected to find it in the product, moreover it exists, but somehow does not work in such a power feature like Factory. I'll be glad to see your opinion.
Thanks,
Michael
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=130230#130230


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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

Alexandru Popescu ☀

Michael can you please tell me what is the impediment of not having
the exact pairs test1-test2? I don't see one, as long as the contract
that test2 should be invoked after test1 is fulfilled. Can you please
further ellaborate?

TIA,

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator


On 3/7/07, Michael <[hidden email]> wrote:

>
> Hi Alex,
> I'd checked the code you provided-like or that the TestNG manual provides and got my conclusion verification - when Factory or DataProvider is used, the tests running control by dependancy setting cannot be used.
> Let's look the code:
>
>  public class TestFactory {
>     @Factory
>     public Object[] createInstances() {
>         Object[] result = new Object[3];
>         for (int i = 0; i < 3; i++)
>             result[i] = new MyTest();
>         return result;
>     }
>  }
>
> public class MyTest {
>
>     @Test( )
>     public void test1() {
>        System.out.println("I'm the first");
>         assertTrue("Failure", false);
>     }
>
>     @Test( dependsOnMethods = {"test1"} )
>     public void test2() {
>         System.out.println("I'm the second");
>     }
> }
>
> testng.xml content:
>
> <!DOCTYPE suite SYSTEM "D:/TestNG/src/main/testng-1.0.dtd">
>    <suite name="My Factory Test" verbose="2">
>      <test name="MyTest1">
>          <!--  -->
>          <classes>
>            <class name="MyTest"/>
>          </classes>
>      </test>
>     <!-- -->
>      <test name="MyTest2">
>          <classes>
>            <class name="MyTest"/>
>         </classes>
>      </test>
>    </suite>
>
> Here I don't use Factory class and got all the prettiness of TestNG control - when test1 fails, the second is skipped. If I change <class name> to Factory class the tests running flow is: first 3 runs of test1 sequentially and only then test2 appears as "skipped". But I'd expected "test1-test2" pairs sequence, just like when I don't use Factory (or specify only one object creating in Factory), therefore increasing testng.xml file by adding a lot of <test> and parameters.
> I'm dissapointed to discover it, since I think that's the main important feature of automation testing - "test data - control" separation and I've expected to find it in the product, moreover it exists, but somehow does not work in such a power feature like Factory. I'll be glad to see your opinion.
> Thanks,
> Michael
> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=130230#130230
>
>
> >
>

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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

tarun3kumar

Hi Alex,
I mean not just "test1-test2", but full control on tests performing flow, i.e. dependancy that implemented by @Before/@After/dependsOn options. It could be "test1,test2, ... -> test n" if you wish. As I wrote, it works fine if there is a class, containing depended @Tests and it's passed to TestNG. And it does not work if there is the Factory class, gathering those @Tests classes and has been passed to TestNG. In this case somehow each @Test method has been called as many times as an amount of Test classes in the array the Factory method returns. I expected that there will be the same behavior as without a Factory: each @Test method is called sequentially, depending on control flow, but it does not.

If you'll run the code above, you'll see the performing flow:
FAILURE:I'm the first
FAILURE:I'm the first
FAILURE:I'm the first
SKIPPED: I'm the second.

And if you'll run it without the Factory, i.e. pass the MyTest to testNG and, say, define 3 <test> ... <class> in testng.xml, so you'll get this:
FAILURE:I'm the first
SKIPPED: I'm the second.
FAILURE:I'm the first
SKIPPED: I'm the second.
FAILURE:I'm the first
SKIPPED: I'm the second.

And this is what I expected to see when I'm using Factory, intended to eliminate a lot of tests/parameters specifying on testng.xml. Moreover, I think you too, since the functionality is already implemented for simple Test class, it just need to be called right when TestNG gets processed the Factory's Test objects array.

Why do I ask for it? Say, I need to design test scenario, when each test is built from steps and the test result depends from the steps results. That's the functionality you creators are supplying, aren't you?
Sincerely,
Michael
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=130360#130360


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

Reply | Threaded
Open this post in threaded view
|

Re: @Factory or @DataProvider?

Alexandru Popescu ☀

Michal, I must confess that I am totally confused by now. I am pretty
sure about the correctness of the @Before/@After/dependsOn contract,
but if you can prove the contrary I am open to investigate it.

Other than this, this thread have started on some topic to which I am
pretty sure I have provided a working suggestion. But now, it looks
like the topic has changed and I am missing a lot of details to be
able to continue it.

BR,

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator


On 3/7/07, Michael <[hidden email]> wrote:

>
> Hi Alex,
> I mean not just "test1-test2", but full control on tests performing flow, i.e. dependancy that implemented by @Before/@After/dependsOn options. It could be "test1,test2, ... -> test n" if you wish. As I wrote, it works fine if there is a class, containing depended @Tests and it's passed to TestNG. And it does not work if there is the Factory class, gathering those @Tests classes and has been passed to TestNG. In this case somehow each @Test method has been called as many times as an amount of Test classes in the array the Factory method returns. I expected that there will be the same behavior as without a Factory: each @Test method is called sequentially, depending on control flow, but it does not.
>
> If you'll run the code above, you'll see the performing flow:
> FAILURE:I'm the first
> FAILURE:I'm the first
> FAILURE:I'm the first
> SKIPPED: I'm the second.
>
> And if you'll run it without the Factory, i.e. pass the MyTest to testNG and, say, define 3 <test> ... <class> in testng.xml, so you'll get this:
> FAILURE:I'm the first
> SKIPPED: I'm the second.
> FAILURE:I'm the first
> SKIPPED: I'm the second.
> FAILURE:I'm the first
> SKIPPED: I'm the second.
>
> And this is what I expected to see when I'm using Factory, intended to eliminate a lot of tests/parameters specifying on testng.xml. Moreover, I think you too, since the functionality is already implemented for simple Test class, it just need to be called right when TestNG gets processed the Factory's Test objects array.
>
> Why do I ask for it? Say, I need to design test scenario, when each test is built from steps and the test result depends from the steps results. That's the functionality you creators are supplying, aren't you?
> Sincerely,
> Michael
> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=67044&messageID=130360#130360
>
>
> >
>

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