Forum Discussion

mkarlovich's avatar
mkarlovich
Occasional Contributor
12 years ago

Underscore.js library

I've added this library in TestComplete with only a few minor tweaks to have it working.   In general, I'm finding that adding third party libraries is often pretty easy, as long as the support for the regrettably ancient version of JScript being used by the engine. Anyone else using Underscore or other helpful libraries?

16 Replies

  • mkarlovich's avatar
    mkarlovich
    Occasional Contributor
    Phil are you bridging out using the CLR bridge for an http client?  If you don't mind sharing about your implementation I'm curious.



    As far as utility goes, Underscore is the most useful library to me.  It's almost canonical in the web development world and the subject of more than one book.  I would say it's not going away.  I completely disagree with the idea of using the built in objects over JavaScript ones.  JavaScript is what's not going away.  The code will work in any JavaScript engine whereas the TestComplete objects only work in TestComplete.  You can always find code on Stack Overflow or the like to do something in JavaScript.  

  • Hi Big Cat, no nothing that exotic, for an HTTP Client I just have a simple synchronous JScript wrapper round MSXML2.XMLHTTP, for our purposes this is fine for testing our OSB Web Services. I have to be careful as we have a few non technical testers and I need to make it as easy as possible for them to write automated tests.


     


    Saying that, it'd be pretty nice to write some sort of HTTP Client in .Net, then again, if I'm not careful I'd try and write everything in C#!


     


    My Primary uses of the CLR Bridge are:


    1. Accessing the WinSCP.dll class library to overcome Test Completes rather bizarre absence of FTP utils


    2. A Class library for creating and looking after background processed because I hate using Sys.OleObject("WScript.Shell");


    3. A bunch of helper functions, Test Complete doesn't expose the whole of .Net and there can be impedences mismatches at times so these overcome those sorts of things


     


    Phil

  • In  ver 9.31 I found that TC allows mixing different scripting languages used in script extensions and script units. I am not sure about all combinations but got success to call my  js function (packed into script extension) from VBS script unit.



    In ver 9.20 this feature did not work: calling js function from VBS unit caused error.



  • jose_pita's avatar
    jose_pita
    Super Contributor
    Hi Guys, 



    Finally decided to give a go to underscore.js but with no positive outcome.



    Added the sj file to TC but it says "no routines found" when I open it on the editor or try to use it on another script.



    Also as script extension, how can I add the file? don't know how to do it...
  • mkarlovich's avatar
    mkarlovich
    Occasional Contributor
    Phil that's an interesting way to get around the script unit exception limitation.   Thanks for sharing.
  • mkarlovich's avatar
    mkarlovich
    Occasional Contributor
    btw the method i posted above of creating a container for the instance works for many other libs as well.   if a js lib is made to be platform independent, just look thru the code and find out where the code is to add it to window, or whatever the fall back global is.  at this point you can have it fall back to a global var that you create to hold it.  if anyone knows a better way please share.