charleshbOccasional ContributorJoined 6 years ago9 Posts4 LikesLikes received2 SolutionsView All Badges
ContributionsMost RecentMost LikesSolutionsSeparate the ProjectSuite variables into a separate file For ProjectSuite variables (and Project variables), right now these are clubbed into the main PJS and MDS files. This is making life difficult when different people have to change them simultaneously - and especially when using Source Control (SVN etc.) and when you have conflicts. Also it is much easier to manage and less prone to error if these are kept as a separate file. However, the file has to be linked to the main file so that the test scripts work. Re: Shorter notation for ProjectSuite.Variables, "LocalVars" or "ThisTest" for K Note that I can do this shortening if we use scripts only by creating global variables. But in Keyword Tests it is not possible. Shorter notation for ProjectSuite.Variables, "LocalVars" or "ThisTest" for Keyword Test Variables We do think that the Keyword Test Variables - the way they are referred to in the tests (using the Full Test Name) take much space and are prone to mistakes especially if you are copying a test. We suggest that if a special term like "localvar." can be used that is dynamically referred to the current running test's local variables that should be a great improvement over how we use them today. The Keyword Test Parameters, maybe also need some attention. Also, we see that the "ProjectSuite.Variables." is a prefix that needs to be typed out in any number of tests and scripts that we have. Similarly, for "Project.Variables.". We request that this be given an shorter notation or special term like "pjsvar." and "pjvar." can be created internally so that the display of the test can be improved on the UI (less text) and redundant effort required can be avoided. The UI seems quite cluttered when using Log.Messages and Run Code Snippets in the keyword tests. These things can help improve the situation at least displaywise. Re: AngularJS framework implemented with no unique Id or name mapping for objects We had a similar requirement recently and I found that only DIVs and standard HTML and CSS tags and attributes are identified in TC-14 object browser by default. On these objects that are identified, you need to check the Properties of the objects like tristaanogre advised. Also custom data attributes are a helpful thing to look at as cunderw said. Note that TestComplete either uses the "id" attribute or the "name" attribute to identify the web objects by default on DIVs. see Tools -> Current Project Properties -> Open Applications -> Web Testing -> Object Identification Also, for proprietary UI controls and Angular JS controls, you need to have support within TestComplete to use special tags and attributes to identify objects. see Tools -> Current Project Properties -> Object Mapping For example for DevExpress it's here: https://support.smartbear.com/testcomplete/docs/general-info/supported-technologies/controls/devexpress.html Supported Browser Versions IN TEST COMPLETE 14 https://support.smartbear.com/testcomplete/docs/general-info/supported-technologies/controls/angularui.html Additionally, you can get any custom HTML elements to be idenfitied - otherwise placing IDs on them won't help. For this, refer to TestComplete Web - working with custom elements. see Tools -> Current Project Properties -> Open Applications -> Web Testing -> Custom Attributes In any case, you really have to get back to the DEV team and if required have a live session with them to show that you are not able to identify their objects for automation testing. And if you can try to get them to add the IDs on DIVs at the least that's a good point to start. (And the first image you shared: The panels are all DIV tags in the page, as far as I remember. Note that using "Extended Find" feature is very helpful and necessary when doing the NameMapping - because the tree of the DIV tags cannot be guaranteed in a web application generally.) Re: How to import a javascript class and extend it in another script unit Thanks, Robert! When you find some time if you can validate my solution, I would be quite happy. That's because you are much experienced at using TestComplete and that will give me some confidence. Appreciate your time. Re: How to import a javascript class and extend it in another script unit Hi Robert, Thanks for the prompt response. I did help to reconsider what I was doing because the code I shared with you was OK. But I realised something - the issue was not due to these being in different projects - in fact I had shared the Parent.js into the project containing the Child.js. It was because of circular references. Though the TestComplete documentation says Javascript supports circular references, there is catch here: My example question did not mention the full context - here's the code that I had issues with: PARENT.JS // In Parent.js - In Project 1, but shared into Project 2 using Add Existing Item... var child = require("Child") class ParentApp { constructor(x) { this.name = x; } } function initializeGlobal() { var childObj = new child.ChildClass("Me", 3); } module.exports = {ParentClass: ParentApp} CHILD.JS // In Child.js - in Project 2 - also shared into Project 1 var parent = require("Parent") class ChildApp extends parent.ParentClass { constructor(y, z) { super(y); this.age = z; } } function test() { var myChild = new ChildApp('Bill', 25); Log.Message(myChild.age); } module.exports = { ChildClass: ChildApp } What was happening was that in Parent.js when the first .... var child = require("Child").... was called, the require tried to load Child.JS - and in this was trying to execute "class ChildApp extends parent.ParentClass" which threw an error. This was because parent.ParentClass wasn't loaded yet. If I removed the extends all was well. So what I did was to refactor the code so that the function "initializeGlobal()" was in another common script that avoided the circular referencing. It seems circular referencing fails with extends. SAMPLE WORKING CODE: INIT.JS // In Init.js, in Project 1 var parent = require("Parent") var child = require("Child") function initializeGlobal() { var childObj = new child.ChildClass("Me", 3); } PARENT.JS // In Parent.js - In Project 1, but shared into Project 2 using Add Existing Item... class ParentApp { constructor(x) { this.name = x; } } module.exports = {ParentClass: ParentApp} CHILD.JS // In Child.js - in Project 2 - also shared into Project 1 var parent = require("Parent") class ChildApp extends parent.ParentClass { constructor(y, z) { super(y); this.age = z; } } function test() { var myChild = new ChildApp('Bill', 25); Log.Message(myChild.age); } module.exports = { ChildClass: ChildApp } So it's resolved now. Please try it and let me know if this works. Sorry for getting back this late - the response is a tad too long if you see. And yeah, I did not need the "import" keyword. Thanks for the help. And thanks to Tanya for following-up. Maybe I should accept my own answer as solution, I don't know. Re: Classes in Javascript How did you get the import to work? For me it just shows "Unexpected token import" syntax error in the importing script unit. Edit: OK, I see the code attached and it does not use "import" - it just uses require("...") followed by instance creation. So, not good for me. It seems we cannot use the "import" keyword. How 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 here https://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? SolvedRe: Line Numbers in Keyword Tests Yes this is certainly very simple but yet very useful feature, that's long awaited. Appreciate your work on this. Please do this at the earliest if possible in the update on the existing releases. This is related to user experience if you notice.