Questions tagged [teardown]

Teardown is the process that occurs after a test has been run to reverse all the things that the test setup. This might include stopping processes that were started, deleting data that was created, uninstalling components that were installed etc.

104 questions
4
votes
1 answer

Rails-How to use MiniTest's Teardown Method

I have been looking around the internet for a long, frustrating, while, and I'm still quite confused as to what the purpose of the teardown() method is in MiniTest and how it should be used. The basic gist I have is that it is 1-run after each test,…
Jo.P
  • 1,139
  • 4
  • 15
  • 35
4
votes
2 answers

playframework testing - set up and tear down - how to?

I've started using playframwork (scala) and I'm writing some tests. Before starting them I'd like to put in some mock data in my db (mongo) and later on when the tests are over remove this data. I've got the code to put/remove this data but can't…
samz
  • 1,592
  • 3
  • 21
  • 37
4
votes
2 answers

Difference between backbone on/off (teardown) and listenTo/stopListening Implementation

I am currently using backbone to implement my app. As part of memory management, I will trigger a teardown of all the views when I am switching views teardown: -> for viewName, view of @subViews view.teardown() for object, events of…
Zhen
  • 12,361
  • 38
  • 122
  • 199
3
votes
1 answer

junit conditional teardown

I want to have a conditional teardown in my junit test cases, something like @Test testmethod1() { //condition to be tested } @Teardown { //teardown method here } in teardown i want to have a condition like if(pass) then execute teardown else…
vpradhan
  • 161
  • 2
  • 7
3
votes
1 answer

Python logging does not log when used inside a Pytest fixture

I have a Pytest + Selenium project and I would like to use the logging module. However, when I set up logging in conftest.py like this @pytest.fixture(params=["chrome"], scope="class") def init_driver(request): start = datetime.now() …
Mate Mrše
  • 7,997
  • 10
  • 40
  • 77
3
votes
1 answer

Is pytest_runtest_teardown called for skipped tests while pytest_runtest_setup is not?

I have a plugin that implements the following hooks: def pytest_runtest_setup(item): item.config.bla = Bla() def pytest_runtest_teardown(item): item.config.bla.do_bla() item.config.bla = None All works fine until some tests start to…
CIsForCookies
  • 12,097
  • 11
  • 59
  • 124
3
votes
1 answer

Passing parameters to tearDown method

Suppose I have entity that creates SVN branch during its work. To perform functional testing I create multiple almost same methods (I use python unittest framework but question relates to any test framework): class Tester(unittest.TestCase): def…
fresheed
  • 103
  • 1
  • 7
3
votes
1 answer

Is it possible to run tear down fixture only after all params runs?

For instance if you have: @pytest.mark.parametrize('lang', ["EN", "FR"]) def test_whats_hot_quick_links_are_displayed(self, lang): # Do something here and i have this teardown fixture in…
Froodo
  • 573
  • 1
  • 6
  • 16
3
votes
3 answers

How can I execute code when exiting a thread

I want to execute code at the very end before a thread dies. So what I am looking for is some kind of dispose(), tearDown() method for threads guaranteeing that certain tasks are performed before exiting the thread.
tip
  • 85
  • 1
  • 5
3
votes
1 answer

Teardown for timeit.timeit() function in python

Is there a way to specify a teardown for the timeit.timeit() function in python? I know there are arguments for 'Statement' and 'Setup', but I haven't found a good way to perform a teardown. Including the teardown code in my 'Statment' is skewing my…
Harsh
  • 31
  • 3
3
votes
3 answers

NUnit: Accessing the Failure Message in TearDown()

I'm trying to log the results of automated tests run in NUnit in a small database so that data is easily accessible and more securely logged for various reasons. (There's about ~550 automated tests and running them all can take days) I already have…
Izzy
  • 1,764
  • 1
  • 17
  • 31
3
votes
1 answer

QUnit Async Tests with setup And teardown

I need a little help understanding QUnit internas. I read its source from time to time, but i'm still writing weird test when it comes to asynchronous tests. I understand the concept of asynchronous tests, and the stop() and start() methods (and…
pscheit
  • 2,882
  • 27
  • 29
2
votes
2 answers

Is it necessary to remove the metaClass after using mockDomain in Grails unit tests?

mockDomain provides dynamic methods like save(), validate(), ... for a domain class. Is it necessary to remove the meta classes for each class I mock using mockDomain? class UserTests extends GrailsUnitTestCase { protected void setUp() { …
Arturo Herrero
  • 12,772
  • 11
  • 42
  • 73
2
votes
1 answer

Pytest-xdist: tearDown after all workers finish

When I'm running pytest normally it works perfectly fine (before first test it's upgrading migration and after last test it's downgrading migration). Without using xdist I can just set fixture scope='session' and its work that way. But when I run…
2
votes
1 answer

Correct teardown sequence for Kubernetes infrastructure components

In order to deploy my k8s cluster I kubectl apply -f folder-of-yamls/ And it seems that the order of execution is important. One approach I've seen is to prefix 001-namespace.yaml 002-secrets.yaml etc. to create an ordering. To tear down, if I…
P i
  • 29,020
  • 36
  • 159
  • 267