--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
thanks for the prompt reply. I'm still working on javadoc'ing and
final polish, but I hope you can make sense out of this. There are
only three things that I need in order to make GuiceBerry work:
1. I need to be able to create an instance of a "TestDescription"
(basically a testframe-agnostic representation of a test)
2. I need to be able to run some code "before the test runs"
3. I need to be able to run some code "after the test runs"
Here, before and after mean as early as possible and as late as
possible, since the first step injects stuff into the test, and the
the other makes those injections invalid. That's it.
Just so you get a more concrete idea, here are the current adapters
for junit3 and junit4, paired with the "same" HelloWorld test that
makes use of these adapters:
* Vanilla JUnit3
http://code.google.com/p/guiceberry/source/browse/trunk/src/com/google/guiceberry/junit3/ManualTearDownGuiceBerry.java
http://code.google.com/p/guiceberry/source/browse/trunk/doc/tutorial/test/junit3/tutorial_0_basic/Example0HelloWorldTest.java
* JUnit3 with TearDownTestCase (skip this if you are not familiar with
TearDownTestCase, it will just make it more confusing)
http://code.google.com/p/guiceberry/source/browse/trunk/src/com/google/guiceberry/junit3/AutoTearDownGuiceBerry.java
http://code.google.com/p/guiceberry/source/browse/trunk/doc/tutorial/test/junit3_tdtc/tutorial_0_basic/Example0HelloWorldTest.java
* JUnit4
http://code.google.com/p/guiceberry/source/browse/trunk/src/com/google/guiceberry/junit4/GuiceBerryRule.java
http://code.google.com/p/guiceberry/source/browse/trunk/doc/tutorial/test/junit4/tutorial_0_basic/Example0HelloWorldTest.java
Z
sorry for the enormous delay. I've been buried in working trying to
get the release out.
Once I got to this, though, I quickly managed to put together
GuiceBerry support for TestNG. Ignoring the borked copied and pasted
comment (I'll fix this soon), check this:
http://code.google.com/p/guiceberry/source/detail?r=246
Even though it's a no-op test, it's totally functional. It's a bit
verbose -- about as verbose as a vanilla JUnit3. Contrast with the
JUnit4, which is the least verbose. To cut down on verboseness, one
could extract those two methods to a base class, but that, as I
understand, is not idiomatic to TestNG (as it is in JUnit3). If you
think of a way to cut down on this verboseness, please do let me know.
PS: As for TestNG's support for injecting data, I do believe it's
orthogonal with what GuiceBerry addresses. The tutorial 0 is
misleading, in that sense, since it shows off GuiceBerry in a totally
artificial way. The tutorial 1, on the other hand, is much more
interesting...
Peace,
Z
Hi Luis,
This sounds interesting, can you give more details on what you need? (feel free to respond to the group)
--
Cédric
On Fri, Jul 9, 2010 at 10:18 PM, Luiz-Otavio Zorzella <zorz...@google.com> wrote:
Hi,
I'm working on release 3.0 of GuiceBerry, which is a shim between test
frameworks and Guice (see go/guiceberry). I currently (as of this
release which is about to go out) have JUnit 3 and JUnit 4 support,
but I made the tool agnostic of test framework, and I'd love to have a
TestNG adapter for that, but I need help from someone that can guide
me in the right direction. I expect this to be short and simple (each
of the junit-specific adapters is about 15 lines of code, so that's
what I expect for TestNG as well).
Let me know if you are interested.
Thanks,
Z
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
--
Cédric
Waheed,
From your post, its not clear where you are hitting a null value, but I am guessing that the below illustration explains your problem
@Test
public void testStatusCode(ITestContext testContext){
// your rest of the code goes here
testContext.setAttribute("AUTH_TOKEN", response.path("token"));
}
@Test
public void createUser1(ITestContext testContext){
//Am guessing the below line is what is giving you null correct ?
System.out.println((String) testContext.getAttribute("AUTH_TOKEN"));
}
Is the above illustration correct ? If yes, then its perhaps because sometimes createUser1() gets executed first, followed by testStatusCode() method.
You should be having TestNG run your tests in an order (i.e., first run testStatusCode() followed by createUser() using one of the following mechanism in @Test annotation:
Here’s one variant of what I am talking about:
@Test
public void testStatusCode(ITestContext testContext){
// your rest of the code goes here
testContext.setAttribute("AUTH_TOKEN", response.path("token"));
}
@Test(dependsOnMethods="testStatusCode")
public void createUser1(ITestContext testContext){
System.out.println((String) testContext.getAttribute("AUTH_TOKEN"));
}
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
Hello Cedric
Greetings
post.setEmail("pe...@example.org");
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
--
Cédric
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.