selenium - TestNG particular tests in isolation -


i have test suite of 6 classes, total of 120 tests between them.

the issue face tests cannot run when other tests running. example, tests a,b,c,d,e,f:

  • a cannot run b or c
  • b cannot run or c
  • c cannot run or b
  • d cannot run f
  • e can run anything
  • f cannot run d

this small example, illustrates point. still want exploit parallelism possible, example d , e running @ same time. still learning testng, have tried following things:

grouping tests cannot run single group - couldn't find way run testng in 'parallel="groups"' mode, 'parallel="classes"' tests in group run in same thread. putting each test cannot run in single class allow 'parallel="classes"' work, mean tests not arranged test functionality, are.

put dependencies around tests - considered having each test depend on 1 other (possibly groups?), forming chain such a->b->c. issue these run in order, might hide issues. problem here test maintainence becomes issue, have ensure chain singular , doesn't break!

creating method interceptor sorts list group - i'm not entirely sure on one, don't think prevent having test running whilst incompatible test selected 'next run'.

i've seen testng & selenium: separate tests "groups", run ordered inside each group seems attempting same goal, different reasons, solution reached there isn't suitable not dependency issue, isolation issue.

is there me?

thanks much,

phil

you refactor tests such current list of classes no longer marked tests. instead, introduce new test proxy classes methods call testing procedures in original classes. way, maintaining code in functional area straightforward. alternatively, since proxy classes based on type of resources use, put them separate tests within suite , use parallel="tests".

in fact, don't have introduce proxy classes. specify tests

<test name="boiler">    <classes>       <class name="org.example.a">          <methods>             <include name="a1"/>             <include name="a2"/>          </methods       </class>       ... <!-- list of methods use boiler -->    </classes> </test> <test name="waterheater">     <classes>       <class name="org.example.b">          <methods>             <include name="b"/>          </methods>       </class>        ... <!-- list of methods use waterheater -->    </classes> </test> 

the advantage of using proxy classes listing out tests can done @ class level instead of method level. mileage may vary.

<test name="boiler">    <classes>       <class name="org.example.boilerproxy"/>    </classes> </test> <test name="waterheater">    <classes>        <class name="org.example.waterheaterproxy"/>    </classes> </test> ... 

the issue these run in order, might hide issues.

testng run sequence of tests in same order each time. believe flaw in design if uncover bugs when things run in different orders, using facilities of testng. there no shortcuts mapping out combinations of sequences might occur , explicitly test them, or @ least manageable subset of them. in light, setting proxy tests, described in first paragraph may best bet, can repeat , re-order them needed.

testing parallelism, asynchrony , race conditions hard. there no shortcuts except, perhaps, design.

i have created blog posting based on answer: http://ancient-marinator.blogspot.com/2013/05/on-testing-scheduling-your-tests.html


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -