Variable declaration in a javascript class
Hi, Can we declare global variables within a javascipt class, outside a function? When I try to declare a variable, it gives error: Syntax Error: Unexpected identifier Sample code: class Test { var abc; //received above error var abc = "Test"; //received above error let def; //received above error function1() { //some code here var abcd = "New"; //works fine here } Please suggest how I can create variables outside the functions in this scenario. Thanks!Solved28KViews0likes2CommentsComparing table data in IF not working
Hello, I have this weird problem were everything seems correct but TC isn't doing the correct steps. I have a data driven loop, and I am going to check if the product number is a specific product, and it should do the steps I want. This has worked in the past, not sure why it stopped working. In the image below, in the blue box, the product number is filled in - this is correct. For the sake of testing, I added the yellow box - these also give and store the correct values. The problem is in the red box, for some unknown reason it just skips the if. Below is a small snippet of the test log, and you can see that the log action provided the correct product number. Also, you can see that the text in the textbox is also the correct value. And lastly a screenshot of the if itself. Can anybody help me notice the issue? Thanks in advance. LuukSolved7.9KViews0likes28CommentsHow to reach the expected object to map in a combox
Hello all, I have an issue to map an object inside a combo box. Steps followed : - On TC, click on map object icon and select Point and fix option - On my app, open the combo box, point object to map and press shift + ctrl + A - Check object map : I map the border of my object not the object itself. I tried some many times and I also got the same result, I'm not successed to catch only the object, without the border. Full path of the object expected for :[...].WPFObject("ToggleButton", "", 1) Full path of the object mapped : WPFObject("ToggleButton", "", 2).WPFObject("ButtonBorder") Is it possible to "delete" this part ".WPFObject("ButtonBorder")" from the full path ? NB: usually I used the tree for "Object Browser" but because it's a combo box it's not possible (the combo box closed itself and I click somewhere else) Thank you AliciaSolved4.5KViews0likes12CommentsRead excel data/links in javascript test complete
Hi team, I have tried to read the data file using javascript in test complete.But shows error as "Type error: cannot read the property 'SheetByTitle' of null" functionExcelRead() { varexcelFile = Excel.Open("C:\\temp\\DataStorageExcel.xlsx"); varexcelSheet = excelFile.SheetByTitle("Sheet1"); varvalueA = excelSheet.Cell("A", 3).Value; varvalueB = excelSheet.Cell(2, 3).Value; varvalueC = excelSheet.CellByName("C3").Value; } Can any one help regarding this issue or I want to fetch the weblinks from excel file one by one that links need to execute. Thanks in advance.Solved4.5KViews0likes4CommentsUse Enum as a Parameter type in Keyword Tests
Edit: Added a specific Use Case for clarity Like most users I use parameters for my KWTs. Some parameters have a limited option pool e.g. paramater "WantACookie" can have3 and only3 values "Yes", "No" and "Not Sure" This parameter is used to set the text of a combobox. I could create it as a string that correlates with this and each other KWT or script that calls this KWT just needs to send the string. Say, however the the marketing department decided that "Not Sure" is no longer broadcasting the right message and want to change it to "I'm Thinking About It" All those other scripts and KWTs that used to set it to "Not Sure" will break. Is it possible to create the parameter as a list of key->value pairs. That way my other KWTs and scripts can say the vaule should be WantACookie.NotSure and all I have to do is go to my KWTs WantACookie paramter and change the value of the "NotSure" key to "I'm thinking About It" You would probably have to define this KVP list in the parameter type itself I guess and when setting properties in the visual editor, this "Enum" should be available the same way Variables and Parameters are from a dropdown. Aspecific Use Case: The Enum is a way to define a limited amount of set options that you know won't change Say I'm an e-commerce site. I wan't to make sure users don't have a bad experience by accidentally buying something when they intended to just add it to the wish list. Three tests: 1. Textbox1.Keys()->Textbox2.Keys(),texbox3.Keys,etc,-> buttonPlaceOrder.Click() -> Open Wishlist page -> Are ther items ? No -> Pass -> Open Basket -> Are there items? Yes ->Pass 2. Textbox1.Keys()->Textbox2.Keys(),texbox3.Keys,etc,-> buttonAddWishList.Click() -> Open Wishlist page -> Are ther items ? Yes -> Pass -> Open Basket -> Are there items? No ->Pass 3. Textbox1.Keys()->Textbox2.Keys(),texbox3.Keys,etc,-> buttonCance.Click()l -> Open Wishlist page -> Are ther items ? No -> Pass -> Open Basket -> Are there items? No ->Pass All three tests have the data populate in common. I don't really care what data is in there and I won't use it in a Data Loop so it can all be the same and be written into a single test so I don't have to duplicate all those .Keys() and .Clicks() into all my KWTs So, create one KWT PopulateOrder that does the keypresses. One step further I can see the only thing that distinguishes the process is what button gets clicked. If I specify this as a parameter like PopulateOrder(OrderAction) I can change my tests to this by simply dragging the new KWT into my visualiser : 1. PopulateOrder(Order) -> Open Wishlist page -> Are ther items ? No -> Pass -> Open Basket -> Are there items? Yes ->Pass 2. PopulateOrder(WishList) -> Open Wishlist page -> Are ther items ? Yes -> Pass -> Open Basket -> Are there items? No ->Pass 3. PopulateOrder(Cancel)->Open Wishlist page -> Are ther items ? No -> Pass -> Open Basket -> Are there items? No ->Pass The last steps in my Populate order is an if statement: If(OrderAction equals "Order"){buttonPlaceOrder.Click()} If(OrderAction equals "WishList"){buttonAddWishList.Click()} If(OrderAction equals "Cancel"){buttonCancel.Click()} If I drag the KWT into another KWT I can supply this parameter. Problem is, if a user doesn't know the exact string required and they type in, say "PlaceOrder", the KWT will fail because none of the if statements match. If on the other hand I can define the parameter as an enum that the user can choose from a dropdown I know the logic will always work e.g. if(OrderAction equuals OrderActionEnum.Order) {buttonPlaceOrder.Click()} It's something I would really have appreciated when I started using TC. It would have helped standardise my tests by always having the option based parameters defined, thereby avoiding loads of rework due to early inexperience. It still helps because I wouldn't have to open the PopulateOrder just to double check what string I need to send.4.4KViews2likes8CommentsRunning the same test case in Test Complete Multiple Times
I have a couple of test cases that I am generating for a Website and I need to set up several of the cases so that they will run multiple times during my testing of the product. I want be able to add to 20 new records and then update them as we are going.4KViews0likes27CommentsCreate A Wizard for Parameterizing Data Driven Scripts
When working with Keyword tests, after you've recorded a particular test, you can easily select the steps of the test, right click, and select the option "Make data loop" to auto-magically turn you test into a parameterized data driven loop. Seriously, this is an AMAZING feature for keyword tests. However, for writing scripts, if you want to take a recorded script and turn it into a similar loop, there currently is no automatic method for doing so. It requires, instead, the user to do the work themselves to define the variable, configure the data source, parameterize the script, build the loop, etc. It would be great if TestComplete had a wizard where you can select a recorded script routine and perform the same sort of magic that you can do for keyword tests.3.5KViews2likes4CommentsRun A KeywordTest by name
Runner.CallMethod works pretty well with regards to running Keyword tests. You can do a syntax like: Runner.CallMethod('KeywordTests.TestName.Run', 'parametervalue'); However, this is a bit clunky to me. First of all, if you don't have the name up front but want to parameterize this call, you would need to do a concatenated string for the object name. Secondly, this just seems to be a bit out of the way. Code Completion already knows all the tests associated with the KeywordTests object so the information is already there. It would be nice to do something like KeywordTests.TestByName('MyTest').Run('parametervalue'); This just seems more intuitive and lends itself to a much cleaner implementation for creating a framework around the tests. Note that I'd prefer the keyword test to be returned by name so that we have access to things like Test.Variables and Test.Parameters (see my other ideas on KeywordTests).3.4KViews3likes3CommentsThird Party Python Modules For Excel Read
We've been trying to implement use of third party python modules in TestComplete but we're running into everyone's issues in compatibility with TC and external Python modules. At this point, we are running into issue that on secondary run that "import failed with 'NoneType' object is not callable." (https://community.smartbear.com/t5/TestComplete-General-Discussions/Python-fail-to-import-lib-during-the-second-attempt-to-run/td-p/153683). We've been trying to import module xlwings that requires a module name win32api . It seems that TestComplete has issues running this module. We've follow all the install instructions on the forums but we can't seem to get the excel module to work. Has anyone been able to intergrate win32api with their TestComplete code successfully? Edit: We are performing more dynamic tests than bellow including using the COM server for find, createworkbook, etc. Sample code was in Python but Python code took 15 minutes compare to VB which took 1 minute to read a 1375 line workbook)Solved3.1KViews0likes6CommentsWhat would be a good approach to build a framework for data driven testing
I'm trying to build a framework and working on ways to maintain test data in a effective manner. So thought of asking some suggestions here to see if any testcomplete offers something to make this easier. Approach1 Create an excel sheet with all the testcases and its data, and write code using testcomplete's exceldriver methods to read the excel file and call the corresponding methods. I prefer using scripting to create tests rather than keyword tests, so each testcase listed in the excel sheet is a method/function. But in this approach, if i have 100 testcases and in total there are 50 different parameters i would end up having 50 columns, which would make it very difficult to manage. And i also need to execute the same testcase with different testdata Approach2 Use the built-in test executing framework withintestcomplete, save test data into text files and have it in Stores. Read the text files to retrieve testdata. One file for each testcase Or suggest a way which you think might be effectiveSolved2.8KViews0likes5Comments