July 28, 2020

Principles of Software testing



Seven Principles of Software testing-


1. Testing shows the presence of bugs.


2. Exhaustive testing is impossible. Unless the software under test has a very small logic, it is not possible to test all the combinations of input values(Permutations and Combinations)


3. Early testing: The testing should be started at an early stage so that enough time is available for testing.


4. Defect Clustering: It is seen that most of the bugs in a software are found in a small number of modules .i.e. 80% of the bugs are found in 20% of the modules.


5. The pesticide paradox: If we keep running the same set of tests over and over again, chances are that no new defects will be discovered by those test cases s the regression test has to keep changing too to accommodate the change in software. Test cases need to be regularly revised and reviewed.


6. Testing is context dependent: The amount of testing done depends on the criticality of the product. i.e. a critical product requires more rigorous testing.


7. Absence of errors fallacy: If no defect is found in software, it does not mean that the software is perfect and ready to be shipped.

Equivalent Partitioning (Black Box Testing Type)



What is Equivalent partitioning?

Equivalent partitioning is the process of classifying all the test cases into classes an to pick one test value from each class while testing. It is used to reduce the number of test cases to a limited set such that all input and output values are covered.
For Example: If a given input box attends only numbers from 1 to 100, there is no point is trying out all the values. You can classify the input into 5 cases.
1. A value at the lesser than the lower boundary Ex: -1 etc
2. A value equal to the lesser boundary i.e. 1
3. A value in between 1 and 100
4. A value equal to higher boundary i.e. 100
5. A value greater than the higher boundary , i.e. 101

July 19, 2020

Selenium Wait


Why do users need Selenium Wait?

Most web applications are developed with Ajax and Javascript. When a page loads on a browser, the various web elements that someone wants to interact with may load at various time intervals.

This obviously creates difficulty in identifying any element. On top of that, if an element is not located then the “ElementNotVisibleException” appears. Selenium Wait commands help resolve this issue.

Selenium WebDriver provides three commands to implement wait in tests.

Implicit Wait

Explicit Wait

Fluent Wait



1.Implicit Wait in Selenium

Implicit wait is applied globally on all web elements .

Implicit Wait directs the Selenium WebDriver to wait for a certain measure of time before throwing an exception. Once this time is set, WebDriver will wait for the element before the exception occurs.

Once the command is in place, Implicit Wait stays in place for the entire duration for which the browser is open. Its default setting is 0, and the specific wait time needs to be set by the following protocol.



Driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);



2.Explicit Wait in Selenium

By using Explicit Wait command, the WebDriver is directed to wait until a certain condition occurs before proceeding with executing the code.

Setting Explicit Wait is important in cases where there are certain elements that naturally take more time to load. If one sets an implicit wait command, then the browser will wait for the same time frame before loading every web element. This causes an unnecessary delay in executing the test script.

Explicit wait is more intelligent, but can only be applied for specified elements


WebDriverWait wait = new WebDriverWait(driver,20);

Element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath());


In order to declare explicit wait, one has to use “ExpectedConditions”. The following Expected Conditions can be used in Explicit Wait.

alertIsPresent()

elementSelectionStateToBe()

elementToBeClickable()

elementToBeSelected()

frameToBeAvaliableAndSwitchToIt()

invisibilityOfTheElementLocated()

invisibilityOfElementWithText()

presenceOfAllElementsLocatedBy()

presenceOfElementLocated()

textToBePresentInElement()

textToBePresentInElementLocated()

textToBePresentInElementValue()

titleIs()

titleContains()

visibilityOf()

visibilityOfAllElements()

visibilityOfAllElementsLocatedBy()

visibilityOfElementLocated()

3.Fluent Wait in Selenium


The Fluent Wait command defines the maximum amount of time for Selenium WebDriver to wait for a certain condition to appear. It also defines the frequency with which WebDriver will check if the condition appears before throwing the “ElementNotVisibleException”.

To put it simply, Fluent Wait looks for a web element repeatedly at regular intervals until timeout happens or until the object is found.

Fluent Wait commands are most useful when interacting with web elements that can sometimes take more time than usual to load. This is largely something that occurs in Ajax applications.

While using Fluent Wait, it is possible to set a default polling period as needed. The user can configure the wait to ignore any exceptions during the polling period.

Wait wait = new FluentWait(WebDriver reference)

.withTimeout(timeout, SECONDS)

.pollingEvery(timeout, SECONDS)

.ignoring(Exception.class);

Selenium Framework



Selenium Framework:

Selenium Framework is a code structure that helps to make code maintenance easy. Without frameworks, we will place the “code” as well as “data” in the same place which is neither re-usable nor readable. Using Frameworks, produce beneficial outcomes like increased code re-usage, higher portability, reduced script maintenance cost, higher code readability, etc.

There are mainly three types of frameworks created by Selenium WebDriver to automate manual test cases:

· Data-Driven Test Framework

· Keyword Driven Test Framework

· Hybrid Test Framework


Data-Driven Test Framework:

In the data-driven framework, all of our test data is generated from some external files like Excel, CSV, XML or some database table.

To read or write an Excel, Apache provides a very famous library POI. This library is capable enough to read and write both XLS and XLSX file format of Excel.


Keyword Driven Test Framework:

In the keyword-driven test framework, all the operations and instructions are Keyword Driven Framework is a type of Functional Automation Testing Framework which is also known as Table-Driven testing or Action Word based testing. The basic working of the Keyword Driven Framework is to divide the Test Case into four different parts. First is called as Test Step, second is Object of Test Step, third is Action on Test Object and fourth is Data for Test Object.

The above categorization can be done and maintained with the help of Excel spreadsheet:

Test Step: It is a very small description of the Test Step or the description of the Action going to perform on Test Object.
Test Object: It is the name of the Web Page object/element, like Username & Password.
Action: It is the name of the action, which is going to perform on any Object such as click, open browser, input etc.
Test Data: Data can be any value which is needed by the Object to perform any action, like Username value for Username field.



Hybrid Test Framework

Hybrid Test framework is a concept where we are using the advantage of both Keyword and Data-driven framework.

Here for keywords, we will use Excel files to maintain test cases, and for test data, we can use data, provider of TestNG framework.









Key concepts in Pipeline

 1. Agent- To build your code or deploy your software using azure pipelines, you need at least one agent. Two types of agent- Microsoft host...