Contributions
Re: API call in test | aqHttp | Request Library | Test Complete | External Python Libraries
I found a work around although it is not desirable. It seems that the subprocess libary work in Test Complete. This will allow you to run program from cmd. This means that you can run python scripts with regular Python not test complete Python and capture the output of these programs. Code will be displayed below. testcompletescript.py: import sys sys.path.insert(0, 'C:\Python36\Lib\site-packages') import subprocess def testing123(): testing = subprocess.getoutput("path\\to\\external\\script\\externalscript.py") Log.Message("output", str(testing)) externalscript.py: import requests def testing123(): response = requests.get("https://www.google.com") print(response.content) testing123()1.6KViews2likes4CommentsAPI call in test | aqHttp | Request Library | Test Complete | External Python Libraries
I want to make a http request but the Test Complete moduleaqHttp does not provide the features I need. Certain feature I am looking for are allow_redirect, verify_certificate, and so on. The python libary requests does have all these feature. I imported this libary in the manner suggestion by the community while double checking I have the same python version install globally as Test Complete (Python 3.6). sys.path.insert(0, 'C:\\Python36\\Lib\\site-packages') import requests def Testing123(): response = requests.get("https://www.example.com", verify=False) if(response.status_code == 200): Log.Message("All is good!") The libary loads and all seems good but when I run the the function a second time all if Test Complete crashes. This kind of unpredictable behavior is constant when using these 3rd party libaries which are nessessary some of the more complicated tests. Does anyone have an tips?Solved1.7KViews0likes5CommentsCustom “On Error Actions” by having a “Raise exception” option in the on error column
Attached as a PDF is my idea in a better format! In the project window there is a drop down under the column of On Error. This field determines what TestComplete does when it encounters an error. The option of this are Continue running, Stop test item, Stop project, or Inherit from project. I would like to add one option to this called Raise exception. This would allow users to do their own error handling by wrapping their entire test function associated with the test item in a try catch statement. One use case for this would be running a test multiple times with different data (ie: Account Number). When an error occurs we would like it to move onto the next account not continue executing with this same account so continue running will not work in this case. If we use stop test item we will not be able to execute the accounts after it. This is why there should be a 5th custom option that will let you handle it yourself. This is how a test case would be structured with multiple data points (ie: account numbers) if this feature existed: def MultipleDataPointTest(): accounts = ReadAccountsNumberDataBase(querry) for account in accounts: try: #Arrange testCaseAccountNumber = int(account[0]) Log.PushLogFolder(Log.CreateFolder("Test data: " + str(testCaseAccountNumber))) #Act TestStep1() TestStep2() TestStep3() #Assert confirmValue = getValue() if(not confirmValue): Log.Error("Test Failed") Log.Error("Test Passed") CloseOpenBrowsers() Log.PopLogFolder() except Exception as e: CloseOpenBrowsers() Log.Warning("The error was: " + str(e)) Log.Warning("Moving on to next account.") Log.PopLogFolder() continue This problem arises because Smart Bears has there own error handling and when there is an error in one of the TestComplete modules it is already handled. See code below for what kind of errors throw exception when test item on continue running: #generic function to call possible functions errors def Testing(): try: #replace with any below to see result Error2() except Exception as e: Log.Warning("The error was: " + str(e)) pass # generic python error # WILL raise exception def Error1(): Log.Message(badvar) Log.Message("Still going") # Click on Object that does not exist # will NOT raise exception def Error2(): Aliases.browser.Click() Log.Message("Still going") # Enter .Keys() on Object that does not exist # will NOT raise exception def Error3(): Aliases.browser.Keys('[Enter]') Log.Message("Still going") # Log.Error(string) # will NOT raise exception def Error4(): Log.Error("Bad thing") Log.Message("Still going") # Purposeful execution raising # WILL raise exception def Error5(): Log.Error("Bad thing") raise Exception Log.Message("Still going")1.5KViews3likes1CommentSession Creator / New User Session / Windows Settings
I have created a python script that launches Session Creator with the desired parameters. I have been able to use this program successfully for around the last 3 months but have never been able to use the /UA flag. This flag is ment to create a new user session instead of using the active one. After adding some logging to my python program I can see that SessionCreator is out putting this error message. Although I have gone through multiple online solutions I have not been able to find the correct windows settings to make this work. Does anyone have any suggestions? SessionCreator : Failed to create the user session. The user 'computer-name\\qa' failed to log in to this host using Remote Desktop. The remote computer requires Network Level Authentication, which your computer does not support. For assistance, contact your system administrator or technical support.Solved2.8KViews0likes1CommentRe: Test Complete Command Line: Calling tests within a folder or parent test item.
Yeah seems like running it with the/p:project /u:unit /rt:function is the best way astristaanogre mentioned also. Unforchulately not all test items are named the same as the function they call which isnt a super big problem but another thing to refactor. Better than having multiple copies of the same test. Is there any talk of adding these feature to TestComplete or a place we can submit suggested features?2.7KViews0likes3CommentsRe: Test Complete Command Line: Calling tests within a folder or parent test item.
/project:project_name/unit:unit_name/routine:routine_name https://support.smartbear.com/testcomplete/docs/working-with/automating/command-line-and-exit-codes/command-line.html#proj-unit-routine Update: This may work for me. This calls the function with a specific "unit" or .py file. I would still want there to be a way to calll subitems but it seems that there is no way. Also passing in multiple test names commandline would be great. Are these things truly not in Test Complete?2.8KViews0likes5CommentsTest Complete Command Line: Calling tests within a folder or parent test item.
Hello , I am calling Test Complete command line from the pythonsubprocess libary. One of the thing I want to do in this script is sometimes call the parent test "SmokeTest" and sometimes call a sub test "BasicSearchTest". The only way I have gotten it to work thus far is to duplicate all my tests and leave on the same level as SmokeTest test item. Is there really no way to call a sub test? If so are there any work arounds that are less messy?Solved2.8KViews0likes6CommentsRe: TestComplete command line problems
This did work. Thank you! I did figure out why it was having problems when I switch to a different computer. I was opening TestComplete with the subprocess Python libary and on the first computer Python was installed for just the user and on the second it was installed for the whole computer.2KViews0likes0Comments