AirtestProject / PocoUnit

Unittest framework for test automation
Apache License 2.0
53 stars 15 forks source link

SetUpClass() is not listening while running test suite. #9

Open rvijai92 opened 5 years ago

rvijai92 commented 5 years ago

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.

adolli commented 5 years ago

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 commented 5 years ago

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
rvijai92 commented 5 years ago

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?
adolli commented 5 years ago
  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 commented 5 years ago

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