Migration Tips

From $1

Using setUpClass from unittest framework

Migrated BaseTestCase.py to using setUpClass instead of setup within basetestcase.py. This allows setUpClass to be run just once for a suite of tests, and maintained throughout all the test cases.

This doesn't affect any tests currently, but it allows us to add new tests which more closely follow the correct procedure of python unittest. Aka we can make the tests more granular and not have one giant test called runTest.

It also allows us to migrate our current tests more easily to the new format. To do so, follow these steps:
1. create a setUpClass method in the test file (ex. test_sso.py), add all the procedures relating to loggin in, etc.
2. Separate the test cases into separate functions, each with a descriptive name. These will now automatically be executed in the test runner in sequence.
3. Add an assert (or multiple) to the end of each function, so unittest will know whether it is a pass or fail. (I think this is necessary, but I'm not sure.) Thoughts?

To see an example of this integration, look at PR 47 on feepay_tests.

Using subtree to include the qa-euronymo-common repo

#setup subtree
#Create the squash commit for later
git remote add common git@github.com:TIES-Software/qa_euronymo_common.git
git rm -r ui_tests/feepay-euronymo/common/
rm -r ui_tests/feepay-euronymo/common/
git commit -m "going to remove this"
git subtree add --squash --prefix=ui_tests/feepay-euronymo/common/ common master
#if there is a change to common code, run this every time
#push subtree changes from local/parent repo.
git subtree push --prefix=ui_tests/feepay-euronymo/common/ common sw_subtree_integration
#create + merge pull request on github TIES-Software/qa_euronymo_common.
#switch to master branch
git subtree pull --squash --prefix=ui_tests/feepay-euronymo/common/ common master

Comments (0)
You must login to post a comment.