Monday, May 12, 2014

Complete testing of log in , Big picture !

Cracking an interview is not a Rocket Science to be frank , but yes for some it could be :D

Lets talk in general , what is the expectation of an interviewer from an interviewee. Interviewer just want the best answer which is unique and different from the rest of the world. Err...What does that mean ?

For each answer there should be an approach which a tester should mention while answering any question. And that is Always Start With Positive approach .!! Be it writing test cases , or reading requirements , executing test cases , thinking of a scenario in testing ,etc

Lets discuss how can we take an approach of writing test cases with an example which is asked in almost all QA - interviews.

How to design test cases for Log-in functionality..?
This is easy .. no ?
Lets try to think in a broader and better way.
Start with open questions :

  1. Why , on earth , user needs to Log into any system ?
  2. Why he would go for log in if:.. he is new to web ?
  3. What he will miss if he does not log into the system ?
  4. Why log is required to anyone ?
  5. What all process he has to go through if he opts for logging in?
  6. What is the process to log into system?
  7. What all credentials are required to get into the system ?
  8. What all basic information check is required to authenticate a user?
Now go more into depth and think more about the architecture as in how MVC will work in this case as Log in is all- web based and service oriented process. So try applying Service Oriented Architecture Concepts:
  1. How service oriented tests can be applied on log in.
  2. How session will be maintained when user log into system.
  3. How session will be maintained when user log out from system.
  4. How session will be maintained when user switch logging in and out from system.
  5. How system will behave when user opens a new tab , after logging into the system.
  6. What kind of response is expected when submit button is hit by system.
What all testing approach you can apply, try thinking as much as you can and categorize your test cases:
Boundary values:
  1. Check length of user name
  2. Check length of password

Equivalent partition
Create a group of test cases including positive cases
  • Enter the correct user-id and password and click on submit button
  • It should display welcome page
and negative cases:
  • Enter the correct user-id and wrong password and click on Submit button
  • It should display error
  • Enter the wrong user-id and correct password and click on Submit button
  • It should display error


Compatibility Testing
  • Check application should work on different Operating systems.
  • Check application should work on different browsers.

Comparison Testing
  • Check application should work on different resolutions.

Usability Testing
  • Check the auto focus of mouse
  • Mouse auto focus should be at UserId
  • Check the password with Lower case and upper case
  • Password should be case sensitive
  • Check the auto focus of mouse
  • Mouse auto focus should be at UserId
Security Testing
  • After login with valid credentials, click on back button
  • The page should be expired
  • After login with valid credentials copy the url and paste in another browser
  • It should not display the user's welcome page
  • Check the password with Lower case and upper case
  • Password should be case sensitive
And others could be :

  • Integration Testing
  • Functional Testing
  • End-to-end Testing
  • Performance Testing
  • Unit testing

There is still lot to test , and testing is a never ending process. So , all I can say Think more , Think Big ,Think Better !!

Thursday, May 8, 2014

Oracle SOA : java.lang.NoClassDefFoundError: Could not initialize class org.apache.myfaces.trinidadinternal.convert.ColorConverter

In Oracle SOA 11g (11.1.1.7.0) when you try to access the oracle worklist application or custom created worklist application to access the Human workflow tasks you get the following error:

java.lang.NoClassDefFoundError: Could not initialize class org.apache.myfaces.trinidadinternal.convert.ColorConverter
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
Truncated. see log file for complete stacktrace

java.lang.UnsatisfiedLinkError: Can't load library: /app1/oracle/middleware/Oracle_SOA1/soa/thirdparty/edifecs/XEngine/bin/headless/libmawt.so
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1706)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1003)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
Truncated. see log file for complete stacktrace

This is due to the missing "libmawt.so" in /soa/app/Oracle/product/fmw/Oracle_SOA1/soa/thirdparty/edifecs/XEngine/bin/headless

Solution:

Copy the libmawt.so library file from the JRockit installation directory (normally found in /lib/headless/) to the following directory:
%Middleware_HOME%/Oracle_SOA1/soa/thirdparty/edifecs/XEngine/bin/headless/

Note: Please refer document (Doc ID 1633015.1) on oracle support for further information.

Monday, May 5, 2014

Oracle SAP Adapter : ERROR com.ibi.bse.ConfigWorker:java.lang.NoClassDefFoundError: oracle/tip/adapter/api/exception/PCResourceException

I was working on a SAP integration with Oracle SOA Suite, configuring the Oracle Application Adapter for SOA. Then after starting the ae.cmd ( E:\Oracle\Middleware\Oracle_SOA1\soa\thirdparty\ApplicationAdapters\tools\iwae\bin\ae.cmd ) I am getting the following exception:

ERROR com.ibi.bse.ConfigWorker:java.lang.NoClassDefFoundError: oracle/tip/adapter/api/exception/PCResourceException

This is due to the missing libraries i.e jca-binding-api.jar and adapter_xbeans.jar

Solution:

  1. Copy the missing libraries i.e. jca-binding-api.jar and adapter_xbeans.jar from the location "E:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.adapter_11.1.1"
  2. Paste the copied files into the folder i.e. "E:\Oracle\Middleware\Oracle_SOA1\soa\thirdparty\ApplicationAdapters\lib"

Monday, April 28, 2014

Test 'me' ..err cookies are not that complex to test with Selenium.

If we talk in simple terms Cookies are some thing which parents always teach their child 'Not to have'.
And same applies to some web sites .They can make life tougher of user when cookies are hiding in the web pages and no one can understand 'what the heck is making my web page to react so weird!!!'

Let me first start why cookies are required and why/ when are not required. There are several types of cookies (of course not chocolate , strawberry , butter ,etc ) which can comes and lives on the web.
For an example, if I want to log into a system and want to stay in the system for ever until I explicitly log out from it , then to maintain this session go live I always requires some sort of cookies which will make this happen for me. This you can count as an advantage , with out a doubt !
But what about this , when I am working on a web page and trying to search for some one and it will navigate me to some stranger's profile which has no connection with the name i searched for . It is all about the game which cookies does for us :)
Without a doubt such behaviour will cause multiple issues when we talk in terms of automation.
Lets talk more in terms of selenium , how we can get rid of extra unwanted cookies from web page which are not required at all while executing test cases.
Ofcourse there are some manual actions which we can do to remove cookies from browser but yeah its a tedious task and then it will not add any value to our test automation framework.
We can start making a new maven project (following the concepts of Page Object model) and make a class in such format:

Now make a class which can test cookies in the application you are testing, or any sample application like http://www.compendiumdev.co.uk/selenium/search.php.
Now all you need to do is some basic set up require to make your application interact with selenium server.
You will require Junit to write test cases and class as a template to write test cases.
Start with instantiating the driver:
@BeforeClass
public static void startChrome() {
driver = new FirefoxDriver();
}
 
@AfterClass
public static void closeFireFox() {
driver.quit();
}
Now you need to open the application such that it will navigate user to the required URL. For this you need a method :
@Before
public void openTestURL() {
driver.navigate().to(testURL); // navigate to URl which is required.

And then what you need to do is to wait for page to get load and then delete all cookies which will come on run time on this web page

wait = new WebDriverWait(driver, 10); //Implicit wait appiled to driver
driver.manage().deleteAllCookies();// delete all cookies which is in browser for fresh start

Thats not all , what if the page has more cookies ?
For this you need to make a set of all such cookies and remove them like this :
@Test
public void searchAndCheckForCookies() {
queryBox = driver.findElement(By.cssSelector("input[title='Search']"));
queryButton = driver.findElement(By.name("btnG"));
queryBox.clear();
queryBox.sendKeys("monkey buns");
queryButton.click();

Set<Cookie> cookies = driver.manage().getCookies();
for (Cookie aCookie : cookies) {
if (aCookie.getName().contentEquals(
"seleniumSimplifiedSearchNumVisits")) {
assertEquals("should be my first visit", "1",
aCookie.getValue());
}
if (aCookie.getName().contentEquals(
"seleniumSimplifiedSearchLastSearch")) {
assertEquals("should equal 'monkey buns'", "monkey buns",
aCookie.getValue());
}
}
}

And if you want to remove any specific cookie/s from the web page then you can use this method :

@Test
public void getOneSpecificCookie() {
queryBox.clear();
queryBox.sendKeys("monkey buns");
queryButton.click();
refreshPageObjects();
queryBox.clear();
queryBox.sendKeys("testing 123");
queryButton.click();

Cookie cookie = driver.manage().getCookieNamed(
"seleniumSimplifiedLastSearch");
// %20 is a space in the raw data that is returned
assertEquals("should equal 'testing 123'", "testing%20123",
cookie.getValue());
}
}


Lets do Fitnium together!

In my last post on fitnium , I have described all the basic needs which one need to know when he/she is starting or even thinking to work on fitnium.
Those are some very basic concepts which user should know before getting into the technicalities of the tool.
So as of now , we know why and when to use fitnium and along with this the base tools which fitnium uses in the backend while executing the test cases.
Lets start with how we can start working with this weapon of testing.
Fitnium is a free tool and can be downloaded from the fitnium website (Source http://www.fitnesse.org/ ).
It is a simple , very easy-to-use tool on which you can start writing test cases if you have some basic knowledge of any one the popular programming languages like Java, Ruby , etc.
It requires a sinlge click download to start working on fitnium , you can download the jar from http://sourceforge.net/projects/fitnium/files/latest/download
. Once its downloaded at your local all you need to do is to extract this rar file into a folder.
You will get a structure like this :

Here you can get 2 executables , one is fitnium librarry having all libraries fitnium requires to run test suites and cases. The other jar is the one which will be of more importance , all we need is to execute this jar. Like this:
java -jar fitnesse.jar
It will give some obvious problems like :

As generally in local systems everything by default works on 8080 port , so no two person can sit on one seat . Hence system will complain and ask for some new port, You can simply change the port to some other port by using -p command :

Once this is done , you can see awesome UI on your local system and can explore new things . UI will looks like this :

Will continue how we can write our test scripts in next blog, till then stay tuned :)


Thursday, April 24, 2014

They say "How about the architectural difference between Selenium versions"

I have seen many people asking a repetitive question in interviews if they see Selenium written on any Curriculum Vitae of a Test Engineer. Though I believe theoretical and conceptual knowledge is equally important as hand-on experience. As a part of hiring panel I have observed this as a pet question of our hiring team : 'How about the architectural difference between Selenium versions.' Of-course , once they are done with questions like 'What you know all about selenium' ?
Selenium generally comes in four different flavours :
Selenium IDE , Selenium RC , Selenium Grid and Selenium Webdriver.
I will be sharing the best answer I got and the research which I did so as to understand the architecture of selenium.

Selenium Remote Control:
Selenium RC or Selenium 1 is the first version of Selenium which is equally efficient as Selenium Webdriver. But there is a difference in architecture which both has. Along with a fact that selenium RC requires a server jar start-up every-time user wants to execute test cases/suite. This is just a one time effort which is required only in selenium RC , unlike Selenium Webdriver.

Selenium RC works on the principle of client - server . The client sends the request ( in Programming languages like Java , Python ,etc ) to the Server . The requests are in the form of commands like click , select , wait , etc.

And here Server takes the responsibility of granting the request to the Web browser. As we know Selenium is a Web Automation tool so the job will complete only when browser is able to respond on the requests which client is asking for.
At browser the Selenium core is residing which actually performs Java Script injections and hence-forth requests get executed.

RC-Selenium.PNG


Selenium Webdriver:

There are some differences which user can observe while working with Selenium Webdriver or if user is switching from Selenium RC to Selenium Webdriver.
First of all , it does not need any over-head like server start up etc.
If we talk about architecture then the major difference is Selenium Webdriver API is responsible for storing all commands and conversion of the commands in JSON format. The flow is Client sends the request in a Programming language and sends the command to the selenium Webdriver. This request is then send to the Selenium API where-in Selenium API restores the commands in the JSON format and send the request from the JSon format to the http, RESTful service. This conversion happens on the browser level where-in all the commands will work. Commands like select , click , etc which will be placed in the test suite and test case.


Webdriver-Selenium.PNG

Selenium Grid:
Selenium Grid is used majorly when user wants to run test cases parallely at the same time on same browser or on different browsers .

Here , There would be a selenium grid -hub where selenium server needs to be running and up all the time. All other machines which connects this machine will work as a client as this hub will work as a server to all the clients. Client will send the request to the server - hub and hub is responsible to cater all requests and respond on the all requests which are coming from the clients.




Happy testing ! :)

Caused by: java.lang.NoClassDefFoundError: javax.wsdl.Definition

Exception : Caused by: java.lang.NoClassDefFoundError: javax.wsdl.Definition

Reason : This exception occur while accessing  SOAP client in java application from jdeveloper, and it is due to the missing orawsdl.jar.

Workaround :  Add the jar file to the project classpath. you can find this jar file at

%JDEV_HOME%\oracle_common\modules\oracle.webservices_11.1.1\orawsdl.jar

Also add this jar in the deployment profile.