PocoUnit icon indicating copy to clipboard operation
PocoUnit copied to clipboard

SetUpClass() is not listening while running test suite.

Open rvijai92 opened this issue 6 years ago • 5 comments

Hi, I have done the setup for multiple test cases to run using pocotestsuite module but whenever executing runner file, only listening to the setUp() function, not listening the setUpClass(). Can you provide clear details on how to execute the multiple test cases simultaneously.

rvijai92 avatar Jan 14 '19 11:01 rvijai92

setUpClass will only be invoked once at the initialization stage of class TestSuite or TestCase. Here is an example of how to run cases together https://github.com/AirtestProject/my-testflow/blob/master/testflow/scripts/multitests_together.py . Please note that together means all testcases will be run without a guaranteed sequence. If u really want simultaneously, u have to connect multiple smart phones.

adolli avatar Jan 21 '19 03:01 adolli

more differences about setUpClass and setUp. setUpClass of each TestCase or TestSuite invoke before running all testcases, while setUp is invoking just at the beginning of the TestSuite or TestCase.

a sequence flow looks like:

...setUpClass -> setUp1 -> tearDown1 -> setUp2 -> tearDown2 -> ...tearDownClass

adolli avatar Jan 21 '19 03:01 adolli

Thanks adolli, If there are 10 test cases, Will be able to write that 10 test cases in the 10 .py modules. So every time SetUp, setUpClass, tearDown and tearDownClass will it be invoked right for Every test run. In that scenario, Every time app will be closed and reopened often for each runTest().

Base Module: (.py) SetUpClass: SetUp: TearDown: TearDownClass:

TestCase1 module( Extends with Base): runTest:

TestCase2 module( Extends with Base): runTest:

TestCase3 module( Extends with Base): runTest:

TestCase4 module( Extends with Module 1): runTest:

Questions:

  1. Can I write runTest without having class in the different?
  2. Do I create a runner module for the suite run?
  3. Is that possible the continue scenarios will be integrating between 2 test cases?
  4. I have seen there are two 2 classes such as PocoTestSuite and PocoTestCase. To which class do I want to extend?

rvijai92 avatar Jan 21 '19 05:01 rvijai92

  1. u cannot write a testcase without a class or class-like structure. Unless u make your own execution sequence.
  2. Simply use pocounit.run(xxx) where xxx is your testcase or testsuite.
  3. I am not sure what do u mean by "the continue scenarios". Is that you cannot determine the next case to run until the current case is finished?
  4. PocoTestSuite is a container for PocoTestCase. 1 suite could have 1 or more suites/cases. Both of them have the same lifecycle stages. Cases in the suite are executed sequentially.

adolli avatar Mar 01 '19 07:03 adolli

@rvijai92 sorry for the inconvenience and late reply, i am too busy all the time.

adolli avatar Mar 01 '19 07:03 adolli