You are here

Test Automation

Testcomplete regular expression replace string working example

This little exampel is a demo of how to use regular expressions within a TestComplete Javascript.
In the string "str", is soem XML example. I desire to substitute the tag and value, with an "Ingored" tag.

function RegExReplaceDemo()
// The String
var str = "<SomeXMLNode>f44a944b-eab6-45af-91fa-5717f654</SomeXMLNode>";
// The regular expression for replacement identification
var re = /SomeXMLNode.*de/gi;
// The string replacing
str = str.replace(re, "/Ingnored");

What to automate when doing Test Automation?

Its hard to determine what is a “Best Practice” (And I do not believe in a general “Best Practice”) in this selecting automated testing candidates, since many aspects of software/hardware/Data/Conditions influencing the test,
However there are some general reasoning which could be applied when selecting candidates for automation.
There are generics, such as highly repetitive tasks that have low return or have standard results which make good candidates for automation. Other aspects of the environment are very much subjective, and it is clear to the business what areas would best to automate.

It might not possible to automate everything in the Software; Or.. It is definitely not feasible. But then again. It is not possible to test everything manually either.
Choosing what to automate and what not to is a cooperation between the test lead and the test automation developer.

a way of handling Undefined arguments in TestComplete with JavaScript

Sometimes it comes in handy to be able to have optional parameters in you test methods.
Take a look at this small piece of code.
At first glance, javascript has nothing like this available. However, javascript lets you call functions omitting some parameters, filling in the other parameters with the value undefined.