Saturday, November 30, 2013

Apply Passport in bangalore

  1. NAVIGATE TO http://passportindia.gov.in/AppOnlineProject/welcomeLink 
  2. SELECT PASSPORT TYPE AND DOWNLOAD THE FORM .
  3. FILL IT OFFLINE.
  4. VALIDATE THE FORM BY CLIKCING ON VALIDATE BUTTON IN THE BOTTOM OF THE FORM
  5. SAVE THE FORM ,this wiil generate the xml file.
  6. UPLOAD THE XML FILE IN THE WEBSITE
  7. PAY THE FEES ONLINE.
  8. ON THE LEFT SIDE PANEL IN THE WEBSITE,CLICK ON THE LINK,VIEW SAVED FORM.
  9. CLICK ON THE LINK SCHEDULE APPOINTMENT AND SELECT THE SLOT.
  10. WAIT FOR UR TURN,
  11. ON THE SCHEDULED DATE, TAKE THE DOCUMENTS AS REQUIRED.my pasport type was fresh and normal so i produced sslc marks card as age proof and bank statement original as address proof.aadhar card and voters id were also taken. my appointment date was 22nd Nov 2013.
  12. At passport seva kendra, we need to go through counters A,B and C.Before going to these counters, pre document verification will be done and a number will be given.
  13. In a\A counter, you can see ur submitted form online in the screen facing us,we can make any changes if required to the online submitted form.Photo will be taken and passport form  will be printed ,we need to sign and give our finger prints of both the hands.
  14. To get appontment in B, u need to wait for an hour an half .
  15. B and C will validate the form again and give us the receipt.
  16. I got Status as Hold in the receipt which i got.
  17. I waited for the passport form to reach police station in 1 day,but it didnt.So, i went to PSK on 26th Nov.Then they made the status of application form from on hold to Granted.
  18. Then it reached my area police station on the same day.26th and all the police verification documents were submitted and the next day i.e on 27th, it reached commissioner office.
  19. I was waiting for status update that my form will reach from commissioner office back to psk.It didnt reach.So, today that i.e 30th Nov,I went to commissioner office and got the form approved.Below is the status.

Hope fully, I will get my passport in 4-5 working days.


Sunday, November 24, 2013

Tips for shopping

Below stuffs can be gifted :

for gals

kajal
lipsticks
makeupsets
nail polishes.
rings
bangles
clips
sandals


for boys
tshirts ,pullovers, shirts,jeans, belts,
shoes,socks
sunglasses
watches


for house,

nail cutter,
knife set,
glasses
plates
tissue papers.


Electronic items

projector
Laptop(1tb)
mobile
headset
playstation
camera
hard drive
intuos pen and touch medium tablet(link)
samsung chromebook

Thursday, November 14, 2013

Root Cause for the major issues in QA for agile methodologies:


• No rule around Code Freeze
• Late Checkins (Entire stories delivered to RC Branch)(RC: Release Candidate)
• Lack of Client data sets in QA Environment (Disk Space/ Environment issue)
• Lack of involvement of QA in few Dev only issues that are not certified by the QA
• Possible GAP in the Release Management.L
 Pre-staging environment is running with stale build .  The issues uncovered during All Hands Testing (on Prestaging environment) were already known to QA and captured them in the respective tickets.  Few of them were got fixed in later builds .  Hence upgrading the environment to most recent build that is being tested in regression environment will resolve most of the issues reported by the internal customers.

Wednesday, November 13, 2013

Adding a custom locator type in selenium IDE


LocatorBuilders.add('css:auto', function(e) {
    var value = e.getAttribute('class');   
    if (value.indexOf('auto_') != -1) {
     var s=str.indexOf('auto_');
     alert(value.substr(s))
        return value.substr(s) ; 
    }
return null;
});

Above code needs to be added in a js file.I have named it as "csslocators.js" .The above function will extract the class attribute of the element starting with "auto_"


This js file needs to be added to SIDe as ->options->options->in side extensions.Click on browse and select the file.

if u want ur locator type to be listed first,then u can do it in side->options->options->locator builders-> rearrange the items.


Wednesday, October 23, 2013

Inputs from Thouhgtworks for developing Automation framework

Test Automation Framework Development Challenges

Test automation framework development is a multi-stage process. And passing through each stage involves multiple challenges to be addressed. Key challenges to be addressed are detailed below:

Clear vision

Clear vision of what needs to be achieved out of this automation must be defined and documented. To formulate the clear vision, the following needs to be identified:
  • Testing Model - To be adapted (Enterprise, Product , Project)
  • Types of testing under the scope based on the testing model
  • Prioritizing the automation activity based on product/application/module (for example: Conducting functional testing and then performance testing)
  • Identify the areas that need to be automated (for example: Registration, Order processing)
  • Challenging validations that need to be taken into account (for example: Communicating from windows to Linux machine and executing the tests)
  • Critical and mandatory functionalities

Tool Identification and Recommendation

Tool identification process is a crucial one, as it involves critical factors to be considered, which include:
  • Creating a standard tool evaluation checklist which needs to be created by considering types of testing, teams involved, licensing cost of the tool, maintenance cost, training and support, tool's extensibility, tool's performance & stability etc.
  • Testing requirements which may include types of testing such as Functional, Performance, and Web Service etc.
  • We may need to acquire multiple tools to perform different types of testing on the product/project line.

Framework Design - Appropriately Pick and Choose

Framework design involves identifying requirements from multiple areas. At a high level, this includes (not limited to):
  • Identification of necessary utility/components related to application functionalities
  • Types of input data store to be communicated for data flow
  • Communication between the utilities/components (for example: data check-point components communicating to the logger etc)
  • Communication between the systems and utility/component development related to the same. (for example: communicating from windows to Linux environment)
  • Tool extending capabilities - Developing utilities/components for the validations not supported by the identified test automation tool, if any.

Approach to Framework Development

Pre-requisites and Assumptions

  • User is aware of the basics of test automation
  • User has planned the test automation activity, by considering the scope, objectives, requirements, schedule and budget
  • User has gone through the process of "Test Automation Tool Build or Buy" and has taken a decision of buying a tool or getting a open-source tool
Image

Identify Testing Scope

Each organization believes in its own requirements in software test automation. Considering the organization's requirements, test automation activities can be performed with three different scopes:
  • Enterprise-oriented - Test automation to support different product lines and projects in the organization.
  • Product-oriented - Test automation activities focused towards specific product line of applications
  • Project-oriented - Test automation effort focused towards specific project and its test process.

Identify Testing Types

Subsequent to the testing scope identification, product/application/modules under the testing scope need to be identified. Based on the product/application/module requirement, types of testing that need to be performed are identified. For example, em Scenario: For an 'Enterprise-oriented' testing scope, product A would require a functional testing, product B would require a web-service testing, a product C would require a performance testing and also complete project management etc.......
Priority must be assigned to each type of testing, based on the schedule for product release.

Identify Requirements to be automated

Testing requirements and their nature is studied for the product/application/modules. Each requirement has its own actions, validations for testing. For example,
Scenario 1: For an application, form validation functionalities, database validation and accessibility functionalities needs to be validated.
Scenario 2:For an application, all the web-service methods needs to be validated. This would also include the delay time for the request's reponse from third party systems
All the identified requirements are assigned priority. This would help in identifying 'Build-Verification Test' (BVT) requirements that should never fail.

Evaluate Test Automation Tool

Identified testing types and requirements, acts as a base criterion for test automation tool evaluation.
Checklist - An exhaustive evaluation checklist needs to be created which is in-line with the requirements and the tool is evaluated against this checklist for positive results. Checklist needs to cover (not limited to):
  • Our requirements
  • Types of testing
  • Teams involved
  • Licensing cost of the tool
  • Maintenance cost
  • Training and Support
  • Tool's Extensibility
  • Tool's Performance & Stability
Identify Tools - Next task would be identifying different industry-standard tools based on the requirements. This can also include tools to be purchased or open source tools. Identified tools must be evaluated against the checklist.
Sample Run - Tools claim that the tool supports specific requirements, but finally when we try creating our scripts it fails. Best way to evaluate is to create a sample run, this includes different types of actions and requirements we need to perform. Create sample scripts and execute the same for results.
Rate and Select Tools - Based on the sample run, supportive tools could be identified and rated. Also there may be scenarios, where multiple tools satisfy the requirements. In the said scenario, we may need to choose more than one tool, for test automation.
Implementation and Training - High rated tools will be procured/open-source licensed. Training needs to be conducted for the project team, on how to use these tools.

Identifying Requirements can be Automated

Every tool has its own limitations. A feasibility study needs to be conducted for the requirements against the tools. This study would result in listing requirements that can be automated. Also based on the nature of the requirements, automation feasibility needs to be identified.
Image

Design Test Automation Framework

Generally, testers start creating test scripts based on the scenarios. This includes multiple actions to be performed against each objects. This approach leads to an ad-hoc test script creation and duplicate testing effort, i.e. testers, would create test scripts for a single action in different scenarios.
Our approach takes a different path as explained below. For designing a framework, various elements need to be taken into consideration. Utilities/Components (re-usable) would be designed for the following elements that include (not limited to):
  • Actions to be performed - Identification of actions to be automated for each object of the application
  • Communicating Systems - Study of different internal systems, third-party systems and their communication methodology
  • Business Rules - List of business layers and any specific algorithm has to be studied. A separate function needs to be created for each specific algorithm.
  • Database Communication - Database validation and check point validations
  • Communication with additional automation tools - In the scenario, where we would require communicating with different automation tool. All the communication requirements needs to be identified and designed
  • Data retrieval - Retrieval of data from multiple input data stores
  • Schedulers - Functionalities related to invoking of relevant scripts based on scheduler configuration
  • Tool Extensibility - Overcoming tool limitations. Components for actions/validations for which the tool does not provide any support
  • Device Communication - Device communication and data transfer related actions/validations
  • Log - User-defined logs for analysis
  • Error Handlers - Error handlers to handle known and unknown errors and log the information
  • Custom Messages - Display of relevant defined messages
  • Result Presentation - Customized and presentable reports on completion of test execution
Test automation framework would be designed based on the listed factors, using the following guidelines.
  • Application-independent.
  • Easy to expand, maintain, and perpetuate.
  • Encapsulate the testers from the complexities of the test framework
  • Identify and abstract common functions used across multiple test scripts
  • Decouple complex business function testing from navigation, limit-testing, and other simple verification and validation activities.
  • Decouple test data from the test scripts
  • Structure scripts with minimal dependencies - Ensuring scripts executing unattended even on failures

Design Data Input Store

Types of input data files supported by the tools, needs to be identified. Based on the requirements, input files can be categorized as (not limited to),
  • Objects Identifier - Object identification syntax respective to the tool, mapped to the logical object name. For example,"A username textbox in the registration page mapped to logical object name - regUName"
  • Scenarios/Workflows/Transactions based input - Complete set of input data for different scenarios/workflows/transaction. Each scenario/workflow/transaction translates to "n" number of test cases. This test case based user input benefits the team during future enhancements, in a way that multiple input data can be added using the Test Case ID. For example, "A complete financial transaction order processing, which invokes web services methods for order processing. In this case, input data is created based on test case id". TestCase (TC) 1 would be entering account details, TC2 Order details etc ...
  • Custom Message - This can contain custom messages to be displayed for known and unknown errors.
  • Driver - File can contain list of file/transaction/workflow id's to be referred to, for a selected batch execution/group of test case executions
For all the files types, file format needs to be identified and prototyped based on the input data storage.

Develop framework

Framework development is facilitated using the same set of identified tools. Scripting language supported by the test automation tool is used to create the components. Tool extensibility utility/component can be developed using a different language. Utility functions/components created based on framework design is explained in Step 7.
In addition to the re-usable components driver scripts and worker scripts needs to be created.
  • Driver Scripts - Scripts that execute a set of transactions, by invoking relevant re-usable utilities/components for each test case. Driver scripts can be mapped to a group of test cases related to a scenario/transaction/screen/window.
  • Worker Scripts - Scripts that execute the driver scripts. Worker scripts are group of driver/individual scripts to execute in a batch mode. Worker scripts produce the final results, for the executed batch.
Approaches for developing re-usable utilities/components include:
  • Record/Replay - Used to identify the object recognition pattern, of the specific tool. Very minimal usage
  • Screen/Window/Transaction - Used to identify different scenarios to execute scripts in batches.
  • Action/Keyword - Invokes the relevant utility/components to perform actions on specific objects. Driver scripts are created based on this input
  • Data Driven - Input to keyword driven approach, where validation needs to be performed using multiple input combinations.

Populate Input Data Store

Input data store needs to be populated based on the file structure defined in Step 6. Data can be populated either manually or in an automated fashion from different data-sources. Test data would be populated based on parent-child hierarchy. For example,
"A transaction would be a parent hierarchy and Input to the test cases would be the child"

Configure Schedulers

Scheduler requirement needs to be identified. Schedulers can be configured to run a worker script (batch script) on a specific time period. This approach benefits in a way that even a business user can configure the scheduler and make the test execution happen.

Key Benefits of Framework

Standard process in Production

- Test automation processes, a single standard is established across the organization. This helps the organization as they follow the standard processes as compared to pre-empted ad-hoc processes, which yield no results.

Free from dependencies

- Complete coding and component usage standards are defined in production. Organization benefits include:
  • Independency from the individual coding standards and the utilities/components created
  • Complete documentation helps the organization in inducting the new members with minimal effort

Complete Coverage

- Requirements are collected from an overall organization's perspective (for eg: Product suite on multiple technologies .net and java etc). Overall coverage of re-usable components which includes (data communications, system communications, schedulers, loggers, reporters etc)
This overall coverage minimizes the testing effort during the later stages of the releases, for the entire product suite across the organization.

Future Enhancements Support

- Organizations need not worry about testing future enhancements. Only the validations related to the enhancements need to be added to the existing base framework, and that too with minimal effort.

Cost Estimation

- At the end of Step 6, the complete cost for the framework development can be estimated. This cost includes,
  • Acquisition cost - In the procurement process of the tool, following cost needs to be considered:
    • Tool Cost
    • Cost based on number of licenses, based on our requirements
    • Tool Support Cost (On-line, Telephone)
    • Version Upgrade Cost
  • Training - Training cost incurred for training test engineers, business users, developers and creating supportive training documentations must be taken into consideration
  • Environment - Cost involved in setting up the system environment (Hardware and Software) must be taken into consideration
  • Development - Development cost can be calculated based on the components designed in the framework development - Step 6
  • Maintenance - Each tool has its own maintenance requirements. Some tools may demand for part-time, some tools demand for a dedicated resource maintaining the tool. Based on the tool's requirements, this cost needs to be calculated

http://www.thoughtworks.com/insights/articles/guide-test-automation

Saturday, October 19, 2013

Renaming .zip file to .xpi

I had compressed my firefox extension to a .zip file but I was unable to rename the extension to .xpi

I selected the contents inside the main folder of my extension, and compressed to a zip folder (Right click - send to - compressed (zipped) folder.)

Then I renamed the .zip file from chrome.zip to myextension.xpi

But it's just renamed the zipped folder and not changing the extension field from .zip to .xpi  .


What you may need to do is have Windows show the file extension and to do this, you need to do these steps:

1. Open Windows Explorer.
2. click on Organise and then select "folder and search options".
3. Go to the "view" tab and remove the check from "hide extensions for known file types".
4. Click apply and try renaming your file this time.

When you do rename a file, you'll get a warning from Windows (at least XP anyway) stating that changing the file extension may make the file no longer viewable by some programs and if you are okay with this. If you don't get this, then you aren't renaming the extension,

Now you should see the "ZIP" extension  changed to xpi.


Friday, September 20, 2013

FINDING LOCATORS FOR SELENIUM

 USING XPATH:

Some examples:
//li[@id='partner360__adnpayment']
//input[@id='']/following-sibling::img
//input[@name='orgstatus_active_type']/following-sibling::label[text()='$Value']/preceding-sibling::img
//table[@class = 'x-btn-wrap x-btn op-btn-standard']//following::button[text() ='Apply']
//table[@class='']//folowing::button[text()='Apply']
//a[contains(text()='')]
//label[contains(text()='']
//div[@id='dynamicAcctFormDetails']//input[@name= 'creditStatus']/following-sibling::img
//*[@id='acct-save-id']
"//*[@class='x-btn-menu-arrow-el' and @type ='button']
//a[contains(text(),'Save and Close')]"
//table[@id='user-save-id']/tbody/tr/td[2]/em/button
//div[text()='Users' and contains (@class,'op-listitem')]
//div[text()='xyz' and contains(@class,'something')]
//div[text()='xys' and contains(@class,'something')]
//input[@id='']/following-sibling::img
//div[contains(@class,'auto_payments_summary_grid')]//div[contains(text(),'Sales Order: ') ]

QUICK HELP FOR FINDING  LOCATORS IN EXT JS-3

BUTTON        //table[@id='adnetwork-partner-active-id']/tbody/tr/td[2]/em/button
BUTTON        //button[text()='Submit']
IMG            css=div#.x-panel-collapsed .x-accordion-hd .x-tool-toggle ~ span:contains('$TEXT')
SELECTLIST    //input[@id = 'operation']/following-sibling::img
TABLECOL    //div[@class='x-grid3-cell-inner x-grid3-col-status' and contains(text(), '$TEXT')]
BUTTON        //table[@id='opr-button-pushtoadserver']//button[text()='Push to Ad Server']
TEXT        //label[text() = 'Targeting Name:']//following::input[@name ='name']
BUTTON        //label[text() = 'Targeting Name:']//following::button[text() ='Apply']
BUTTON        //label[text() = 'Targeting Name:']//following::button[text() ='Reset']
BUTTON      //div[@id='orgDetails']//span[text()='Payment Terms - Standard Cost Deductions' and contains(@class,'x-panel-header-text')]
TABLECOL    //div[@id='invoiceperiods']//div[@class='x-grid3-body']//div[@class='x-grid3-body']/div[$iRow]/table/tbody/tr/td[8]




USING CSS ADVANCED:

(BELOW CONTENT IS TAKEN FROM SAUCE_LABS)

Next sibling

Our first example is useful for navigating lists of elements, such as forms or ul items. The next sibling will tell selenium to find the next adjacent element on the page that’s inside the same parent. Let’s show an example using a form to select the field after username.
1
2
3
4
<form>
<input class="username"></input>
<input class="alias"></input>
</form>
Let’s write a css selector that will choose the input field after “username”. This will select the “alias” input, or will select a different element if the form is reordered.
1
css=form input.username + input

Attribute values

If you don’t care about the ordering of child elements, you can use an attribute selector in selenium to choose elements based on any attribute value. A good example would be choosing the ‘username’ element of the form without adding a class.
1
2
3
4
5
6
<form>
<input name="username"></input>
<input name="password"></input>
<input name="continue" type="button"></input>
<input name="cancel" type="button"></input>
</form>
We can easily select the username element without adding a class or an id to the element.
1
css=form input[name='username']
We can even chain filters to be more specific with our selections.
1
css=input[name='continue'][type='button']
Here Selenium will act on the input field with name=”continue” and type=”button”

Choosing a specific match

CSS selectors in Selenium allow us to navigate lists with more finess that the above methods. If we have a ul and we want to select its fourth li element without regard to any other elements, we should use nth-child or nth-of-type.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<ul id="recordlist">
<p>Heading</p>
    <li>Cat</li>
    <li>Dog</li>
    <li>Car</li>
    <li>Goat</li>
</ul>
If we want to select the fourth li element (Goat) in this list, we can use the nth-of-type, which will find the fourth li in the list.
1
css=ul#recordlist li:nth-of-type(4)
On the other hand, if we want to get the fourth element only if it is a li element, we can use a filtered nth-child which will select (Car) in this case.
1
css=ul#recordlist li:nth-child(4)
Note, if you don’t specify a child type for nth-child it will allow you to select the fourth child without regard to type. This may be useful in testing css layout in selenium.
1
css=ul#recordlist *:nth-child(4)

Sub-string matches

CSS in Selenium has an interesting feature of allowing partial string matches using ^=, $=, or *=. I’ll define them, then show an example of each:
^= Match a prefix
$= Match a suffix
*= Match a substring
1
css=a[id^='id_prefix_']
A link with an “id” that starts with the text “id_prefix_”
1
css=a[id$='_id_sufix']
A link with an “id” that ends with the text “_id_sufix”
1
css=a[id*='id_pattern']
A link with an “id” that contains the text “id_pattern”

Matching by inner text

And last, one of the more useful pseudo-classes, :contains() will match elements with the desired text block:
1
css=a:contains('Log Out')
This will find the log out button on your page no matter where it’s located. This is by far my favorite CSS selector and I find it greatly simplifies a lot of my test code.

Wednesday, September 18, 2013

Open a command prompt from folder without navigation

Just control+shift+r on the folder wer u need to launch the command prompt and select the open command window here option.
There u go!!



Wednesday, August 7, 2013

Some LINUX commands

1.Checkout:

svn checkout svn:/svn/automation_project/trunk .
 
2.compile in unix
javac -classpath commons-net-3.1.jar:mysql-connector-java-5.1.13-bin.jar:jxl.jar:servlet-api.jar DBConnection2.java
 
3.set classpath in unix
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin 
 
To compare two files ignoring differences in the case of the letters and blank spaces:
diff -iw part1 part_one
 
 

Sort Command Examples

Sort command in unix or linux system is used to order the elements or text. Sort command has the capability of sorting numerical values and strings. The sort command can order the lines in a text file.

The syntax of sort command is:

sort [options] filename
The options are:

-b : Ignores leading spaces in each line -d : Uses dictionary sort order. Conisders only spaces and alphanumeric characters in sorting -f : Uses case insensitive sorting. -M : Sorts based on months. Considers only first 3 letters as month. Eg: JAN, FEB -n : Uses numeric sorting -R : Sorts the input file randomly. -r : Reverse order sorting -k : Sorts file based on the data in the specified field positions. -u : Suppresses duplicate lines -t : input field separator
Sort Command Examples:

Before practicing the examples create the below two files in your unix system:

> cat order.txt Unix distributed 05 server Linux virtual 3 server Unix distributed 05 server Distributed processing 6 system > cat delim_sort.txt Mayday|4 Janmon|1 Declast|12
1. Sorting lines of text

The default sort command uses alphabetical order (ASCII order) to sort the file. It treats each line as a string and then sorts the lines.

> sort order.txt Distributed processing 6 system Linux virtual 3 server Unix distributed 05 server Unix distributed 05 server
2. Sorting based on the field positions.

You can specify the field positions using the -k option of sort command. The sort command uses the space or tab as the default delimiter. To sort based on the data in the second field, run the below command:

> sort -k2 order.txt Unix distributed 05 server Unix distributed 05 server Distributed processing 6 system Linux virtual 3 server
You can also specify more than field with k option as a comma separated list. The below command uses the second and fourth fields to sort the data.

> sort -k2,4 order.txt
3. Numeric sorting

Instead of the default alphabetical sorting order, you can make the sort command to sort in numeric order using the -n option. This is shown below:

> sort -nk3 order.txt Linux virtual 3 server Unix distributed 05 server Unix distributed 05 server Distributed processing 6 system
4. Sort in reverse order

By default, the sort command sorts the data in ascending order. You can change this to descending order using the -r option.

> sort -nrk3 order.txt Distributed processing 6 system Unix distributed 05 server Unix distributed 05 server Linux virtual 3 server
5. Suppressing duplicates or Print only unique values

You can produce only unique values in the output using the - u option of the sort command.

> sort -u order.txt Distributed processing 6 system Linux virtual 3 server Unix distributed 05 server
Another way is piping the output of sort command to uniq command.

> sort order.txt | uniq
6. Delimited file input

In the second, third and fourth examples we have sorted the data based on the field positions. Here the fields are separted by space or tab character. What if the fields are specifed by any other character? In such cases, we have to specify the input delimiter with the -t option. An example is shown below:

> sort -t'|' -nrk2 delim_sort.txt Declast|12 Mayday|4 Janmon|1
7. Sorting on months.

We can sort the data in the monthwise using the -M option of the sort command. This is shown below:

> sort -M delim_sort.txt Janmon|1 Mayday|4 Declast|12
 
Taken from http://www.folkstalk.com/2012/08/sort-command-examples-in-unix-linux.html
 
 
 

sed Case Insensitive Search Matching

 sed -e s/o1sales/o1adops/gI input_report_url.csv >i.csv 
 

Delete nonempty directory in Linux

rm -rf directoryname

Substring using bat command

>set fullname=c:\mypath\oldfile
>set changedname=%fullname:oldfile=newfile%
>echo %changedname%
c:\mypath\newfile
 
 
> set fullname=c:\mypath\oldfile
> set pathonly=%fullname:oldfile=%
> echo %pathonly%
c:\mypath\ 

Ref:http://stackoverflow.com/questions/2690382/substring-using-bat-command

Monday, July 29, 2013

TOMCAT STARTUP ISSUE :INFO: The APR based Apache Tomcat Native library which allows optimal performance in production


add a system property to the launch configuration of the tomcat server in eclipse.
 -Djava.library.path=c:\dev\tomcat\bin
And download the tcnative dll (or libnative.so for Linux) and put it in the bin folder.

Thursday, July 25, 2013

Start multiple instances of Selenium RC's and hub

Download seleniumgrid1 .navigate to the  folder and

1. create a batch file called rc_grid1.bat and paste the below

ant -Dport %1 -Denvironment="*firefox"  -DseleniumArgs="-userExtensions user-extensions.js " launch-remote-control

2.create a batch file called rc_hub and paste below

ant launch-hub

3.Launch hub and multiple RC's by creating another batch file called start_hub_rc.bat

start cmd /k Call rc_hub.bat 4444
pause 20
start cmd /k Call rc_grid1.bat 5555
start cmd /k Call rc_grid1.bat 6666
start cmd /k Call rc_grid1.bat 5570
start cmd /k Call rc_grid1.bat 5575
start cmd /k Call rc_grid1.bat 5580
start cmd /k Call rc_grid1.bat 5574
start cmd /k Call rc_grid1.bat 5578
start cmd /k Call rc_grid1.bat 7777
start cmd /k Call rc_grid1.bat 8888
start cmd /k Call rc_grid1.bat 9999
start cmd /k Call rc_grid1.bat 1010
start cmd /k Call rc_grid1.bat 1011
start cmd /k Call rc_grid1.bat 1012
start cmd /k Call rc_grid1.bat 1013
start cmd /k Call rc_grid1.bat 1014
start cmd /k Call rc_grid1.bat 1015
start cmd /k Call rc_grid1.bat 9998
start cmd /k Call rc_grid1.bat 1016
start cmd /k Call rc_grid1.bat 1017
start cmd /k Call rc_grid1.bat 1018
start cmd /k Call rc_grid1.bat 1019
start cmd /k Call rc_grid1.bat 1020
start cmd /k Call rc_grid1.bat 1021
start cmd /k Call rc_grid1.bat 1022
start cmd /k Call rc_grid1.bat 1023


You can see multiple rcs launched and connected to the hub.

Wait in batch file

  1.  pause 20: it will wait for 20sec's ,but u need to press any key to continue.
  2.  TIMEOUT /T 20: it will wait for 20sec's
  3.  ping -n 600 127.0.0.1 > NUL:This will wait for 600/60 =60sec's i.e 1min

Tuesday, April 30, 2013

Restart the windows remote server


To restart after shutdown remote machine.
·       Write below in cmd line
·       Shutdown /r

Stop listening to particular port in windows



·      To get the pids for respective port : 
         type in the below command in command prompt.

        netstat -a -o 

     This will output 

 Proto  Local Address          Foreign Address        State           PID
  TCP    0.0.0.0:80             I2LT189:0              LISTENING       2408
  TCP    0.0.0.0:135            I2LT189:0              LISTENING       924
  TCP    0.0.0.0:443            I2LT189:0              LISTENING       2408
  TCP    0.0.0.0:445            I2LT189:0              LISTENING       4
  TCP    0.0.0.0:1110           I2LT189:0              LISTENING       2888
  TCP    0.0.0.0:2002           I2LT189:0              LISTENING       2092
  TCP    0.0.0.0:3306           I2LT189:0              LISTENING       2244
  TCP    0.0.0.0:4444           I2LT189:0              LISTENING       8984
  TCP    0.0.0.0:5357           I2LT189:0              LISTENING       4
  TCP    0.0.0.0:5800           I2LT189:0              LISTENING       2520
  TCP    0.0.0.0:5900           I2LT189:0              LISTENING       2520
  TCP    0.0.0.0:5938           I2LT189:0              LISTENING       2408

·       To stop listening to port ,use taskkill command.
     taskkill /F /PID <process id>

·       eg:To stop listening to port 4444,type in below
     taskkill /F /PID 8984(where 8984 is process id for 0.0.0.0:4444 )

Terminate multiple processes at a time on windows machine

Terminating multiple tasks from task manager one at a time could be troublesome.
Use the below to kill multiple processes by running a command.
1. Open command prompt
2.   2. type    taskkill /f /im processname.exe
·             ex: taskkill /f /im java.exe
That's it. 


To check if the process is running or not and then terminate,please use below batchscript:
Below code wil first check if the firefox instance is open, only then it kills.

tasklist /FI "IMAGENAME eq firefox.exe" /FO CSV > search.log
FOR /F %%A IN (search.log) DO IF %%A EQU 0 GOTO end

:end
del search.log
taskkill /f /im firefox.exe
exit 0