As a software tester, do you have thoughts like,

 “What do I eventually want to become at the zenith of my career?”

“How do I grow in my organization, what are the different paths I could take?”

“What all should I do to help me build my reputation with my peer community?”

“Where are the places that the community is referring to and learning from?”

If your answer to any of these is yes, then the good news for you is, you are not alone. Many of your peers are plagued with these challenges and want to know how others are growing and becoming a name in the testing community. The bad news is, there are no set paths. It appears there are many paths to choose from. Some work for some QA and others work for others.

BUT the BEST news is – YOU can now participate in a roundtable to hear from the community itself, and the leaders, and find out what worked for them. Discuss the specifics with the peer community and leaders attending the conference.

Does a career path for a software tester exist and if so, what are the some of the key stages in that development path that lead to optimal achievement of a rewarding career in software testing? Should specialization be a consideration–not only mobile, web, technical but what about performance or automation; or industry specializations like telecom, healthcare, manufacturing and embedded applications? What about education? Is a formal education necessary and if so, what specific programs are available for software testers? What about certifications? How about development outside of the workplace—writing articles, joining testing groups, attending and participating in conferences?

We welcome your other queries, too!! Bring your questions to the table for all to discuss and share their thoughts and experiences or submit in advance to info@sqasolution.com .

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

{ 0 comments }

Frequently Asked Questions

by admin on October 2, 2014

faq

+ What is SQA Solution?

SQA Solution is Software Testing and QA company specializing in QA outsourcing QA Staffing and QA Training. Our education program offers courses and workshops on one of the most relevant skills of technology companies in the 21st century: Software Quality Assurance and Testing

All our classes are compatible with a regular work schedule and our campus is conveniently located in the heart of San Francisco Bay Area. This is not your traditional lecture class! Expect a healthy mix of group work, hackathons, one-on-ones with mentors, and a hands-on experience testing a product from end to end.

The instructors are professionals with real-world experience working at renowned tech Companies like SalesForce and Genentech, and other technology start ups.

We have assembled a list of local hiring partners who are eagerly looking for our top students.

+ What is the salary for QA?

According to Glassdoor.com, the median salary for a QA in the San Francisco Bay Area is $95K.

+ What will the program be like?

  • Bootcamp modules. Short modules covering both the technical and non-technical skills necessary to succeed in the QA industry.
  • Office hours with mentor QA. One-on-one sessions with our mentors to review your portfolio and aid with a job search. All our mentors are professionals with real-world experience working at renowned tech Companies like Google, SalesForce and Genentech, and other technology start-ups.
  • Build a portfolio project to showcase your test automation and QA talents. Employers are naturally skeptical and it’s way better to show than to tell. We’ll guide you through building a portfolio using the skills and techniques used industry wide.

Interview with amazing employers. Meet employers looking for top  QA applicants.

+ What kind of technical skills will I learn?

The program builds on your QA knowledge and provides you the skills needed to quickly have large industry impact.  During this course, you’ll learn Java,WebDriver, Selenium IDE, Frameworks, Linux, SQL, TDD and more!

+ What kind of soft skills will I learn?

Succeeding in industry is as much about soft-skills as technical ones. We cover some of the basics:

  • Communication skills. Academics and people in industry communicate in very different ways. We’ll work with you to teach you common QA terms and communication style.
  • Networking. Meeting people is really important for your career but there are half a dozen subtle mistakes that young professionals frequently make. We’ll help you avoid them.
  • Practice interviews. Technical interviews can be notoriously tough. We help you prepare so that you know what to expect.

+ What is the time commitment?

The course consists of a 6 week course with classes held 4 times a week for 4 hours in our Daly City office  ( 140 San Pedro Rd., Daly City, CA 94014). The total duration of the course is 123 hours.

In addition to the classes, plan on spending at least 15 hours outside of class each week working on homework assignments about your project.

Students will develop their own portfolio from end to end, and will present them in an invite-only event called QA Demo Day, in front of an audience of Recruiters and Senior QA Managers.

+ Who is eligible to apply?

We welcome applications from anyone who lives in the San Francisco Bay Area and knows how to test. The program is geared towards helping you make a transition to the White Box Testing and Test Automation from Manual black box testing, and we are looking for candidates who want to get a new job within three months of completing the course.

+ What is included in the tuition price?

The tuition is $3,000 and it includes access to our classes and events during 6 weeks. Life-time access to our online course materials library. Life-time access to our network of Hiring Partners, Mentors and Alumni. And to top it all off you will be served a delicious dinner each night that class is held.

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

Write a Program to search in pdf

by admin on September 3, 2014

Lets get started by downloading the required libraries. Please stick to the version of software’s that I am using, since latest versions may require different kind of implementation.
1. Download Apache lucene 3.6.1 from here. Unzip the content and find lucene-core-3.6.1.jar.
2. Download Apache PDFBox 0.7.3 from here. Unzip it and find pdfbox-0.7.3.jar
3. Download fontbox-0.1.0.jar from here. This project will throw Class not found exception if this library is not present.
Next step is to create a Java Project in Eclipse. Right click the project in project explorer, Go to -> Configure build Path -> Add External jars -> add lucene-core-3.6.1.jar,pdfbox-0.7.3.jar and fontbox-0.1.0.jar -> Click OK.
4. Create a class and name it as SimplePDFSearch.java. This is the main class that is going to perform each action one by one. Copy paste the below code in this class. Edit the package name to the name of package in which you are creating this class.
01 package com.programmingfree.simplepdfsearch;
02
03 import org.apache.lucene.queryParser.ParseException;
04 import org.pdfbox.pdmodel.PDDocument;
05 import org.pdfbox.util.PDFTextStripper;
06
07 import java.io.File;
08 import java.io.IOException;
09
10
11  public class SimplePDFSearch {
12      // location where the index will be stored.
13      private static final String INDEX_DIR = "src/main/resources/index";
14      private static final int DEFAULT_RESULT_SIZE = 100;
15
16      public static void main(String[] args) throws IOException, ParseException {
17
18          File pdfFile = new File("src/resources/SamplePDF.pdf");
19          IndexItem pdfIndexItem = index(pdfFile);
20
21          // creating an instance of the indexer class and indexing the items
22          Indexer indexer = new Indexer(INDEX_DIR);
23          indexer.index(pdfIndexItem);
24          indexer.close();
25
26          // creating an instance of the Searcher class to the query the index
27          Searcher searcher = new Searcher(INDEX_DIR);
28          int result = searcher.findByContent("Hello", DEFAULT_RESULT_SIZE);
29          print(result);
30          searcher.close();
31      }
32      
33      //Extract text from PDF document
34      public static IndexItem index(File file) throws IOException {
35          PDDocument doc = PDDocument.load(file);
36          String content = new PDFTextStripper().getText(doc);
37          doc.close();
38          return new IndexItem((long)file.getName().hashCode(), file.getName(), content);
39      }
40
41     //Print the results
42      private static void print(int result) {
43       if(result==1)
44          System.out.println("The document contains the search keyword");
45       else
46       System.out.println("The document does not contain the search keyword");
47
48      }
49  }
5. We have to create a class to set and get the items that need to be indexed from a PDF file. Create a class and name it as IndexItem.java and copy the below code and paste in it. By doing this we are instructing the search engine to create and to retrieve the following contents of the PDF file, an Unique ID, the file name and the contents (text) of the file.
01 package com.programmingfree.simplepdfsearch;
02
03 public class IndexItem {
04  private Long id;
05     private String title;
06     private String content;
07
08     public static final String ID = "id";
09     public static final String TITLE = "title";
10     public static final String CONTENT = "content";
11
12     public IndexItem(Long id, String title, String content) {
13         this.id = id;
14         this.title = title;
15         this.content = content;
16     }
17
18     public Long getId() {
19         return id;
20     }
21
22     public String getTitle() {
23         return title;
24     }
25
26     public String getContent() {
27         return content;
28     }
29
30     @Override
31     public String toString() {
32         return "IndexItem{" +
33                 "id=" + id +
34                 ", title='" + title + '\'' +
35                 ", content='" + content + '\'' +
36                 '}';
37     }
38
39 }

6. Next step is to create a class to index the contents of the PDF documents. Create a new class and name it as Indexer.java as we have referred here. Copy and paste the below code to Indexer.java,

01 package com.programmingfree.simplepdfsearch;
02
03 import org.apache.lucene.analysis.standard.StandardAnalyzer;
04 import org.apache.lucene.document.Document;
05 import org.apache.lucene.document.Field;
06 import org.apache.lucene.index.IndexWriter;
07 import org.apache.lucene.index.IndexWriterConfig;
08 import org.apache.lucene.index.Term;
09 import org.apache.lucene.store.FSDirectory;
10 import org.apache.lucene.util.Version;
11
12 import java.io.File;
13 import java.io.IOException;
14
15 public class Indexer {
16  private IndexWriter writer;
17
18     public Indexer(String indexDir) throws IOException {
19         // create the index
20         if(writer == null) {
21         writer = new IndexWriter(FSDirectory.open(
22                 new File(indexDir)), new IndexWriterConfig(Version.LUCENE_36, newStandardAnalyzer(Version.LUCENE_36)));
23         }
24     }
25
26     /**
27       * This method will add the items into index
28       */
29     public void index(IndexItem indexItem) throws IOException {
30
31         // deleting the item, if already exists
32         writer.deleteDocuments(new Term(IndexItem.ID, indexItem.getId().toString()));
33
34         Document doc = new Document();
35
36         doc.add(new Field(IndexItem.ID, indexItem.getId().toString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
37         doc.add(new Field(IndexItem.TITLE, indexItem.getTitle(), Field.Store.YES, Field.Index.ANALYZED));
38         doc.add(new Field(IndexItem.CONTENT, indexItem.getContent(), Field.Store.YES, Field.Index.ANALYZED));
39
40         // add the document to the index
41         writer.addDocument(doc);
42     }
43
44     /**
45       * Closing the index
46       */
47     public void close() throws IOException {
48         writer.close();
49     }
50 }

7. The last step is to create a class that provides features to query the index that is created using the indexer class. Create a class and name it as Searcher.java. Copy and paste the below code in it.

01 package com.programmingfree.simplepdfsearch;
02
03 import org.apache.lucene.analysis.standard.StandardAnalyzer;
04 import org.apache.lucene.document.Document;
05 import org.apache.lucene.index.IndexReader;
06 import org.apache.lucene.queryParser.ParseException;
07 import org.apache.lucene.queryParser.QueryParser;
08 import org.apache.lucene.search.*;
09 import org.apache.lucene.store.FSDirectory;
10 import org.apache.lucene.util.Version;
11
12 import java.io.File;
13 import java.io.IOException;
14 import java.util.ArrayList;
15 import java.util.List;
16
17 public class Searcher {
18  
19     private IndexSearcher searcher;
20     private QueryParser contentQueryParser;
21
22     public Searcher(String indexDir) throws IOException {
23         // open the index directory to search
24         searcher = new IndexSearcher(IndexReader.open(FSDirectory.open(newFile(indexDir))));
25         StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_36);
26
27         // defining the query parser to search items by content field.
28         contentQueryParser = new QueryParser(Version.LUCENE_36, IndexItem.CONTENT, analyzer);
29     }
30
31     
32     /**
33       * This method is used to find the indexed items by the content.
34       * @param queryString - the query string to search for
35       */
36     public int findByContent(String queryString, int numOfResults) throwsParseException, IOException {
37         // create query from the incoming query string.
38         Query query = contentQueryParser.parse(queryString);
39          // execute the query and get the results
40         ScoreDoc[] queryResults = searcher.search(query, numOfResults).scoreDocs;
41         
42         if(queryResults.length>0)
43          return 1;
44         else
45          return 0;
46         
47     }
48
49     public void close() throws IOException {
50         searcher.close();
51     }
52 }

 

That is all we have to do before we run this program to find whether a word is present in a PDF file or not in a more quick and efficient way. Note in the main class (SimplePDFSearch.java), I have used a field named INDEX_DIR which contains the path where the index will be stored. Every time this program is run, the old index will be cleared and new index will be created. I have used a sample PDF document that consists of the following text in it,


“Hello World by PDFBox”

I am searching for the word “Hello”, that is passed as a parameter to findByContent method of the Searcher class and the output is,

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

{ 0 comments }

Write a java program for swapping of two numbers

by admin on September 3, 2014

This java program swaps two numbers using a temporary variable. To swap numbers without using extra variable see another code below.

Swapping using temporary or third variable

import java.util.Scanner;
 
class SwapNumbers
{
   public static void main(String args[])
   {
      int x, y, temp;
      System.out.println("Enter x and y");
      Scanner in = new Scanner(System.in);
 
      x = in.nextInt();
      y = in.nextInt();
 
      System.out.println("Before Swapping\nx = "+x+"\ny = "+y);
 
      temp = x;
      x = y;
      y = temp;
 
      System.out.println("After Swapping\nx = "+x+"\ny = "+y);
   }
}

Swap numbers program class file.

Output of program:
swap numbers

Swapping without temporary variable

import java.util.Scanner;
 
class SwapNumbers
{
   public static void main(String args[])
   {
      int x, y;
      System.out.println("Enter x and y");
      Scanner in = new Scanner(System.in);
 
      x = in.nextInt();
      y = in.nextInt();
 
      System.out.println("Before Swapping\nx = "+x+"\ny = "+y);
 
      x = x + y;
      y = x - y;
      x = x - y;
 
      System.out.println("After Swapping\nx = "+x+"\ny = "+y);
   }
}
#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

{ 0 comments }

java program to count number of unique words separated by comma (,) or newline and their occurrence from text file.

package programs;

import java.util.*;
import java.io.*;

public class uniquewrdsoccurence {

private String[] spliter;
private int[] count;
public void countWord(String Text) {

String temp1 = Text.replaceAll(“[\\n]“, ” “);
String temp = temp1.replaceAll(“,”, ” “);
spliter = temp.replaceAll(“[.?!:;/]“, “”).split(” “);
count = new int[spliter.length];
for (int i = 0; i < spliter.length; i++) {
temp = spliter[i];
for (int k = 0; k < spliter.length; k++) {
if (temp.equalsIgnoreCase(spliter[k])) {
count[k]++;
}
}
}

printResult();
}

private void printResult() {

HashMap map = new HashMap();
int counter = 0;for (int i = 0; i < spliter.length; i++) {
map.put(spliter[i].toLowerCase(), count[i]);
}

Iterator it = map.keySet().iterator();

System.out.println(“Words             Count”);
System.out.println(“#######################”);
while (it.hasNext()) {
counter++;

String temp = (String) it.next();

// prints the word 
System.out.print(temp);

// prints the spaces
for (int i = 0; i < (20 – temp.length()); i++) {
System.out.print(” “);
}

// print the value -total count
System.out.println(map.get(temp.toString()));

}
System.out.println(“#######################”);
System.out.println(“Number of unique words in file:” + counter);
}

// main method 
public static void main(String[] arg) {
String pattern = “”;
String str = null;

try {
FileInputStream filestream = new FileInputStream(
System.getProperty(“user.dir”) + “\\words.txt”);
DataInputStream datastream = new DataInputStream(filestream);
BufferedReader Br = new BufferedReader(new InputStreamReader(datastream));
while ((str = Br.readLine()) != null) {
pattern = pattern.concat(str);
pattern = pattern.concat(” “);
}
datastream.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
uniquewrdsoccurence wco = new uniquewrdsoccurence();
wco.countWord(pattern);
}

}

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

{ 0 comments }

5 Steps to connect to the database in java

by admin on September 3, 2014

There are 5 steps to connect any java application with the database in java using JDBC. They are as follows:

  • Register the driver class
  • Creating connection
  • Creating statement
  • Executing queries
  • Closing connection

1) Register the driver class

The forName() method of Class class is used to register the driver class. This method is used to dynamically load the driver class.

Syntax of forName() method

  1. public static void forName(String className)throws ClassNotFoundException

Example to register the OracleDriver class

  1. Class.forName(“oracle.jdbc.driver.OracleDriver”);

2) Create the connection object

The getConnection() method of DriverManager class is used to establish connection with the database.

Syntax of getConnection() method

  1. 1public static Connection getConnection(String url)throws SQLException
  2. 2public static Connection getConnection(String url,String name,String password)
  3. throws SQLException

Example to establish connection with the Oracle database

  1. Connection con=DriverManager.getConnection(
  2. “jdbc:oracle:thin:@localhost:1521:xe”,“system”,“password”);

3) Create the Statement object

The createStatement() method of Connection interface is used to create statement. The object of statement is responsible to execute queries with the database.

Syntax of createStatement() method

  1. public Statement createStatement()throws SQLException

Example to create the statement object

  1. Statement stmt=con.createStatement();

4) Execute the query

The executeQuery() method of Statement interface is used to execute queries to the database. This method returns the object of ResultSet that can be used to get all the records of a table.

Syntax of executeQuery() method

  1. public ResultSet executeQuery(String sql)throws SQLException

Example to execute query

  1. ResultSet rs=stmt.executeQuery(“select * from emp”);
  2. while(rs.next()){
  3. System.out.println(rs.getInt(1)+” “+rs.getString(2));
  4. }

5) Close the connection object

By closing connection object statement and ResultSet will be closed automatically. The close() method of Connection interface is used to close the connection.

Syntax of close() method

  1. public void close()throws SQLException

Example to close connection

  1. con.close();
#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

{ 0 comments }

Differences between Soap vs. Rest

by admin on September 3, 2014

Differences between Soap vs. Rest

  • SOAP stands for Simple Object Access Protocol. REST stands for REpresentational State Transfer.
  • SOAP is a XML based messaging protocol and REST is not a protocol but an architectural style.
  • SOAP has a standard specification but there is none for REST.
  • Whole of the web works based on REST style architecture. Consider a shared resource repository and consumers access the resources.
  • Even SOAP based web services can be implemented in RESTful style. REST is a concept that does not tie with any protocols.
  • SOAP is distributed computing style and REST is web style (web is also a distributed computing model).
  • REST messages should be self-contained and should help consumer in controlling the interaction between provider and consumer(example, links in message to decide the next course of action). But SOAP doesn’t has any such requirements.
  • REST does not enforces message format as XML or JSON or etc. But SOAP is XML based message protocol.
  • REST follows stateless model. SOAP has specifications for stateful implementation as well.
  • SOAP is strongly typed, has strict specification for every part of implementation. But REST gives the concept and less restrictive about the implementation.
  • Therefore REST based implementation is simple compared to SOAP and consumer understanding.
  • SOAP uses interfaces and named operations to expose business logic. REST uses (generally) URI and methods like (GET, PUT, POST, DELETE) to expose resources.
  • SOAP has a set of standard specifications. WS-Security is the specification for security in the implementation. It is a detailed standard providing rules for security in application implementation. Like this we have separate specifications for messaging, transactions, etc. Unlike SOAP, REST does not has dedicated concepts for each of these. REST predominantly relies on HTTPS.
  • Above all both SOAP and REST depends on design and implementation of the application.

 

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

{ 0 comments }

TestNG lets you pass parameters directly to your test methods in two different ways:

  • With testng.xml
  • With Data Providers

Passing Parameters with testng.xml

With this technique, you define the simple parameters in the testng.xml file and then reference those parameters in source files. Let us see an example below on how to use this technique to pass parameters.

CREATE TEST CASE CLASS

  • Create a java test class say ParameterizedTest1.java.
  • Add test method parameterTest() to your test class. This method takes a String as input parameter.
  • Add the annotation @Parameters(“myName”) to this method. The parameter would be passed a values from testng.xml which we will see in the next step.

Create the java class file name ParameterizedTest1.java in C:\ > TestNG_WORKSPACE

import org.testng.annotations.Parameters;import org.testng.annotations.Test;publicclassParameterizedTest1{@Test@Parameters("myName")publicvoid parameterTest(String myName){System.out.println("Parameterized value is : "+ myName);}}

CREATE TESTNG.XML

Create a testng.xml C:\ > TestNG_WORKSPACE to execute Test case(s).

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" ><suitename="Suite1"><testname="test1"><parametername="myName"value="manisha"/><classes><classname="ParameterizedTest1"/></classes></test></suite>

We can also define the parameters at the <suite> level. Suppose we have defined myName at both <suite> and <test> levels then, in such cases regular scoping rules apply. This means that any class inside <test> tag will see the value of parameter defined in <test>, while the classes in the rest of the testng.xml file will see the value defined in <suite>.

Compile the Test case class using javac.

C:\TestNG_WORKSPACE>javac ParameterizedTest1.java

Now, run the testng.xml, which will run the parameterTest method. TestNG will try to find a parameter named myName first in the <test> tag, and then, if it can’t find it, it searches in the <suit> tag that encloses it.

C:\TestNG_WORKSPACE>java -cp "C:\TestNG_WORKSPACE" org.testng.TestNG testng.xml

Verify the output.

Parameterized value is : manisha

===============================================
Suite1
Total tests run: 1, Failures: 0, Skips: 0
===============================================

TestNG will automatically try to convert the value specified in testng.xml to the type of your parameter. Here are the types supported:

  • String
  • int/Integer
  • boolean/Boolean
  • byte/Byte
  • char/Character
  • double/Double
  • float/Float
  • long/Long
  • short/Short

Passing Parameters with Dataproviders

When you need to pass complex parameters or parameters that need to be created from Java (complex objects, objects read from a property file or a database, etc…), in such cases parameters can be passed using Dataproviders. A Data Provider is a method annotated with @DataProvider. This annotation has only one string attribute: its name. If the name is not supplied, the Data Provider’s name automatically defaults to the method’s name. A Data Provider returns an array of objects.

Let us check out examples below of using Dataproviders. The first example is about @DataProvider using Vector, String or Integer as parameter and the second example is about @DataProvider using object as parameter.

EXAMPLE 1

Here, the @DataProvider passes Integer and Boolean as parameter.

CREATE JAVA CLASS

Create a java class PrimeNumberChecker.java. This class checks if the number is prime. Create this class in C:\ > TestNG_WORKSPACE

publicclassPrimeNumberChecker{publicBoolean validate(finalInteger primeNumber){for(int i =2; i <(primeNumber /2); i++){if(primeNumber % i ==0){returnfalse;}}returntrue;}}

CREATE TEST CASE CLASS

  • Create a java test class say ParamTestWithDataProvider1.java.
  • Define the method primeNumbers() which is defined as a Dataprovider using the annotation. This method returns array of object array.
  • Add test method testPrimeNumberChecker() to your test class. This method takes a Integer and Boolean as input parameters. This method validates if the parameter passed is a prime number.
  • Add the annotation @Test(dataProvider = “test1″) to this method. The attribute dataProvider is mapped to “test1″.

Create the java class file name ParamTestWithDataProvider1.java in C:\ > TestNG_WORKSPACE

import org.testng.Assert;import org.testng.annotations.BeforeMethod;import org.testng.annotations.DataProvider;import org.testng.annotations.Test;publicclassParamTestWithDataProvider1{privatePrimeNumberChecker primeNumberChecker;@BeforeMethodpublicvoid initialize(){
        primeNumberChecker =newPrimeNumberChecker();}@DataProvider(name ="test1")publicstaticObject[][] primeNumbers(){returnnewObject[][]{{2,true},{6,false},{19,true},{22,false},{23,true}};}// This test will run 4 times since we have 5 parameters defined@Test(dataProvider ="test1")publicvoid testPrimeNumberChecker(Integer inputNumber,Boolean expectedResult){System.out.println(inputNumber +" "+ expectedResult);Assert.assertEquals(expectedResult,
        	primeNumberChecker.validate(inputNumber));}}

CREATE TESTNG.XML

Create a testng.xml C:\ > TestNG_WORKSPACE to execute Test case(s).

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" ><suitename="Suite1"><testname="test1"><classes><classname="ParamTestWithDataProvider1"/></classes></test></suite>

Compile the Test case class using javac.

C:\TestNG_WORKSPACE>.javac ParamTestWithDataProvider1.java PrimeNumberChecker.java

Now, run the testng.xml.

C:\TestNG_WORKSPACE>java -cp "C:\TestNG_WORKSPACE" org.testng.TestNG testng.xml

Verify the output.

2 true
6 false
19 true
22 false
23 true

===============================================
Suite1
Total tests run: 5, Failures: 0, Skips: 0
===============================================

EXAMPLE 2

Here, the @DataProvider passes Object as parameter.

CREATE JAVA CLASS

Create a java class Bean.java, which is simple object with get/set methods, in C:\ > TestNG_WORKSPACE.

publicclassBean{privateString val;privateint i;publicBean(String val,int i){this.val=val;this.i=i;}publicString getVal(){return val;}publicvoid setVal(String val){this.val = val;}publicint getI(){return i;}publicvoid setI(int i){this.i = i;}}

CREATE TEST CASE CLASS

  • Create a java test class say ParamTestWithDataProvider2.java.
  • Define the method primeNumbers() which is defined as a Dataprovider using the annotation. This method returns array of object array.
  • Add test method testMethod() to your test class. This method takes object bean as parameter.
  • Add the annotation @Test(dataProvider = “test1″) to this method. The attribute dataProvider is mapped to “test1″.

Create the java class file name ParamTestWithDataProvider2.java in C:\ > TestNG_WORKSPACE

import org.testng.annotations.DataProvider;import org.testng.annotations.Test;publicclassParamTestWithDataProvider2{@DataProvider(name ="test1")publicstaticObject[][] primeNumbers(){returnnewObject[][]{{newBean("hi I am the bean",111)}};}@Test(dataProvider ="test1")publicvoid testMethod(Bean myBean){System.out.println(myBean.getVal()+" "+ myBean.getI());}}

CREATE TESTNG.XML

Create a testng.xml C:\ > TestNG_WORKSPACE to execute Test case(s).

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" ><suitename="Suite1"><testname="test1"><classes><classname="ParamTestWithDataProvider2"/></classes></test></suite>

Compile the Test case class using javac.

C:\TestNG_WORKSPACE>javac ParamTestWithDataProvider2.java Bean.java

Now, run the testng.xml.

C:\TestNG_WORKSPACE>java -cp "C:\TestNG_WORKSPACE" org.testng.TestNG testng.xml

Verify the output.

hi I am the bean 111

===============================================
Suite1
Total tests run: 1, Failures: 0, Skips: 0
===============================================
#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

{ 0 comments }

Write a program to program print prime numbers

by admin on September 3, 2014

Java programming code

import java.util.*;
 
class PrimeNumbers
{
   public static void main(String args[])
   {
      int n, status = 1, num = 3;
 
      Scanner in = new Scanner(System.in);
      System.out.println("Enter the number of prime numbers you want");
      n = in.nextInt();
 
      if (n >= 1)
      {
         System.out.println("First "+n+" prime numbers are :-");
         System.out.println(2);
      }
 
      for ( int count = 2 ; count <=n ;  )
      {
         for ( int j = 2 ; j <= Math.sqrt(num) ; j++ )
         {
            if ( num%j == 0 )
            {
               status = 0;
               break;
            }
         }
         if ( status != 0 )
         {
            System.out.println(num);
            count++;
         }
         status = 1;
         num++;
      }         
   }
}

Download Prime numbers program class file.

Output of program:
prime numbers

We have used sqrt method of Math package which find square root of a number. To check if an integer(say n) is prime you can check if it is divisible by any integer from 2 to (n-1) or check from 2 to sqrt(n), first one is less efficient and will take more time.

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

{ 0 comments }

Learn Mobile Testing by SQA Solution

by admin on August 28, 2014

mobile

If you are just starting on your journey into the rapidly growing area of mobile application or website testing it can seem a daunting prospect. While many existing testing skills are transferable, there is a lot of new information and knowledge to learn and a lot of pitfalls to avoid. In this course you will pick up useful hints and tips, learnt from within the industry, on areas such as:

  • How software testing for mobile devices differs from the desktop world.
  • Understanding your mobile user.
  • How to form a successful mobile testing strategy.
  • How the mobile industry and technology impacts software testing.
  • Hints and tips on both manual and automated techniques.

This practical, hands-on, course will benefit not only those who are starting to test mobile, but also those that have been testing for a while, and want to improve their skills and learn more. You probably know how to use a mobile device so come along and learn how to test one!

Prerequisites

  • Please bring a mobile device, preferably a smartphone. OS is not important, in fact the more variety the better.

Syllabus

  • What is mobile and why test on mobile?
  • The mobile consumer and mobile landscape.
  • Testing on mobile:
    • The similarities and differences to desktop.
    • Functional mobile testing.
    • Mobile payment and e-commerce.
    • UI, Gestures and Interactions.
  • Exercise – The Differences Between Devices and OS’s.
  • The Specifics of Mobile Testing:
    • Sapient vs. Automated.
    • UX Challenges and testing impact.
    • Non-functional testing and the extra’s to consider for mobile.
    • Mobile Networks and how they affect testing.
    • Submission to Apps Stores.
  • Exercise - Mind-mapping a mobile application.
  • Mobile test strategy:
    • Choosing your devices.
    • OS’s and Applications.
    • Understanding the customer and how they use mobile.
    • Targeting your mobile testing.
    • Getting out of the office.
  • Exercise – Real life testing challenge

 

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

{ 0 comments }