[ 5 posts ]

Daniel Ji

  • Username: humblepie
  • Joined: Tue Feb 28, 2012 10:30 am
  • Posts: 147
  • GitHub: humblepie
  • Gists: humblepie
  • Offline
  • Profile
Tags:

YUI3 Test - suite tearDown & setUp

Post Posted: Mon Jun 25, 2012 4:23 pm
+0-
According to the documentation, the tearDown and setUp are supposed to be executed before/after each test, but it's only happening for me once.

Anyone else have this issue?

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 620
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile
Tags:

Re: YUI3 Test - suite tearDown & setUp

Post Posted: Mon Jun 25, 2012 5:01 pm
+0-
I think the documentation is wrong and that setUp and tearDown are supposed to be run once for each Case.

Daniel Ji

  • Username: humblepie
  • Joined: Tue Feb 28, 2012 10:30 am
  • Posts: 147
  • GitHub: humblepie
  • Gists: humblepie
  • Offline
  • Profile
Tags:

Re: YUI3 Test - suite tearDown & setUp

Post Posted: Tue Jun 26, 2012 9:26 am
+0-
Hi Juan,

Hmm. So there are two places to implement tearDown and setUp.

One is at the Y.Test.Case level so that the tearDown/setUp will run for each test in the Test.Case. These tearDown and setUp methods are running as expected.

The other is at the Y.Test.Suite level so that the tearDown/setUp is supposed to run for each Y.Test.Case. This is not the behavior I'm getting. The tearDown/setUp methods are only run once for the suite regardless of the number of Test.Cases that the suite has.

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile
Tags:

Re: YUI3 Test - suite tearDown & setUp

Post Posted: Tue Jun 26, 2012 10:42 am
+0-
The Suite should only run it's setUp and tearDown methods per Suite run, not each test case. The TestCase ones should run per case.

Daniel Ji

  • Username: humblepie
  • Joined: Tue Feb 28, 2012 10:30 am
  • Posts: 147
  • GitHub: humblepie
  • Gists: humblepie
  • Offline
  • Profile

Re: YUI3 Test - suite tearDown & setUp

Post Posted: Tue Jun 26, 2012 10:58 am
+0-
Hi Dav :)

Thanks for the clarification. It's not intuitive for me that the tearDown and setUp is only called once for the entire suite when the tearDown/setUp is called for each test in the TestCase. Well... maybe inconsistent is the word I'm looking for.

So if I wanted to have a setUp/tearDown for each Test.Case, then what would be the best way to accomplish this? Listen to the destroy events for each Test.Case?

Thanks.
  [ 5 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum