How testcomplete works with scripts not being written inside the class?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How testcomplete works with scripts not being written inside the class?
My question is if I have written my scripts using python. Let consider the below example
# example1.py
def test():
print "hello world"
# example2.py
class sampletest:
def test():
print "hello world"
In the above examples, one being wriiten without class and other within class. I was surprised how testcomplete works with first example .
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This behavior is similar to a launching this code(e.g. in Python IDLE):
def test(): print "hello world" test()
but if you want to print the message in TestComplete, need to use: Log.Message("hello world")
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @DKumar04,
Does IStaroverov's suggestion answer your question?
Tanya Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
but my question is not about printing it's about how test complete works when there is no class but only routines inside .py script file?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As far as I understand it works without the class. Do you have any errors?
Tanya Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Keep in mind... this is Python SCRIPT, not full Python. Not everything needs to have a class to be able to execute. You can use classes, but they are not required for execution of functions.
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
