How to update node to a given version

Scenario:- Update node to the given version ?

Solution:- 

Using nvm:-Node Version Manager

Install nvm 

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
  1. Reopen the terminal
  2. Check nvm is installed by typing nvm > enter > it will show nvm commands
  3. nvm install Node_Version_i_Want
$ nvm install 8.9.4

Note:- After installing the latest node incase your build fails with error like

Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 8.x

Solution is simply run the sass build npm rebuild node-sass

Change layout of default signup form of MailChimp?

Problem:- Mailchimp is good for creating signup forms, but but..how i can change the layout of signup forms and make them look fancy?

The greatest mistake you can make in life is to be continually fearing you will make one.”Elbert Hubbard

Pr-requisites:-
1.Create account with mailchimp(as of now its free for 2000 subscribers)
2.Login with new account, create a list and create a signup form(we selected the default general form)

creating list in mailchimp
 create signup form in mailchimp
Our starting default form will look something like :-
Default form in mailchimp

But we want it to be like as below:-

designing fancy form using mailchimp

Solution:-
Step1:- Copy all the default code generated by mailchimp under “Embedded forms”
Embedded forms in mailchimp
Step2:-Replace the “form” tag code of your local fancy form with mailchimp form code
 signup code from mailchimp

Step3:- Copy the id attribute of input tags of mailchimp and add that to your fancy form, repeat the above steps for all the fields say firstname,lastname and email.

So easy isn’t it? thus we retained our fancy form but with the functionality of mailchimp.

Keep learning and Keep Sharing 

Learn more 
How to install wordpress using Bitnami

Practical issues and solutions for working with JMeter – Part2

jmeter issues

More Scenarios

Scenario:- 
How to display results from Beanshell sampler to response?

Solution :- 

Simple code example:- 

String display=”HelloWorld”;

//Taking results and displaying in response
SampleResult.setResponseData( display);

SampleResult.setDataType( org.apache.jmeter.samplers.SampleResult.TEXT );


Scenario:- 
Not able to understand the error message thrown by jmeter in beanshell sampler or beanshell assertions?

Solution :-  

Use try-catch

try{
int expectedMsgs = ${noOfMessages} * ${messageThreads};
int actualCount =Integer.parseInt(SampleResult.getResponseDataAsString());

//System.out.print(actualCount);
if (expectedMsgs!=actualCount) {
Failure = true;
FailureMessage ="Expected Messages Sent"+expectedMsgs+"!="+actualCount+"ActualMessages in cassandra";
print("Expected Messages Sent"+expectedMsgs+"!="+actualCount+"ActualMessages in cassandra");
}
}
catch(Exception e){
log.error("Failed check the erro"+e);
}



Scenario:- 
Connect to remote mySql instance (say ubuntu box) using JMeter?

Solution :- 
Before doing this we need to provide privileges to the remote user to access the database using 
1.SSH into remote machine
ssh username@ip address > enter password

2.Login to mysql using root user
mysql -u root -pPassword

login to mysql using terminal

3.Grant permission as below
GRANT ALL PRIVILEGES ON *.* TO remote@’10.0.110.***’ IDENTIFIED BY ‘pwd’ WITH GRANT OPTION;

4.Make sure to comment the following line in Mysql configuration file,
/etc/mysql/mysql.conf.d/mysqld.cnf 

comment bind-address = 127.0.0.1 using the # symbol

Mysql configuration file


5.Now we can replace the localhost, username and password in our connection settings for mysql.

Note:-
Incase you are getting the below error
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
Solution is run the command uninstall plugin validate_password;

Practical Examples

How to fix error and get back to https with ssl?


Our attitude toward life determines life’s attitude towards us…

Error:-

gem install error

 Solution:-
Step1:-
Temporarily remove secure connection:

gem sources -r https://rubygems.org/

gem sources

Step2:-
Add insecure connection


gem sources -a http://rubygems.org/

gem install for SSL error

Step3:-
Install compass gem

install compass successfully

Step4:-
After installing compass do vice versa:

a) gem sources -r http://rubygems.org/ – to remove insecure connection

b) gem sources -a https://rubygems.org/ – to add secure connection

Learn More share more 🙂



Understanding Test Strategy in Automation perspective?

What is Strategy?

It is a plan of action designed to achieve a long-term or overall aim with maximum utilization of available limited number of resources.

Automation Test Strategy
Which layer we should automate first?


Adding Test to Strategy?

Test strategy is the plan that describes how the test objectives would be met effectively with the help of the available resources.

Note:-Test strategy is the subset of the test plan.
Test Plan = Test Strategy(What,why,when,how) + Test Logistics(Who is testing)

Automation Test Strategy?

It is the approach that defines our kick starting and long term roadmap, to achieve the Automation of application.

Note: – Test automation strategy will differ as per organization, products, technology used, client and projects.


Components:-

Following is the list of basic building blocks of an Automation test strategy.
                Why automate?
                Why not to automate?
                What can be automated?
                What is technically unfeasible to automate?
                How long it takes to run the tests manually?
                What is the cost of automating the test?
                How easy are the test cases to automate?
                What are the priorities for automation?
                When to automate?
                How to automate?
Always strategize things in automation to plan and achieve small successes and evolve. It’s better to incur a small investment and see what the effort really takes before trying to automate the whole regression suite. This also gives those doing the work the opportunity to try things, make mistakes and design even better approaches. Remember 100% automation is not a test strategy; it is a similar to the Disney fairytales. A good test automation strategy must have measurable goals so we clearly understand what success feels like.

How to add HyperLink in Excel using UFT/QTP?

Scenario:-
How we can add “HyperLink” to a Excel Cell.
We used this thing while “Reporting” UFT results.Hyperlinks was used as pointer to screenshot of Results after the execution of Scripts.

Method 1

Logic:- We’ll use HyperLinks.Add method of Excel worksheet to create a Hyperlink.
Step1:- Activate the particular cell that we want as “Hyperlink”
Step2:- Add the Destination path and Text to be displayed to User in Excel

Code:-
For basics of Excel,Please refer the link.

'Variable Declaration
Dim objExcel
Dim objWB
Dim iRow : iRow = 1

'Function Call to Open Excel
fnOpenExcel
'Function Call to Create Hyperlink
fnWriteData "First Link","www.uftHelp.com"
fnWriteData "Second Link","www.Google.com"
fnSaveExcel

'Function to Open Excel
Function fnOpenExcel()

Set objExcel = CreateObject("Excel.Application")
Set objWB = objExcel.Workbooks.Add
objExcel.Visible = True
'objExcel.Application.Visible = True


End Function

'Function to Write data, with Hyperlink
Function fnWriteData(sData,sLink)

objExcel.Cells(iRow,1).Value = sData
'Selecting Cell, so that Hyperlink is created in this Cell
objExcel.Cells(iRow,2).Activate
objExcel.Worksheets(1).Hyperlinks.Add objExcel.Selection,sLink
iRow= iRow + 1

End Function

Function fnSaveExcel
objExcel.ActiveWorkbook.SaveAs "c:Template.xls"
End Function

**************************************************************************
**************************************************************************
Method2

Logic:- Sending the command to create, particular cell as HyperLink(Using the concept of Excel formulas)

Note:- Use the above methods to Open and Save Excel

'Variable Declaration
Dim objExcel
Dim objWB
Dim iRow : iRow = 1
'Function Call to Open Excel
fnOpenExcel
'Function Call to Create Hyperlink
fnWriteData "First Link","www.uftHelp.com"
fnWriteData "Second Link","www.Google.com"
fnSaveExcel
'Function to Write data, creating Hyperlink
Function fnWriteData1(sData,sLink)

objExcel.Cells(iRow,1).Value = sData
'Creating Hyperlink
objExcel.Cells(iRow,2).Value= "=HYPERLINK("&Chr(34)&sLink&Chr(34)&",""ClickHere"")"
iRow= iRow + 1

End Function

More Excel Example

Real meaning of Regular Expression’s(RG’s)



It is a way of representing data using symbols, which are in the form of special characters like ‘*’,’ +’, ’.’,  ’’.

 Further these characters are used for search of particular pattern in strings.

RG’s in UFT:

These are used in UFT to identify objects and text strings with varying values very useful in dynamic objects.

Usage: 

1. Defining Properties of an Object. (Object Repository)

2. Pattern matching in Check points.

3. Parameterize an object property or check point



Test:
We can test pattern match using “Regular Expression Evaluator”

Tools>Regular Expression Evaluator.

RG



Screenshot of window: RG evaluator


Using RG in UFT:

1. We can define a regular expression for a constant value, a Data Table parameter value, an Environment parameter value, or a property value in Descriptive programming.

2. We can define a regular expression in standard checkpoint to verify the property values of an object;we can set the expected value of an object’s property as a regular expression so that an object with a varying value can be verified.

3.We can define the text string as a regular expression, when creating a text checkpoint to check that a varying text string is displayed on our application,
4.For XML checkpoints we can set attribute or element values as regular expressions.

Types of RG’s:

i) Backslash Character:

 A backslash () can serve two purposes. It can be used in conjunction with a special character to indicate that the next character be treated as a literal character.

For example, UFT recognizes n as the special newline character. 

Alternatively, if the backslash () is used in conjunction with some characters that would otherwise be treated as literal characters, such as the letters n, t, w, or d, the combination indicates a special character. 

For example, w matches the character w
w is a special character that matches any word character including underscore.
Practical example:-
In the URL of a blog  http://uftautomation.blogspot.in/,
The period would be mistaken as an indication of a regular expression. To indicate that the

period is not part of a regular expression, you would enter it as follows:
uftautomation.blogspot .in

ii) Matching Any Single Character:

A period (.) tells UFT to search for any single character (except for n).
For example:

RG:Train.
Matches Trains, Trained, or Train followed by a space or any other single character.
 
iii) Matching Any Single Character in a List:

Square brackets [] instruct UFT to search for any single character within a list of characters.
 
For example:
To search for the Year 2013, 2019, or 2015,
RG: 201[359] 
iv) Matching Any Single Character Not in a List:

 When a caret (^) is the first character inside square brackets, it instructs UFT
to match

 any character in the list except for the ones specified in the string.
For example:
 
RG: [^13]
 
Matches any character except 1 or 3.
 
v) Matching Any Single Character within a Range:

 To match a single character within a range, we can use square brackets ([ ]) with the 

hyphen () character.
For example: For matching any number in the range 1000s,

RG: 100[0-9] 

Screenshot: We are looking for 3 digit number between (130 -149)
RG: [1][3-4][0-9]
RG example for Range


vi) Matching Zero or More Specific Characters:

 An asterisk (*) instructs UFT to match zero or more occurrences of the preceding 

character.

For example:
RG: ma*n 

Matches man, maaaaaan, and ma
vii) Matching One or More Specific Characters:

 A plus sign (+) instructs UFT to match one or more occurrences of the preceding 

character.
For example:
 
RG: ma+n
 
Matches man and maaaaaaan, but not mn.
 

viii) Matching Zero or One Specific Character:

A
 question mark (?) instructs UFT to match zero or one occurrences of the preceding 

character.
For example:
 
RG: ma?n
 
Matches man and ma , but nothing else.
 
ix) Grouping RG:

 Parentheses (()) instruct UFT to treat the contained sequence as a unit, just as in 

mathematics and programming languages. Using groups is especially useful for delimiting
 the argument(s) to an alternation operator ( | ) or a repetition operator ( * , + , ? , { } ).
x)  Matching One of Several RG’s:

 A
 vertical line (|) instructs UFT to match one of a choice of expressions.
xi)  Matching the Beginning of a input:

 A caret (^) instructs UFT to match the expression only at the start of a line, or after

 a newline character.

xii)  Matches the end of input:

A dollar sign ($) instructs UFT to match the expression only at the end of a line, or before a newline character.

xiii)  Matching Any Alphanumeric Character Including the Underscore:

 w instructs UFT to match any alphanumeric character and the underscore any combination

 of (A-Z, a-z, 0-9, _).
xiv)  Matching Any Non-Alphanumeric Character:

 W instructs UFT to match any character other than alphanumeric characters and 

underscores any combination other than (A-Z, a-z, 0-9, _).

Some other cardinal RG’s:
a) Matches a digit character : d, it is  Equivalent to [0-9].
b) Matches a non-digit character: D, it is Equivalent to [^0-9].
c) Matches a newline character: n
d) Matches a carriage return character: r
e) Matches a tab character: t