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!Solved26KViews0likes2CommentsHow to import a javascript class and extend it in another script unit
Hi I am trying to use two Javascript projects - and export a class defined in one to be extended (inherited) in another. The example herehttps://community.smartbear.com/t5/TestComplete-General-Discussions/how-to-import-a-javascript-class/m-p/149161#M27448 shows how to use require and create an instance of the class. However, I would like to inherit the class (ES6) and define or override the methods. I was able to do this using prototype based inheritance (ES3). But unable to do this using ES6 terms. The "import" keyword usage shows syntax error "Unexpected token import". If I use require, then I cannot actually use it with extends e.g. (Note that I have shared the Parent.js into the project) //In Parent.js class ParentApp { constructor(x) { this.name = x; } } module.exports = { ParentApp: ParentApp } //In Child.js var parent = require("Parent") class Child extends parent.ParentApp { constructor(y, z) { super(y); this.age = z; } } Here the "parent.Parent" is not working. And I can't use import keyword. (Note that sometimes having the script name same as class name seems to cause issues and that's why I use Parent and ParentApp to differentiate) So how do I do this? Is ES6 fully suppported in Test Complete 14?Solved16KViews0likes6CommentsSSL Security error when running SQL scripts
Hey all. Wemade some security updates switching from TLS 1.1 to TLS 1.2 on our SQL servers and we get the following error when attempting to connect to the server "[DBNETLIB][ConnectionOpen (SECCreateCredentials()).]SSL Security error" for the script in particular we use a connection string like follows "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DBNAME;Data Source=SERVERNAME;" NOTE:I also changed it to use ODBC instead and still for the SSL Security Error Prior to the security update, everything has been hunky dory and we have not had errors with anything else. has anyone else experienced this issue or know the best way to resolve?Solved15KViews0likes4Comments[TechCorner Challenge #8] Finding Elements on a Web Page
Hi TestComplete Community! Today, I bring you a new TechCorner Challenge task 🙂 By completing the tasks, you will not only learn TestComplete features but also get into the TechCorner Leaderboard. Today we will use the Leaderboard table itself to sharpen your skills! Let’s use TestComplete to find out if a user is on the table and how many points they gained so far! Task: Create a TestComplete script that will go to theLeaderboard page, search for yourself (by your user name) and a user named tristaanogre in the table and, if this user is mentioned on the Leaderboard, post their score to the log. Can you compete with people in the Leaderboard?😊 Difficulty: Tip: You can useFindChildorFindElementin your script. Note: You will need a Web Module to fulfill this task. Good luck!Solved13KViews2likes7Comments[TechCorner Challenge #9] Generate a random number within a range
Hi Community! Another awesome task is ready🙂 By completing the task, you will not only learn TestComplete features but also get into the TechCorner Leaderboard. Participate in the challenge and earn new unique badges! Check out some of these awesome rewards: Let's imagine that you are testing an application that has gaming elements - a knight is using a legendary sword to slay a dragon! And, the sword will deliver damage in the following range - from 30 to 75. Instead of using the same number every time, you want to generate a random number on each run and enter it in the application. How would you do it in TestComplete? Let's see if we can get an example for each scripting language (JavaScript, JScript, Python, VBScript)! Task: Generate a random number within the following range (30-75) in TestComplete using a scripting language of your choice. Difficulty: Bonus: You will get an additional point for each script written in a different language. Best of luck!Solved11KViews1like10CommentsLanguage of aqConvert.DateTimeToFormatStr
Hello, I have an application that i have to test in English and in French, at different URL-s. One of the things i have to test is, at the last page, a string which, with words, tells me the date of an appointment, and it is of the form Friday, December 13, 2019 ─ 08:00 pm I have the date the form of numbers, i.e. 13 for the day, 12 for the month, and so on. So i put these numbers in a datetime structure and use aqConvert.DateTimeToFormatStr to convert the datetime to a string with the appropriate format modifiers, and compare the obtained string with the string really displayed on the web page. When my page is in English, everything is fine! However, the problem arises when the application is in French. In this case, since my computer has an English language OS, so DateTimeToFormatStr converts the date to a string in an english language, as above. But my application is in French, so it displays the string as: Vendredi 13 décembre 2019 ─ 20:00 pm So my question is, is there any way to tell DateTimeToFormatStr to use another locale, not the default one in English? Or alternatively, is there any way to change via the script the regional settings of my computer temporarily to French, to make the comparison, and to switch them back to English? Of course without stopping the script? The idea is to compare the result of DateTimeToFormatStr with the string displayed by my application, regardless of the app language. All suggestions are appreciated!Solved5.8KViews0likes14CommentsKeyword vs Scripting in Test Complete 12
Hi all: I searched in the forums and this discussion occurred years ago but I feel that things may have changed in the latest version. My question is this: Scripts vs keyword tests-- which is better for a .Net VB application? I am currently working on building an automation infrastructure/library for a suite of applications written in Visual Basic with highly visual components. I do have scripting/programming experience in automation, but it seems if keyword tests-- you get more bang for the buck. I have figured out how to call various aspects of my application and do checkpoints via keyword tests. What is the advantage of recording a script test or writing one within the confines of test complete? I am not really seeing any benefit here. Also is it true that if you write a script from scratch you cannot get a visualizer component? Thanks! MicheleSolved5.7KViews0likes7Comments[TechCorner Challenge #11] Converting UTC TimeDate in an Excel file
Hi everyone! Up for a challenge? By completing the tasks, you can practice your skills of working with TestComplete features and also get into the TechCorner Leaderboard! Today, we are going to work with UTC DateTime stored in an Excel file. Task: Read the UTC DateTime in an Excel file (attached), convert the value for the PST (Pacific StandardTime) time zone and log each date in the following format: <month name> <day of month>, <full weekday name>. For example: September 8, Tuesday. Difficulty: Note: Find the Excel file attached. Steps to do this: 1. Read the dates from the Excel file using one of the approaches described in Working with Microsoft Excel Files. 2. Convert the dates using the aqDateTime object methods. 3. Log the date using the aqConvert.DateTimeToFormatStr method. Best of luck to all participants!Solved5.6KViews0likes8CommentsTestComplete 11.0 - Memory Issue
Environment Details: Windows 7, 64 Bit, 8 GB RAM TestComplete 11.0 Project Details: Used NameMapping Approach Defined All object references in one script file as Global Variables. There are 3000+ Variables. Reading and Writing Data from Excels Problem: When i open my project. RAM usage is 320-340 MB When i run any of my test function RAM usage will increase to 450-500 MB If i keep on running test functions RAM usage will increase to 800+ MB This is making my test execution go slow and crashing application under test. Anybody faced this kind of issue ? Why RAM usage will be increasing every time ? Is there any memory leakage ? Why after execution RAM usage is not coming to normal ?5.4KViews1like18Comments[TechCorner Challenge #1] Passing custom command-line arguments as test parameter
Hi Community! This resource we are creating together has gained so much value over the years. Tons of helpful content can be found in the TestComplete Community thanks to all of you! I propose that we take it to the next level by adding even more useful things to the TechCorner tag - a tag where we keep your tech articles, script examples, use cases, etc. Here's your chance to share expertise and contribute. Task:Write a script that will take the value of a custom argument from the TC command line and use this value to run a parameterized test. Difficulty: For example, imagine that you have a web test that takes the name of the browser as a parameter. The script should check the command line TC was launched with, find the /BrowserName parameter, read its value, and pass it to the web test as a parameter. If the command line contains /BrowserName=chrome, the web test should launch Chrome; for /BrowserName=firefox the web test should launch Firefox, etc. Good luck!Solved5.3KViews3likes7Comments