Skip to content

Ulrich-Palha/TestNG-Question

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

I first posted this on StackOverflow  http://stackoverflow.com/questions/8609516/best-way-to-write-testng-tests-where-one-test-depends-on-the-output-of-another, where Cedric suggested I post this to the TestNG users group http://groups.google.com/group/testng-users/browse_thread/thread/4cc6d556cc3b6a6c

Summary
I have several webservices that all return a status code and a XML payload. For each one, I need need to test and verify 
    1. That they return the expected status code for the given input (test called testWebserviceStatus in code, but now referred to as TestA)
    2. If the status code is correct, then I would like to verify 1 or more properties of the payload. Every property is independent, so I would like to have each property verification run as a separate test (test called testWebserviceProperties in code, but now referred to as TestB).

Other requrements
    1. The ability to add/remove the list of webservices to test and add/remove the list of properties to verify for each service without updating the test code.
    2. If Test A fails, then its associated TestB should be skipped
    3. The test report should clearly show the success failure of each TestA/TestB test along with the webservice/property that was being tested

TestA takes its input from an DataProvider fed by an XML file.
TestB requires the output (XML payload) of TestA, so I initially made it depend on it via DependsOnGroups.  However, since that meant that any failure of TestA would skip ALL runs of TestB , I resorted to using a higher priority for TestA.


Question:
Given these requirements, is this the recommended TestNG way to structure this test, or is there a better way.

The attached code is a greatly simplified version of what I am trying to do.

About

Code for a TestNG question I have

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages