We all know, designing a framework is a tedious task. So, this time I came up with an article on new framework RedwoodHQ, a Tester friendly with many built-in features and allows you to automate and manage your tests very quick.
What is RedwoodHQ?
An Open source framework which supports Selenium, Appium and allows multiple users to design test cases and develop test scripts which can be written in a ubiquitous language and also allows you to execute them all using a friendly Web interface.
RedwoodHQ supports Java/Groovy, Python and C#.
Why should I use RedwoodHQ Framework?
Using this framework, a non-tech guy can automate using the keywords available while designing the test case itself. We don’t need any IDE to configure. I guess this can be used for Bigger and Smaller projects as well.
TestNG allows us to group several tests together. You can group certain tests based on what behavior/aspect they are actually testing. You may have a scenario where few tests belong to a certain group(say Regression) and other ones belong to other group(say Sanity) and yet another one belong to other group(say Login). With this approach you may decide to execute only certain group of test and skip other ones(let’s say there was a regression on related code, so we prefer to only execute Sanity related tests).The group test is a new innovative feature in TestNG, it doesn’t exist in Junit framework
Cross Browser Testing : Is to check that your web application works as expected in different browsers.If we are using Selenium WebDriver, we can automate test cases using Internet Explorer, FireFox, Chrome, Safari browsers.To execute test cases with different browsers in the same machine at same time we can integrate TestNG with Selenium WebDriver.
Lets execute your testcases using testng.xml. This is really helpful when you would like to execute only desired testcases,browser compatibility / parallel testing.
Create a java class file name Testng.java
A TestNG testsuite comprises of number of tests. A TestNG ‘test’ comprises of one or more classes, and a TestNG class consists of multiple ‘Test Methods’.
Here i’m sharing a sample code for the following testcases.
Testcase 1 : Verifying Sign-On link
Testcase 2 : Get the source code
TestNG is an open source automated testing framework. TestNG is similar to JUnit but it is much more powerful than JUnit with advanced annotations.
Advantages of TestNG :
Test cases can be Grouped & Prioritized more easily.
If you want to provide the test data, the DataProvider way, then we need to declare a method that returns the data set in the form of two dimensional object array Object. The first array represents a data set whereas the second array contains the parameter values.
The @Test method that wants to receive data from this DataProvider needs to use a dataProvider name equals to the name of this annotation.
There are many ways to Generate Reports in Selenium. Now I’d like to generate an excel reports. This report will give you the number test cases has been Passed and Failed or Skipped. It’s quite simple to generate this report. All you need to do is just giving a Proper Name and Destination Path (if you’re using the latest jar 4.0.1).
Note: TestNG is required. Without testNG this code won’t work.
There are few steps to be followed to generate Excel Reports. Here I am sharing the snippet.
There always a problem to find the broken links/Images present in the application.This post helps you to find the Broken links.And it captures all the valid links and invalid links in an Excel Sheet
Here i am using java.net.HttpURLConnection.This can be done in many ways too,This code can be used for any project though.