Suggestion for better way to using TC with Python scripting
Hello beautiful people,
I am new to TC, and I am using Python to create my testing script.
I would like to see if anyone can proivde me some feedback or better way to do my testing.
I am not sure if the way that I am doing is good for long term or if it's even the right way to use TC.
My strucutre looks like the example below:
Basic I have a project called Library.
In that project, it contains two scripts:
1. Mouse_Script
2. Keyboard_Script.
Mouse_Script and Keyboard_Script contain a lot of functions.
Example in Mouse_Script:
def mouse_rightClick()
...
def mouse_leftClick()
...
Example in Keyboard_Script:
def hit_enter()
...
def hit_control()
...
After that, I have another project called smoke_test.
It contains two scripts for example, one is called test_case1, and another one called test_case2.
Mouse_Script and Keyboard_Script are linked to Project smoke_test as reference, so that test_case1 and test_case2 can use the functions that's in the Library project.
test_case1 script looks like below:
import Mouse_Script
# testing mouse right click
Mouse_Script.mouse_rightClick()
test_case2 script looks like below:
import Keyboard_Script
# testing keyboard 'Enter' key
Keyboard_Script.hit_enter()
----------------------------------
I put test_case1 and test_case2 in the test organize section, and then run them if I want to a smoke test.
Is above set up a correct way to use TC do testing? Or is it a better way to do it or best practice?
Thank you guys!
Appreciate
What you have shown is perfectly OK in technical sense.
But when come to best practice it means what best for your requirements.
Each tester using TC for different test purpose and test should be designed according.
So how you organize your classes libraries or name mappings would mostly depends on your situation.
for me TC is flexible to used in different situations (at least most I have encountered)
So you have to do some research what & how would be best for you.
Having said that there are some general guidelines how TC would used in best way.
Mainly how you organize name-mapping. Those are discussed over and over again in this forum you can search and find.
But if you have specific scenarios you would like to know how to tackle, forum could be able to help you.