D1 of 30 Days' ISTQB : Why is Testing Necessary?

1.1  Why is Testing Necessary?


1.1.1 Software Systems Context
Software systems are an integral part of life, from business applications(e.g. banking)to consumers(e.g. cars). Most people have had an experience with software that did not work as expected. Software that does not work correctly can lead to many problems, including loss of money, time or business reputation, and even cause injury or death.

1.1.2  Causes of software Defects
A human being can make an error(mistake), which produces a defect(fualt, bug) in the program code, or in a document. If a defect in code is executed, the system may fail to do what it should do (or do something it shouldn't),causing a failure. Defects in software, systems or documents may result in failures, but not all defects do so.

Defects occur because  human beings are fallible and because there is time pressure,complex code, complexity of infrastruture, changing technologies, any/or many system interactions.

Failure can be caused by environmental conditions as well. For exsample,radiation, magnetism, electronic fields, and pollution can cause faults in firmware or influence the execution of sftware by changing the hardware conditions.

1.1.3  Role of Testing in Software Development, Maintenance and Operations
Rigorous testing in systems and documentation can help to reduce the risk of problems occuring during operation and contribute to the quality of the software system, if the defects found are corrected before the system is released for operational use.

Software testing may also be required to meet contractual or legal requirements, or industry-specific standards.

1.1.4  Testing and Quality
With the help of testing, it is possible to measure the quality of software in terms of defects found, for both functional and non-functional software requirements and characteristics (e.g. reliability, usability, maintainability and portability).

Testing can give confidence in the quality of the software if it finds few or no defects. A properly designed system that passes reduces the level of risk in a system. When testing does find defects, the quality of the software system increases when those defects are fixed.

Lessons should be learned from previous projects. By understanding the root causes of defects found in other projects, processes can be improved, which in turn should prevent those defects from reoccuring and ,as a consequence, improve the quality of future systems. This is an aspect of quality insurance.

1.1.5  How Much Testing is Enough
Deciding how much testing is enough should take account of the level of risk, including technical, safety, and business risks, and project constraints such as time and budget.

Testing should provide sufficient information to stakeholder to make decisions about the release of the software or system being tested, for the next development step or handover to the customers.

Why is it necessary to have expected results for every test step?


We should better write expected results for every test step when we are designing test cases, why?

Just image: If there is a test case with 15 test steps and one expected result, how would a test executor know which step of the test case failed. So, in order to make it very clear it is important to have expected result designed for every test step.

There are two test cases as following, one has only the final expected results, the other one has results for every step. See the difference:



Test Case ID Test Case Name Scenario Expected Result Complexity
TC_001_01 Check if the user can navigate to "Add New Property" page by clicking "Add New Property " button on "Owners->Properties" page. Step 1: Navigate to the URL http://dev.property.community/ , will go to Login page.
Step 2 : Enter the username as "****@gmail.com" and password as "****" to sign in. 
Step 3 : Click on Owners.
Step 4 : Click on Properties.
Step 5 : Click on Add New Property.
"Add New Property" page should be opened where the user can edit a new property record Simple
TC_001_02 Check if the user can add a new property with valid data on "Add New Property" page. Step 1: Navigate to the URL http://dev.property.community/
Step 2 : Enter the username as "****@gmail.com" and password as "****" to sign in.
Step 3 : Click on "Owners".
Step 4 : Click on "Properties".
Step 5: Click "Add New Property"
Step 6: Enter valid data on the "PROPERTY DETAILS" page and click on Next button.
Step 7: Enter valid data on the "FINANCIAL DETAILS" page and click on Next button.
Step 8: Enter valid data on the "TENANT DETAILS" page and click on Save button.
Step 1: User should be navigated to the login page successfully
Step 2: The Dashboard should be opened.
Step 3: The drop-down menu of "Owners" should be opened.
Step 4:  "Owners>Properties" page should be opened
Step 5: "Add New Property" page should be opened.
Step 6: User should go "FINANCIAL DETAILS" page.
Step 7: User should go "TENANT DETAILS" page.
Step 8: User should go back to "Owners>Properties" page and the new property just added should appear on this page
Medium

A solution of "Seach something on Google" in C# using Specflow

First, create a feature

Feature: GoogleSearch
@mytag
Scenario: Search in Google for something
Given I am in the Google Home
And I have entered  'selenium'
When I press Enter button
Then the result should be displayed with 'selenium' page

Secondly, generate step definitions of the feature.

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
using TechTalk.SpecFlow;

namespace GoogleSearch
{
    [Binding]
    public class GoogleSearchSteps
    {
        private IWebDriver driver;

        [Given(@"I am in the Google Home")]
        public void GivenIAmInTheGoogleHome()
        {
            driver = new ChromeDriver();
            driver.Navigate().GoToUrl("https://www.google.co.nz/");
        }
     
        [Given(@"I have entered  '(.*)'")]
        public void GivenIHaveEntered(string p0)
        {
            driver.FindElement(By.XPath(".//*[@id='lst-ib']")).SendKeys(p0);
        }
     
        [When(@"I press Enter button")]
        public void WhenIPressEnterButton()
        {
            driver.FindElement(By.XPath(".//*[@id='lst-ib']")).SendKeys(Keys.Enter);
        }
     
        [Then(@"the result should be displayed with '(.*)' page")]
        public void ThenTheResultShouldBeDisplayedWithPage(string p0)
        {
            //var pageTitle = driver.Title;
            //var expectedTitle = p0 + " - Google 搜索";
            if (driver.Title == p0 + " - Google 搜索")//if (pageTitle==expectedTitle)
                Console.WriteLine("Test Success");
            else
                Console.WriteLine("Test Failed");
        }
    }
}

Seven Testing Principles


Seven testing principles:

Principle 1: Testing shows presence of defects--Testing can show that defects are present, but cannot prove that there are no defects. Testing reduce the probabilily of undiscovered defects remaining in the software but, even if no defects are found, it is not a proof of correctness.

Principle 2: Exhaustive testing is impossible--Testing everything (all combinations of inputs and preconditions)is not feasible except for trivial cases. Instead of exhaustive testing, we use risks and priorities to focus testing efforts.

Principle 3: Early testing--Testing activities should starts as early as possible in the software of system development life cycle and should be focused on defined objectives.

Principle 4: Defect clustering--A small number of modules contain most of the defects discovered during pre-release testing or show the most operational failures.

Principle 5: Pesticide paradox--If the same tests are repeated over and over again, eventually the same set of test cases will no longer find any new bugs. To overcome this 'pesticide paradox', the test cases need to be regularly reviewed and revised, and new and different tests need to be written to exercise different parts of the software or system to potentially find more defects.

Principle 6: Testing is context dependent--Testing is done differently in different contexts. For example, safety-critical software is tested differently from an e-commerce site.

Principle 7: Absence-of-errors fallacy--Finding and fixing defects does not help if the system built is unusable and does not fulfill the user's needs and expectations.

ISTQB definition of software testing


    Let's look at the ISTQB definition of software testing.
 
    The definition starts with a description of testing as a process and then lists some objectives of the test process.

    First, let's look at testing as a process:


  • Process ----Testing is a process rather than a single activity-there are a series of activities involved.
  • All life cycle activities----Testing takes place throughout the software development life cycle.
  • Both static and dynamic----tests where the software code is executed to demonstrate the results of running tests,often called dynamic testing. tests, reviewing of documents(including source code)and static analysis, are called static testing.
  • Planning----Activities take place before and after test execution to manage the testing.
  • Preparation----To choose what testing we'll do, by selecting test conditons and designing test cases.
  • Evaluation----To check the results and evaluation the software under test and the completion criteria, to decide whether the software product has passed the test.
  • Software products and related work products----We don't just test code.We test the requirements and design specifications and the related documents. Static and dynamic testing are both needed to cover the range of products we need to test.
    The second part of the definition covers the some of the objectives for testing-the reasons why we do it:
  • Determine that(software products)satisfy specified requirements.
  • Demonstrate that(software products)are fit for purpose.
  • Detect defects. 
    This is a suitable definition of testing for any level of testing, from component testing through to acceptance testing.

What is Git----A first glance of Git


Git: Version Control System (VCS) are used for tracking changes in source code file.

---Distributed version control
---Coordinates work between multiple developers/testers.
---Who made what changes and when
---Revert back at any time
---Local and Remote - DevOps
---Keeps track of code history
---Takes snapshop of your files
---You decide when to commit your changes
---You can visit code change anytime
---You stage files before commiting

Start to learn GitHub from today----Day1 on GitHub



What is GitHub?
----GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.

GitHub essentials: repositories, branches, commits, and Pull Requests. 

Today I created my first github repository named "hello-world". I did some actions as fpllowing:

  1. Create a Repository
  2. Create a Branch
  3. Make a Commit
  4. Open a Pull Request
  5. Merge Pull Request