Showing posts with label KnowTech. Show all posts
Showing posts with label KnowTech. Show all posts

Thursday, July 16, 2015

Dynamics AX Performance Testing by using Coded UI tests

Recently we have completed Dynamics AX performance testing by using functional test automation scripts, which were developer by using Visual Studio - Coded UI. Dynamics AX thick client performance testing was time consuming using X++ code approach - Benchmark Toolkit. I'm into Test Automation for many years and had few challenges to implement functional test scripts as performance Testing. Used Microsoft Terminal servers to simulate multiple users RDP sessions. Prepared the list of factors, which are considered as helpful in this methodology.

Best practices for coding
  • Don't open the AX thick client for each iteration. For example, Sales Order creation should be executed for 15 times per user. Open AX thick client only once per user and then create 15 Sales order without re-starting AX client
  • Open AX client from windows path. Don't use shortcuts to open. Also keep the same path should be available in all terminal servers.
  • Methods to log Start Time and End Time for particular transaction
  • Don't use too much descriptive OR heavy programs to find the controls. Keep in mind that Testing tool also will consume CPU and memory
  • Don't keep control identifying calls within the time measuring statements. There is a major difference on purpose of functional script and performance script.
  • You can use UI Map (Object Repository) OR Page object model
  • Try to use short-cut keys. It would simplify your script as well as increase the execution speed
  • Introduce the loop within the test method. Don't call test method multiple times
  • Use data sources to provide different test data for each user. Try to read once and then use, whenever it required
  • Implement time logging only at essential code. Also consider that Automation tool would take few seconds to identify particular screen/UI object
  • Run with few users and validate once the script/ scenario is complete
  • Avoid left click navigation by entering module directily in address bar
  • Use Sleep between transactions, but do not include in transaction timings
  • Refine the steps, wherever possible
  • Follow naming conventions for transaction name, which should be simple and ease of use


Best practices for Performanc Testing related
  • Transaction timings can be logged as XML, TXT, DB records etc. I would prefer to keep in Database. SO that you can save the data multiple times and also use queries to collect different kind of metrics like Average Response time, 90th Percentile response time, Minium Response time, Maximum Response time etc.
  • Create couple of methods to log start and end timings for each transaction
  • Capture the script errors as well as AX exceptions
  • Update the information for
  • Implement test method to be executed for the given time using config file. For example, the scripts have to be executed 60/90/120 minutes
  • Implement user frequency. For exmple, if Sales Order should be created 15 times per user, then script should be stopped after creating 15 Sales order for each user
  • Capture screenshots if test is failed for any user. Keep the images in shared path. Also create less size image.
  • Modify the script, which is creating more transactions than expected
  • Validate each transaction time as whether only applicaiton time OR included Coded UI time as well
  • Keep data files in the shared path for ease of use and maintenance
  • Use Visual Studio Load test to collect performance counters from various servers like AOS servers, AX Batch servers, AX Integration servers, Terminal servers etc


Batch files to execute CodedUI Tests
Always create DLLs in Release mode instead of Debug mode. It will improve system's resource utilization.
echo on set logfile=C:\AX_PerformanceTest\ExecSmallSO.log echo "%date% - %time%- MediumSO started" cd\ cd "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow" vstest.console.exe "C:\AX_PerformanceTest\DLL\AX_PerformanceTest.dll" /Tests:CreateSmallSaleOrder pause


Sample Coded UI methods
Scenarios should be carefully implemented as it is for performance testing.
public void clickSellTab() { axAppWindow.SetFocus(); myutils.ClickButton(axAppWindow, "SellTab"); } public void ClickBookMenu(ref Logger.Logger LogObj) { try { axAppWindow.SetFocus(); WinMenuItem item = new WinMenuItem(axAppWindow); item.SearchProperties[WinMenuItem.PropertyNames.Name] = "Book"; UITestControlCollection ab = item.FindMatchingControls(); LogObj.TransactionStart("BookingOrder"); Mouse.Click(item); Thread.Sleep(1000); this.clickSellTab(); // axAppWindow.WaitForControlEnabled(50000); axAppWindow.SetFocus(); item.WaitForControlReady(50000); LogObj.TransactionEnd("BookingOrder"); } catch (Exception ex) { LogObj.LogException(LogObj.ScenarioName, ex.ToString()); } }


Few links related to Coded UI Tests


Wednesday, July 2, 2014

Unable to run javascript in internet explorer 11

Recently I was facing a peculiar issue. Unable to open the links, which are calling javascript functions directly. Those sites are working well on only internet explorer. I was changing Document mode and User Agent String.

Then I did uncheck the Popup Blocker and [CTRL + ALT + Click] combination. Not successful.
I was trying another option --> Tools > Compatibility View Settings > Check 'Display intranet sites in compatibility view'. Got success... Links were executing the required javascript functions.


Unable to open javascript links in ie 11
Internet Explorer 11’s Many User-Agent Strings

Tuesday, May 27, 2014

Share photos from XBOX play

Kinect Sports, Kinect Adventures, and Kinect JoyRide Games have functionality to upload pictures taken during game play. The pictures load to KinectShare.com. In the games there is a Remember and Share style section, where you can look at the pictures that were taken. From there you can select which items you would like to upload.

The pictures on KinectShare are only accessible from your Microsoft (Hotmail/Live/Outlook) login and are only stored for 14 days. They can be shared to Facebook or other social network site from there. They can also be removed from KinectShare.com (such as, as soon as you get the Achievement....)


Change your privacy settings to allow Kinect Sharing

  1. On your console, sign in using your Xbox LIVE gamertag.
  2. Go to Settings, then select Privacy
  3. Select Change Settings
  4. Select Customize
  5. Select Kinect Sharing.
  6. Select Allowed or Blocked. Allowed: You can upload and share photos and videos using websites and services such as KinectShare.com, Blocked: Photos and videos cannot be uploaded and shared on photo-sharing websites and services.
  7. Press B on your controller
  8. Select Save and Exit.


Steps to Upload photos

  1. Enable Internet connection through Wi-fi in XBOX Console
  2. Get the Pictures from games
  3. Go to the photos menu and choose which photos/statues you want to upload
  4. Uploaded to www.kinectshare.co
  5. Go to kinectshare.com, Login and you can see your photos
  6. You can download the pictures and share it


Sunday, December 1, 2013

Code Coverage in Testing

Primarily code coverage is used for unit testing and many test teams are practicising code coverage for test execution. Visual Studio team have been doing many improvements on code coverage area. Code coverage is available for Unit tests in prior version. In Visual Studio 2012 Update 3, Code coverage can be measured for manual and automated tests. Also there are few integrations with MTM (Microsoft Test Manager) tool.

Advantages of Code Coverage on Testing
  • Increase the confidence level on Quality
  • Measure the code coverage through tests
  • Help to improve testing to cover un-touched code
  • Additional test cases to increase code coverage


Limitations of Code Coverage on Testing
  • Unable to find incomplete or dead code
  • Not a proof whether code is written against specifications

You need to add your application DLLs into codecoverage.config file which is available at "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Dynamic Code Coverage Tools". Then use following commands in Administrator mode to get the coverage data. After stopping the code coverage, you can open the coverage results file in Visual Studio and expand the DLLs to method level.

Useful Commands
 
Path==> C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Dynamic Code Coverage Tools Command to run codecoverage tool ==> CodeCoverage.exe collect /IIS /session:WebSession /output:MyApp_20131009.coverage Command to stop codecoverage tool ==> CodeCoverage.exe shutdown /session:WebSession
Different attributes and options are available in code coverage tool. YOu can check your environment. CodeCoverage Help command
 
Usage: CodeCoverage Available Commands: Collect coverage data to the given coverage file. Usage: collect [options] [command line] Options: /config: [optional] Override default configuration with configuration file specified. /IIS [optional] Collect code coverage for web applications running under Internet Information Service (IIS). IIS Worker process (w3wp.exe) will be registered for collection and all the application pools will be restarted. /output: [required] The file to output coverage data to. /session: [optional] The name for the session. If a session name is not provided, a unique session name will be used /verbose [optional] Turn on printing of diagnostic information during runtime. Example: CodeCoverage collect /IIS /session:WebSession /output:MyWebApp.coverage Shut down a logger with a given session name. Usage: shutdown [options] Options: /session: [required] The name of the session to shut down Example: CodeCoverage shutdown /session:WebSession Analyze data from one or more coverage files and output XML. Usage: analyze [options] [file2 [...]] Options: /include_skipped_functions [optional] Includes skipped functions in the results. /include_skipped_modules [optional] Includes skipped modules in the results /output: [optional] The file to output the analyzed coverage data to The default is to use standard output /test: [optional] The test identifier string to limit the coverage data to. This option can be specified multiple times to merge coverage data for different tests together Example: CodeCoverage analyze /include_skipped_functions /include_skipped_modules /output:results.xml MyWebApp.coverage

Sunday, December 2, 2012

Email founder roots to Muhavur(India)

I was so excited and proud to share this post. Mr. V.A. Shiva Ayyadurai, who is Email founder, has roots to Muhavur, Rajaplayam (India), which is my native place. His father has given many donations to our schools.

V.A. Shiva Ayyadurai WWW Home
SiliconIndia News
Tamil News

I came to know about this yesterday. How did I miss, even though I'm in this industry more than 10 years? How do the media and country promote the inventions and achievements? How the corporate companies/business involving in today's inventions & hype?

Still I'm wondering, what happened to Mr.Ramar Pillai. Not sure about his invention, but he brought few thoughs about so called 'Bio-Fuel' or 'Herbal Fuel'. I am not sure, how the government agencies are serious about alternative fuel? Also difficult to find honest reporing in media like Newspapers, TV Channels, etc...

Friday, November 30, 2012

Vishing - Security Attack?

I got a mail from my bank in last month about 'Vishing'.It looks like old trick for new technologies.

Definition
"Vishing" is an activity where fraudsters trick unsuspecting customers into providing their personal and financial details over the phone.

Usual Methods
Usually fraudsters pose as representatives of large companies, banks or public authorities like Reserve Bank of India.
The details may be used to carry out fraudulent transactions in the customer's account.

Note:
Do not reveal your confidential banking details like account/card number, PIN, validity date of your debit/credit cards, CVV, or other passwords to anyone.

Sunday, August 5, 2012

Windows 8 Release

Microsoft has released Windows 8 OS. It has many features and new UI style. Check following links for more details..
Windows Team blog
Windows 8 on Wikipedia

Monday, January 30, 2012

Performance Testing Guidance from Microsoft

I always admire Microsoft for its documentation. Right from OS to Office applications, you can find good documentation. Microsoft has shared very good articles for performance testing and tuning.

You can find more articles related to Performance testing available from
Patterns & Practices: Performance Testing Guidance
. Just listed only How-TOs part. Thanks to Microsoft!!!

Performance Testing


Capacity

Load Testing

Stress Testing

Test Cases/Scripting

Troubleshooting

Tuning

Workload Modeling

Hope all these links would be useful..

Sunday, October 2, 2011

FOR loops & IF condition in RobotFramework

Using Robot Framework, test engineer can create FOR loops and IF conditions. I don't think so, any other Keyword driven framework is giving this kind of flexibility.

FOR loop can be set in two ways. First one is based on number of items in a List. Another one is based on range like from 1 to 50. Similarly keywords can be executed if condition matches or not. See below example.

FOR Loop & IF condition explantation using Robot Framework

TestCase Action Arguments
VerifyListItems [Arguments] ${Locator} @{ListItems}
[Documentation] Verifies the list of items present in a List Object.
: FOR ${Element} IN @{ListItems}
Select From List ${Locator} ${Element}
List Selection Should Be ${Locator} ${Element}
: FOR ${index} IN RANGE 50
${obj1}= Evaluate ${index}*4+3
Run Keyword if '@{tDriverData}[4]'=='2' Go To MyProfile
Run Keyword Unless '@{tDriverData}[4]'=='2' Go To UserCreation

Tuesday, April 26, 2011

What is OWASP

Four years back, I was looking help for security testing and I found OWASP with many presentations, books and testing guides. It helps me lot for my deliverables. OWASP's top 10 is a popular one and reflects the current trend.

OWASP by the numbers (Last year report)

  • 420,000 page views per month
  • 6,381 Articles
  • 15,000 downloads per month
  • 21,000 members on mailing lists
  • 2,600 wiki users
  • 1,500 wiki updates per month
  • 160 chapters worldwide
  • 75 individual memberships
  • 118 tool and documentation projects
  • 17 Books
  • 43 corporate/educational memberships
  • 7 Board members (Jeff, Tom, Dave, Seb. Dinis, Matt, Eoin)
  • 39 Committee Volunteers
  • 3 Employees (Paulo, Kate, Alison)
  • 25 projects funded

OWASP - Open Web Application Security Project
OWASP is a community of people passionate about application security. It is a non-profit(501c3 not-for-profit worldwide charitable organization), volunteer driven organization. All members are volunteers and all work is donated by sponsors. They all share a vision of a world where you can confidently trust the software you use. Unfortunately, the current software market doesn’t encourage security – that’s something they are trying to change. One of primary missions is to make application security visible so that people can make informed decisions about risk.

You can find lots of free and open source tools, documents, basic information, guidelines, presentations, video, and blogs at OWASP to help you get started.

  • Worldwide free and open community
  • Focused on improving the security of Web applications
  • Promotes secure software development
  • An open forum for discussion
  • Publications, Articles, Standards
  • Testing and Training Software
  • Local Chapters and Mailing Lists
  • Software libraries and tools

OWASP Software - WebGoat - Training application
WebGoat Project
  • Cross Site Scripting
  • SQL Injection Attacks
  • Thread Safety
  • Field & Parameter Manipulation
  • Session Hijacking and Management
  • Weak Authentication Mechanisms
  • Many more attacks added

OWASP Software - WebScarab - framework for analyzing HTTP/HTTPS traffic
WebScarab Project
  • Fragment Analysis – extract scripts and html as presented to the browser, instead of source code presented by the browser post render
  • Proxy – observe traffic between the browser and server, includes the ability to modify data in transit, expose hidden fields, and perform bandwidth manipulation
  • BeanShell – the ability to execute Java code on requests and responses before being transmitted between the browser and server; allows runtime extension of WebScarab
  • Spider – identifies new URLs within each page viewed
  • SessionID Analysis – Collection and analysis of cookies to determine predictability of session tokens

My Previous posts on Security
Security Attacks - OWASP Top 10
Security Testing - Webscarab tool
Security Testing - CSS or XSS

Tuesday, August 17, 2010

Silktest 2010

Microfocus released silktest 2010 last month. It has few additional features and enhancements. First time, release notes are published in PDF format. SilkTest_ReleaseNotes - pdf

Silktest 2010 Features

  1. Visual Tests- SilkTest Workbench lets you quickly record and playback visual tests. Visual tests comprise the basic building
    blocks of an automated testing solution. SilkTest Workbench uses visual tests to mimic the actions that are
    performed while testing an application.
  2. Embedded Scripting Language - SilkTest Workbench's scripting language is Microsoft's Visual Basic, a robust programming language that gives
    you total control over any application running in the Microsoft .NET framework. .NET scripts contain the functionality of a high-level programming language as well as features designed specifically for software control and testing.
  3. Integration with Additional Micro Focus Products- The SilkTest product suite includes two plugins, Silk4NET and Silk4J, which both work with SilkTest Recorder. Additionally, SilkTest Workbench works with SilkCentral Test Manager (SCTM).

I was expecting Silverlight Support in this release. I know that Mirofocus were working for Silverlight support. Microfocus may release the Silverlight support in next version.

Silk4J - Java as scripting language, introduced in Silktest 2008.
Silk4NET - C# or VB.NET as scripting language, introduced in Silktest 2010

End-Of-Life (EOL) Components
Also it has announced End of support for few OS and other features. The following operating systems, features, and integrations are not supported in SilkTest 2010.
  1. SilkTest Classic 4Test outline Editor mode Note: SilkTest Classic will continue to be supported. This change will not affect most SilkTest Classic users.
  2. Windows XP SP2
  3. Windows 2003 Server
  4. Java 1.4
  5. StarTeam integration
  6. PVCS integration

Friday, July 30, 2010

Visual Studio 2010 - Testing Features

I attended a presentation Visual Studio 2010 - Testing Features. Microsoft Visual Studio 2010 has different set of licenses. Apart from development features, VS2010 can be used for project management, testcase managment, UI automation, unit testing, defect tracking and Load testing.

Microsoft targets testing tools market. As of now, it is supporting microsoft technologies. I am sure that Microsoft would have reasonable share in testing tools market within next three years. Definitely it would be tough competitor for QuickTest Professional in near future. Tool has to be enhanced for object storage and simple scripting.

Few links for your reference:
VS 2010 Testing Capabilities (Videos)
Getting started with VS 2010 Defining Your Testing Effort Using Test Plans
Creating Manual Test Cases Recording and Playing Back Manual Tests
Testing the User Interface with Automated UI Tests (CodedUI Test)
Supported Configurations and Platforms for Coded UI Tests and Action Recordings
How to: Create a Coded UI Test (Documentation):
How to: Create a Coded UI Test Tutorial
Administering Team Foundation
Administration Guide for Microsoft Visual Studio Team System 2010 Team Foundation Server
Update on Silverlight support
Partial Silverlight support

Saturday, January 2, 2010

Strange Internet connection Problem

Recently I saw a strange problem in a laptop, which has Vista OS. I have broadband connection. Router was showing as internet connection successful. But none of the web pages were not loaded. I checked all the internet connection settings. All are correct. I checked in Safari, Internet Explorer and Firefox.

I tried with a startup mode SafeMode with Networking . To know more about these startup modes, see my post Strange behavior with Service Pack. In SafeMode with Networking, I was able to do internet browsing. Then I realized the problem might be due to setting changes or some configuration would have changed.

Solution

  1. Open a command prompt (cmd.exe) with 'Run as administrator' privilege
  2. Type Ipconfig /flushdns and press ENTER key
  3. Type Netsh int ip reset and press ENTER key
  4. Reboot (Re-start) the system
  5. Again Open a command prompt (cmd.exe) with 'Run as administrator' privilege
  6. Type Netsh winsock reset and press ENTER key
  7. Reboot (Re-start) the system again.

After doing above things, I were able to do net surfing. I hope that, Vista is removing the settings or resetting the configuration, if any of devices or drivers went wrong. Microsoft Knowledge-base article has different solution. That solution is You receive an error message in Internet Explorer: "Internet Explorer cannot display the webpage" .

Removing Malware
Elphantboycomputers has prepared wonderful article to Remove Malware. See the section Recap of what you will need to have on-hand before you start the cleanup process

1. To repair or reset Winsock in Vista/Win7
a. Start>Run>cmd [enter]
b. netsh winsock reset catalog [enter]
c. Reboot the system.
2. Sysclean or Multi-AV
3. Full-featured antivirus with updates downloaded separately for manual update
4. MBAM
5. SuperAntiSpyware
6. HijackThis
7. Possibly Process Explorer and Killbox.

Sunday, September 20, 2009

Is KeyWord Driven Framework enough?

Recently I heard the term Key-Word Driven Framework from many testing people. Even people are showing interest to know about it and to implement it. Sometimes people are saying unknowingly as Keyboard Driven Framework.

Few months back, I have implemented Keyword Driven framework in one of our projects. We are using Silktest and data files are kept in XML format. The other automation team members also impressed with this kind of implementation. I found this article Automated Testing Institute - Building A Keyword Driver Script In 4 Steps useful to the professionals, who wants to implement KeyWord Driven framework.

After that the expectation goes to implement KeyWord Driven Framework to all automation projects. I am not against to Keyword Driven Framework. It can be used for many projects. But it is not the only one solution for all our automation issues or dependencies. For example, chart automation. For charts, verification will be different and It is difficult to generalize. May be Flex charts can be used if tools are able to identify all parts of charts. One more is unlimited Keywords. Assume that one project contains more than 500 keywords and the automation guys should know the functionality for all those words. It is definitely issue, if number of keywords increased beyond the limit. Currently I'm thinking the scenarios, where KeyWord or Table Driven Automation frameworks can not be used or should be avoided. Below I have listed the cases.

  1. More Context based Menus
    The menu items are shown based on the screen and object.

  2. Multiple Application interactions in single project

  3. Total Keywords beyond 200
    Testers should memorize all keywords. It is similar to remember Differential Calculus and Integral Calculus functions. One should remember keywords for action and verification for all set of objects.

  4. Many hierarchies for Object identification.
    It can be solved if testing tool supports X-path for object identification.

  5. Complex data.
    One of my projects required minimum 40 string data to create a report and it is just a first step for any test case. Also the data may change in the future. More than 1000 cases required like that. I can generalize the inputs data and it is difficult to maintain and modify the data.


To know the automation framework concepts, you can go through following links.

Test Automation White Papers
My Thoughts about Automation
What is an Automation Framework - from Dhanasekar's blog
Wikipedia - Test Automation
Wikipedia - KeyWord Driven Testing

Tuesday, September 15, 2009

Java and myself

In my first job, I have used VB and Java. At that time, I was new to Internet. I used to develop programs in VB6 and Java2 around Internet programming. I wrote java programs using notepad and Emacs editors. After that many years I ran behind GUI automation tools such as VisualTest, WinRunner, QTP and Silktest. Sometimes I'm using VBScript for few testing tasks.

Recently many tools are supported to use Java as test language. Again I'm going to re-look at java. I was looking into my old java code. I tried to compile few java programs with recent Java version 1.6.0.14. Few classes are deprecated. I have used this command javac ZDownloadURL.java -Xlint:deprecation to compile java program.

In Sun Developer network, one tutorial was there for Basic Java. Link :Essentials of the Java Programming Language

Below program can be used to download any web page. I tried my blog and it still works.
To Compile - javac ZDownloadURL.java -Xlint:deprecation
To run the program - java ZDownloadURL



// $Id$

/**
*
*
* Created: Tue Oct 24 18:51:26 2000
*
* @author palani selvam
* @version $Revision$
*/

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.io.*;


/* To Run this file, put command as
java -Dhttp.proxyHost=192.168.27.2 -Dhttp.proxyPort=3128 ZDownloadURL
*/


public class ZDownloadURL extends JFrame implements WindowListener,ActionListener {
String URL; //Given URL
// String inputLine; //To read Line by line
String title="Downloading Trial"; //To give title of the URl

static JFrame frame; //Parent Level Container
JButton save; //Save Button
JButton down; //Declare Download Button
JButton exit; //exit Button
JTextField url; //To enter URl
JTextArea contents; //Contents of specific file
//JPanel panel; //Second level Container
Container panel;
//JPanel temp;
Container temp;


public ZDownloadURL() {
//frame=new JFrame();
super.setTitle(title);
super.setForeground(Color.blue);
super.setBackground(Color.yellow);

panel=getContentPane();
temp=new JPanel();
temp.setLayout(new BorderLayout());
temp.setSize(10,20);

GridBagLayout grid=new GridBagLayout(); //Set GridBagLayout
GridBagConstraints c=new GridBagConstraints();
c.fill=GridBagConstraints.HORIZONTAL;

panel.setLayout(grid);
// grid.setConstraints(c); //Add GridbagConstraints

url=new JTextField(20);
contents=new JTextArea(30,30);
contents.setLineWrap(true); //To Wrap lines in TextArea

/***
* To create ScrollBars to JTextArea
*
*/

JScrollPane pane = new JScrollPane(contents);
temp.add(pane);



/***
contents.setColumns(20);
contents.setRows(10);
contents.setLineWrap(true);
contents.setWrapStyleWord(true);
contents.setSize(10,20);

temp.add(contents);
**/



down=new JButton("DownLoad");
save=new JButton("Save");
exit=new JButton("Exit");
JLabel label=new JLabel("Enter valid URL");

c.gridx=0;
c.gridy=0;
c.insets=new Insets(5,0,0,0);
grid.setConstraints(label,c);
panel.add(label);

c.gridx=1;
c.gridy=0;
c.gridwidth=1;
//c.gridheight=2;
c.insets=new Insets(5,0,0,0);
grid.setConstraints(url,c);
panel.add(url);

c.gridx=2;
c.gridy=0;
c.insets=new Insets(5,0,0,0);
grid.setConstraints(down,c);
panel.add(down);

c.gridx=0;
c.gridy=1;
c.gridwidth=20;
c.gridheight=10;
c.insets=new Insets( 20,0,0,0);
grid.setConstraints(temp,c);
panel.add(temp);


c.gridx=0;
c.gridy=12;
c.gridwidth=1;
c.insets=new Insets(10,0,0,0);
grid.setConstraints(save,c);
panel.add(save);

c.gridx=1;
c.gridy=12;
c.gridwidth=1;
c.insets=new Insets(10,0,0,0);
grid.setConstraints(exit,c);
panel.add(exit);

exit.addActionListener(this);
save.addActionListener(this);
down.addActionListener(this);
// frame.addActionListener(this);

// frame.add(panel);


}


public void windowActivated(WindowEvent we) {

}

public void windowDeactivated(WindowEvent we) {

}

public void windowIconified(WindowEvent we) {

}

public void windowDeiconified(WindowEvent we) {

}

public void windowOpened(WindowEvent we) {

}

public void windowClosed(WindowEvent we) {

}

public void windowClosing(WindowEvent we) {

System.exit(10);

}


/***
* pass the URL as string
*/


public void Download(String _url) {
try {
URL myURL=new URL(_url);
BufferedReader in=new BufferedReader(new InputStreamReader(myURL.openStream()));

String inputLine;
contents.setText("");

while((inputLine=in.readLine()) != null) {
//contents.setText(contents.getText()+"\n"+inputLine);
contents.append("\n"+inputLine);

}
} catch(Exception ex) {

System.out.println(ex.toString());
}

}

public boolean checkURL(String _url) {
if((_url.indexOf("http"))!=0) {
return true;
}
else {
return false;
}
}


public void actionPerformed(ActionEvent ae) {
//String action=ae.getActionCommand();

URL=url.getText();
Object action=ae.getSource();

//To Download

if(action.equals(down)) {
/** if(checkURL(URL)) {
Download(URL);
}
else
JOptionPane.showMessageDialog(new JFrame(),"Enter Valid URL in TextField!","Information",JOptionPane.INFORMATION_MESSAGE);

**/

Download(URL);


}


//To save that URL's contents
//Not implemented

if(action.equals(save)) {
JFileChooser fc=new JFileChooser();
int returnVal=fc.showSaveDialog(new JFrame());

if(returnVal==JFileChooser.APPROVE_OPTION) {
File file=fc.getSelectedFile();
super.setTitle(file.getName());
}
}

if(action.equals(exit)) {
System.exit(0);
}

}

public static void main(String args[]) {
frame=new ZDownloadURL();

frame.setSize(500,400);
frame.pack();
frame.show();

}

} // ZDownloadURL

/*
* $Log$
*/

Sunday, August 2, 2009

Selenium Overview

Selenium is a suite of tools to automate web app testing across many platforms. It is a GUI based automation tool. Initially it is built by ThoughtWorks. It supports various browsers on various platforms.

Selenium Home Page
Selenium Projects
Tool History
Platform Support

Selenium Projects
Selenium has many projects. Following projects are mostly used by testers.


  1. Selenium IDE (IDE)
    Selenium IDE can be used only in FireFox. It is an add-on for FireFox. User can record the actions and can edit and debug the tests. It can be used to identify IDs, name and XPath of objects. Only one test at a time.

  2. Selenium Core (CORE)
    Selenium Core is the original Javascript-based testing system. This technique should work with any JavaScript enabled browser. It is the engine of both, Selenium IDE and Selenium RC (driven mode), but it also can be deployed on the desired application server. It is used specifically for the acceptance testing.
    User can record the tests using Selenium IDE and can use the same tests to run in other browsers with minimal modifications. It provides support to run the tests in HTA (HTML Applications) Mode. This mode works only in IE.

  3. Selenium Remote Control (RC)
    Selenium Remote Control is a test tool that allows user to write automated web application UI tests in few programming languages against any HTTP website using any mainstream JavaScript-enabled browser. User can write the tests (More expressive programming language than the Selenese HTML table format) in Java, DotNet, Perl, Ruby and PHP. Also it supports few testing frameworks.

  4. Selenium Grid
    Selenium Grid allows easily to run multiple tests in parallel, on multiple machines, in an
    heterogeneous environment by cutting down the time required for test execution. Using this, user can run multiple instances of Selenium Remote Control in parallel.

Supported browsers
Selenium tools can run in following browsers.
  • Internet Explorer
  • FireFox
  • Opera
  • Safari
  • Seamonkey

Supported Operating Systems
Users can execute the selenium tests in following OS.
  • Windows
  • Linux
  • Solaris
  • OS X

Supported Programming languages
Below languages are supported by Selenium RC.
  • C# (DotNet)
  • Java
  • Perl
  • Ruby
  • Python
  • PHP

Lot of presentations and documents about Selenium are shared in SlideShare. You can do simple search and get many docs.

Recorded Selenese code through IDE
 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>GoogleSearch2</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">GoogleSearch2</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>q</td>
<td>silk4j tutorial</td>
</tr>
<tr>
<td>click</td>
<td>btnG</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td>30000</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>q</td>
<td>Silktest extension kit</td>
</tr>
<tr>
<td>click</td>
<td>btnG</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td>30000</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>btnG</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td>30000</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>

Java code - Selenium RC
 

package com.example.tests;

import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;

public class NewTest extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://www.google.com/", "*chrome");
}
public void testNew() throws Exception {
selenium.open("/");
selenium.type("q", "silk4j tutorial");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
selenium.type("q", "Silktest extension kit");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
System.out.println("New Test is completed.");
}
public void tearDown() {
browser.stop();
}
}

Thursday, April 30, 2009

Flex component automation with Silktest

Overview about Flex
Adobe Flex is a collection of technologies released by Adobe Systems for the development and deployment of cross-platform rich Internet applications based on the proprietary Adobe Flash platform. MXML, an XML-based markup language, offers a way to build and lay out graphic user interfaces. Interactivity is achieved through the use of ActionScript, the core language of Flash Player that is based on the ECMAScript standard.

The Flex SDK comes with a set of user interface components including buttons, list boxes, trees, data grids, several text controls, and various layout containers. Charts and graphs are available as an add-on. Other features like web services, drag and drop, modal dialogs, animation effects, application states, form validation, and other interactions round out the application framework.

For more info, visit Flex Wiki page Wiki - Adobe Flex

Help from Vendors
Adobe has developed few libraries to support test automation for flex components. To know more about these libraries, you can go through following links.


Borland has given a separate document for flex configuration. You can search in Borland site for ‘QuickTour_Flex.pdf’. Similarly Adobe has published a document ‘Flex2_at_api.pdf’ for Testing Flex Components.

Even Silktest Help documentation contains few pages for Flex and Open Agent. You can check following Silktest Help pages:
  • Testing a Flex Sample Application Using a Dual Agent Approach
  • Enabling Extensions Automatically Using the Basic Workflow
  • Enabling Extensions for Embedded Browser Applications that use the Classic Agent
  • Configuring Security Settings for Your Local Flash Player


Silktest Flex API
As a first step, we need to copy Silktest flex library before building Flex components.
  1. Navigate to Windows Explorer -> Silktest_Installed_Directory\ng\AutomationSDK\Flex\3.0\Automation
  2. Copy FlexTechDomain.swc
  3. Paste into C:\Program Files\Adobe\Flex Builder 3\sdks\3.1.0\frameworks\libs
  4. In this libs folder, you can see few more files such as automation.swc, automation_agent.swc & automation_dmv.swc
Change in Flex XML configuration
To change flex-config.xml
  1. Navigate to Windows Explorer -> C:\Program Files\Adobe\Flex Builder 3\sdks\3.1.0\frameworks
  2. Open flex-config.xml and set the following:
    <include-libraries>
    <library>/libs/automation.swc</library>
    <library>/libs/automation_agent.swc</library>
    <library>/libs/FlexTechDomain.swc</library>
    <library>/libs/automation_dmv.swc</library>
    </include-libraries>NOTE: Remove the comments for include-libraries tag.

Flex Compiler Settings
  1. Open the project.
  2. Project Menu-> Properties.
  3. Select Flex Compiler.
  4. In additional compiler constants, set the following:
    -include-libraries "${flexlib}/libs/automation.swc" "${flexlib}/libs/automation_agent.swc" "${flexlib}/libs/FlexTechDomain.swc"

Browser Setting

To set security settings for Flash Player:
  1. Navigate to FlashPlayer Setting
  2. In Global Security Settings, select radio button 'Always Allow'.
  3. From the Edit Locations drop-down menu, click Add Location.
  4. Click Browse for folder and navigate to the folder where your local application is installed.
  5. Click Confirm and then close the browser.


To Enable JavaScript:
  1. In Internet Explorer 6.0 and 7.0, Choose Tools/Internet Options.
  2. Click the Security tab.
  3. Click Custom level.
  4. In the Scripting section, under Active Scripting, click Enable and click OK.

Settings in Silktest
  1. It is important to start the Open Agent before starting your flex application.
  2. Enable extensions for flex
  3. Check your include files (From Options menu-> Runtime). Flex.inc and flexDataTypes.inc files should be included in the UseFiles. I have given a sample UseFiles value of a simple project below:
    D:\Flex\MyFlex1\frame.inc,extend\explorer.inc,extend\xBrowser\xbrowser.inc,extend\Flex\Flex.inc,extend\Flex\FlexDataTypes.inc,extend\WIN32\WIN32.inc

Sunday, November 2, 2008

Windows XP - System failure

Last month, My home PC did not boot at all. I searched the solutions on Internet and tried many things. Even Microsoft's knowledge base articles were not solved my problem.

Problem 1: winlogon.exe - Application Error
Initially I got the WinLogon.exe error dialog box and then it was restarted automatically again and again. The dialog box message was like below:
-----------------------------------------
winlogon.exe - Application Error
------------------------------------------
The instructions at "0x759723ee" referenced memory
at "0x00000000". The memory could not be "read".

Click on OK to terminate the program
Click on CANCEL to debug the program
-------------------------------------------

System was restarted, if I click OK butto or Cancel Button. Then I restarted the system by all startup modes. I have explained all these modes in my previous post - Strange behavior with Service Pack . None of the modes helped me. I got blue screen, while I was trying by startup mode - Disable Automatic restart on system failure. I searched on net and applied many solutions. None of them worked out...

Solution 1
From softwaretipsandtricks.com

  1. Boot with winxp cd
  2. Log in to recovery console
  3. chkdsk /r


Solution 2
This is a problem with virtual RAM, I've had it before with various steam games, try lowering the size of the paging file (I'm pretty sure you can do that from the recovery console) or deleting it completely just so you can log on, then set the paging file back up again, with a lower size. This problem also arises if you have page files on more than one hard disk, its better to have 1 3GB page than 2 1.5GB ones on separate hard disks.

Solution 3
It's simple, just download hijack.exe and killbox.exe. Run Hijack. Look for these types of process in the hijack log:
O20 - Winlogon Notify: arergiti - arergiti.dll
O20 - Winlogon Notify: bdicjulx - bdicjulx.dll (this is only an example, it will not be the same dll files in your case, just put the types of these trojans for your understanding) kill all these dll files comes under the heading "Winlogon notify" using killbox (use the option 'delete on reboot')..and it is simple as that...nothing to worry..Just check for Winlogon nofify errors and delete all these dlls which fall under this category (i.e. "winlogon notify")

Solution 4
mbrando.com
We’ve had 15-20 machines suddenly start doing this in the last month. I’ve narrowed it down to an issue with the RPC and DCOM services; by default they are both set to “Restart the computer” if they can’t start.
We’re still working with Microsoft to determine why this suddenly started, but we have at least figured out that after several reboots and if you let it sit at the logon screen for a while before attempting to logon, you can sometimes get it to boot all the way into Explorer. If you get that lucky, go into your services and set the recovery options for both services to “Restart the service” instead of “Restart the computer”.

Solution 5
I had the same issue and I was able to hit CTRL+ALT+DEL before the error message popped up and then login and do a system restore. Not sure if that will work for anybody else, but just thought I’d throw this out there (problem happened after the Monday update from MS Update).

Solution 6
I was getting the same error message. But used the click here underlined for details. Stated the problem was with the uxtheme.dll file. So from msconfig, I uncheck the theme services. Rebooted with no errors. Realized that it turned off my XP Theme. So went into Services from Admin Tools, and set disable to automatic and click the Start button, to start the service. Then rebooted. Have not received the error since.

UXTheme is the XP Theme package, but was recently updated in a patch. So maybe chalk it up as a bad install. Now repaired.

Another option is to go to c:\windows\system32 and find the uxtheme.dll file. Rename it to uxtheme.dll.old. Then restart. Should repair, reinstall itself.

Problem 2: Stop 0x000000B4 The Video Driver Failed to Initialize
After doing Chkdsk command, I was getting the blue screen. After this stage, I didn't get Winlogon.exe - Application Error. I did Google search for this system error and I got few solutions for that.

Solution 7
From forums.techguy.org
It may be the built in VGA driver is corrupt. You could try replacing it in Recovery Console from the CD. I've attached a screen shot of the commands.

To do this boot into the Recovery Console. This should leave you at a C:\Windows prompt. Enter the following commands:

cd system32
ren vga.dll vga.dllold
ren vga.drv vga.drvold
cd drivers
ren vga.sys vga.sysold
expand d:\i386\vga.sy_
cd ..
expand d:\i386\vga.dl_
expand d:\i386\vga.dr_


Exit, and then try Safe Mode and/or Enable VGA Mode.

Solution 8
From forums.cnet.com
To anyone with this same problem - here's how I recovered my files:

Changed my Bios to boot from Windows XP DVD-ROM.
Installed XP to the SAME PARTITION as my corrupt one, only I created a new folder entitled XP_2.
It did get stuck once on the "34-min left" but I just re-tried and it worked the second time.
When it was done installing, it asked me for an account name - DO NOT NAME THE PROFILE ACCOUNT THE SAME AS ANY OF YOUR ALREADY EXISTING ACCOUNTS. I made a generic account name.
When it was done installing, go into your hard drive, documents and settings and voila! There you will see your other user accounts along with their desktops and my document folders. Also, you will be able to see your Program Files and any other hard drive folders you need.

Solution 9
One other thing Microsoft help says may cause the B4 STOP is a port conflict. If your laptop has a parallel port, disable in BIOS or change I/O address to 0378 from 03BC.

Solution 10 - From Microsoft Knowledge base
Solution - STOP: 0x000000B4 The video driver failed to initialize.
Solution - STOP: 0x000000B4 The video driver failed to initialize
SYMPTOMS
When you try to start Windows 2000, you may receive the following error message (on a blue screen):
*** STOP: 0x000000B4
The video driver failed to initialize.

Additionally, you cannot start Windows in Safe mode.

Solution 11 - Virus Infection
None of these solutions were worked for me. microsoft.public.windowsxp.customize. I got a idea from this post. I did following steps.

  • Removed the hard-disk from my PC.

  • Have connected the my PC through external drive to my Laptop. Both systems are having Windows XP SP2

  • Ran the anti-virus program for G drive, which is C Drive for my home PC.

  • 2 DLLs (under C:\Windows\System32) got infected. Removed those files.

  • Deleted 2 files under C:\Windows\System32, which are created on that day (based on the time-stamp).

  • Connected the hard-disk to my home PC again. Started my PC through WinXP setup CD.

  • Automatically Upgrade workstation was executed from Windows CD (Repair Windows Installation).

  • Rebooted System successfully and did not get any system errors..

Saturday, September 13, 2008

Lightweight Directory Access Protocol

Last few months, I'm trying to put a post for LDAP. Now LDAP is widely used in many companies. LDAP Testing is bit different from (native mode) user authentication. Again It is divided as single domain and multi-domain LDAP. Test team is treating LDAP as a another environment/stack to certify any product.

LDAP - Lightweight Directory Access Protocol. LDAP has become a mandatory in IT Projects. It is a set of protocols for accessing information directories. LDAP is based on the standards contained within the X.500 standard, but is significantly simpler. Also unlike X.500, LDAP supports TCP/IP, which is necessary for any type of Internet access.

The LDAP Interchange Format (LDIF), defined in RFC 2849, is a standard text file format for storing LDAP configuration information and directory contents. The dn attribute uniquely identifies the DN of the entry. In its most basic form, an LDIF file is:

  • A collection of entries separated from each other by blank lines

  • A mapping of attribute names to values

  • A collection of directives that instruct the parser how to process the information


Descriptions for commonly used abbreviations:
  • cn - Common Name

  • ou - Organizational Unit

  • dc - Domain Component

  • dn - Distinguished Name

  • rdn - Relative Distinguished Name

  • upn - User Principal Name


Sample LDAP configuration:
Principal : cn=admin,cn=Users,DC=rmdomain,DC=com
Users baseDN : DC=rmdomain,DC=com
Group baseDN : DC=rmdomain,DC=com
Bind User DN : cn=admin,cn=users,dc=rmdomain,dc=com

To know more about LDAP

Wiki - Lightweight Directory Access Protocol
LDAP Concepts & Overview
LDAP Authentication

Tuesday, July 8, 2008

Comparison of SilkTest and Winrunner

Last month, I have posted Comparison of SilkTest and QuickTest Professional . Then I thought to put one more comparison with Winrunner. This time I have compared in low level. It means comparing functions and file structure level. Hope it will be useful for automation newbies.

Wiki pages
Silktest on Wiki
Winrunner on Wiki

Code samples for both tools
Sample 4test code snippets for SilkTest
Sample TSL code snippets for Winrunner

References:


  1. SILKTEST AND WINRUNNER FEATURE DESCRIPTIONS - By Horwath/Green/Lawler

  2. Comparison of SilkTest and QuickTest Professional



Comparison Table: SilkTest Vs Winrunner

Features

SilkTest

WinRunner

Project fileSilktest has two types of extensions to represent projects. One is vtp file, which is usual one. Another one is stp file, which is zipped version of silktest project. <ProjectName>.ini or partner.ini has silktest settings.No project file.
Tool Configuration<ProjectName>.ini or partner.ini has silktest settings for particular project. Silktest has options set (*.opt) to configure the project level settings.Initial startup configurations are stored in wrun.ini file.
Test Environment vaiablesSetOption and GetOption methods are used to set various silktest settings. GetTestCaseName, GetTestCaseErrorCount, GetTestCaseState and GetTestCaseWarningCount functions are used to get information about testcases.setvar and getvar functions available to set or get test variables. Few options are : cs_run_delay, cs_fail, delay_msec, rec_item_name, rec_owner_drawn, searchpath, silent_mode, single_prop_check_fail, synchronization_timeout, tempdir and speed
Script RecorderOnly one mode for different activities.Record Testcase, Application State, Actions.Two modes. 1. Context sensitive mode 2. Analog mode.
Code ViewClassic 4Test, Visual 4TestOnly one view
Test ScriptScript is a single file. Extension is *.t. One script can contain many testcases.Actually Script is a folder and have set of supporting files.There will a file 'script'. That contains actual script.
  1. a db folder for asc data
  2. an exp folder for expected results.
  3. a debug folder for using during debug runs.
TestsTermed as Testcase. Each Testcase has block of coding statements.No separate terms.
Objects RepositoryOfficial term is frame file. They can be edited directly from the Editor. File extension is (*.inc). Objects are called as Window declarations. User can declare variables and functions inside frame file.Termed as GUI Map. Maintained as separate file. With the help of utility, objects can be modified. Two types as per Winrunner setting. They are 'GuiMap file per Test' and 'Global GUI Map'. File extension is same for both types as (*.gui). User can not declare variables and functions inside GUI Map file.
Physical descBased on Caption, Prior text, Index, Window ID, Location and Attribute.Wildcards can be used.Wildcards can be used.Identifying based on obligatory properties. An optional property is used only if the obligatory properties do not provideunique identification of an object. In cases where the obligatory and optional properties do not uniquely identify an object, WinRunner uses a selector. For example, if there are twoOK buttons with the same MSW_id in a single window, WinRunner would use a selector to differentiate between them. Two types of selectors are available:
  1. A location selector uses the spatial position of objects.
  2. An index selector uses a unique number to identify the object in a window.
Logical name - used to identify the objectCalled as Test Identifier. It is similar to variable. It should not have space or any other special characters. It is not similar to variable. It can have space and few special characters.
Object Representation
Based on true object hierarchy. Dynamic representation sample is given below:
Syntax: class("tag").class("tag").class("tag")
Example: MainWin("Text Editor - *").DialogBox("Find").TextField("Find What")
Based on Flat list. There will be only two levels. Top level will be window and leaf level will be child objects. Dynamic representation sample
Syntax: "{class: <class>, MSW_class: <WR class>,<property>:<propertyvalue>}"
Example: set_window("{class: window, MSW_class: html_frame,active:1}",20);
Function library Termed as Include (*.inc) file. Compile modules. Again it is similar to Test Script. Test Library/API calls use "frame.inc". You have to use in the beginning of script. Termed as Compiled module. GUI_load and GUI_open functions are used to load GUI Maps. You can call above functions anywhere from the script. You can call comipiled modules like below:
  1. reload( "C:\\MyAppFolder\\" & "flt_lib" );
  2. load( "C:\\MyAppFolder\\" & "flt_lib" );
CheckPoint Provided Verify and Verify Properties functions. Provided various check points for different purposes.
Results Reporting Results are stored into *.res binary files. It can be converted into differnt formats. Multiple versions can be stored into single file.Winrunner results are stored in separate folder for each run. Result folder contain two files:
  1. _t_rep.hdr -> Header file, which contains test run info
  2. _t_rep.eve -> results file, which contains info about each execution.
Library Browser Library Browser Function Generator
User Message Print(), Printf() functions report_msg() function.
Result Function Verify (), raise () and Reraise () functions tl_step () function
Exception Handling <do-except> block is available and few supporting functions. Winrunner does not have explicitly similar to do-except or try-catch block. But it has different wizards to handle different type of exceptions such as Pop-up exceptions, TSL exceptions, Object exceptions and Web exceptions.
Test/Error Recovery Powerful Default recovery system is set based on extension and MainWindow. It can be extended by using BaseState. Recovery Scenarios, which is available from Winrunner 7.5. Lower versions do not have this feature.
Wait statements Sleep (10) ' 10 seconds to wait Wait (10) ' 10 seconds to wait
Halt Execution temporarily Agent.DisplayMessage () - temporarily stopping execution with a message.pause() - pauses test execution and displays a message
To activate a windowMyWin.SetActive () set_window ("Shell_TrayWnd", 2);
Accessing DLLsOnly Standard DLLs. It does not support the COM/ActiveX DLLs, which are created by VB/.NET Both COM and Standard DLLs are supported. COM DLL support is available from Winrunner 7.5
Database Verification Having built-in functions to extract information from Databases through ODBC32 Interface (DSNs)Having built-in functions to extract information from Databases through ODBC32 Interface (DSNs). WinRunner also provides a visual recorder to create a Database Checkpoint used to validate the selected contents of an ODBC compliant database within a testcase.
Data functions Good Good. Having extensive support for SpreadSheet (Excel).
Scripting Language 4Test scripting language. It is a object oriented scripting language. Similar to C++ TSL - Test Script Language. It is based on the C programming language.
Data types Set of data types like integer, string and number are available. User can create their own data types also.No data types
Mostly using - Compound Data type LIST data type. ARRAY. Subscript can be integer or string.