Open chrome mobile emulator with selenium c#

Hi guys, I am going to run a test mobile emulator with selenium and VS C#


using System;
using System.Threading;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Chrome;

Driver Utils Class

First of all delclaring the webdriver, which will be used for open specfic browser

namespace SeleniumAutomation
public class Setup
       IWebDriver webDriver;

Open Chrome

public void Open_Browser()
 webDriver = new ChromeDriver();


Open Chrome Mobile Emulator

 public void Mobile_Emulator_Browser()
 ChromeOptions chromeCapabilities = new ChromeOptions();
 chromeCapabilities.EnableMobileEmulation("Pixel 5");
 webDriver = new ChromeDriver(chromeCapabilities);


I think it will be helpful to run chrome in mobile emulator

IoT Testing

There are more connected devices than ever before as IoT (Internet of Things) technology is gaining traction. IoT testing is conducted to test IoT technology based devices. The various types of testing for IoT systems are as follows:

Usability Testing – To test the usability of an IoT system

Compatibility Testing – To check the compatibility of devices in IoT system

Reliability & Scalability Testing – Simulation of sensors utilizing virtualization tools

Data Integrity Testing – To validate the integrity of data

Security testing – To validate the user authentication process and data privacy controls

Performance Testing –  To test the performance of the connected devices in an IoT network

Selenium C# How to Generate Extent Reports

Reports play a fundamental role when it comes to TESTING. Tester can now know the real-time reports of test suit execution. Reports made ease to know the ratio of Pass? Or Fail? Post-test suit execution and it is the only documentation to know about test execution results.

Everyone wish to see the detailed description of the test results. Don’t you? here is the solution for it. And, let us see how these reports can be achieved? in Selenium C# – NUnit framework automation testing.

To achieve detailed test execution results as HTML reports we need to rely on third party tool called => Extent Reports. These reports provide decent narration of test execution results and are depicted in PIE chart.

How to Reference Extent Reports in MS Visual Studio

Extent Reports can be directly referenced via NuGet Gallery:

Step 1) Project> Manage NuGet Packages

Step 2) In the next window

  1. Search for ExtentReports
  2. Select the search result
  3. Click Install

Step 3) Install selenium support from NuGet package

Step 3) Click ‘I Accept’

Step 4) Create a new C# class with the below code for Extent Reports.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Chrome;

using NUnit.Framework;
using NUnit.Framework.Interfaces;
using NUnit;

using AventStack.ExtentReports.Reporter;
using AventStack.ExtentReports;
using System.IO;

namespace RnD
    public class TestDemo1
        public IWebDriver driver;

        public static ExtentTest test;
        public static ExtentReports extent;

        public void Initialize()
            driver = new ChromeDriver();

        public void ExtentStart()
            extent = new ExtentReports();
            var htmlreporter = new ExtentHtmlReporter(@"D:\ReportResults\Report" + DateTime.Now.ToString("_MMddyyyy_hhmmtt") + ".html");


        public void BrowserTest()
            test = null;
            test = extent.CreateTest("T001").Info("Login Test");

            test.Log(Status.Info, "Go to URL");

            //provide username
            //provide password

                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(1));
                wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//h3[contains(.,'WELCOME :)')]")));
                //Test Result
                test.Log(Status.Pass, "Test Pass");


            catch (Exception e)

                test.Log(Status.Fail, "Test Fail");


        public void closeBrowser()

        public void ExtentClose()

Post running test method, the test execution report looks as shown below:

how to setup selenium webdriver with c#

Set Up Visual Studio with Selenium WebDriver:

Create a new project in Visual Studio:

Step 1) In the File Menu, Click New > Project

Step 2) In the next screen

  1. Select the option ‘Visual C#’
  2. Click on Console App (.Net Framework)
  3. Enter name as “RnD”
  4. Click OK

Step 3) The below screen will be displayed once the project is successfully created.

Set up Visual Studio with Selenium WebDriver:

Step 1) Navigate to Project-> Manage NuGet Packages

Step 2) In the next screen

  1. Search for Selenium on the resultant screen
  2. Select the first search result
  3. Click on ‘Install’

Step 3) The below message will be displayed once the package is successfully installed

Steps to install NUnit Framework:

Step 1) Navigate to Project-> Manage NuGet Packages

Step 2) In the next window

  1. Search for NUnit
  2. Select the search result
  3. Click Install

Step 3) The below message will appear once the installation is complete.

Steps to download NUnit Test Adapter

Please note that the below steps work only for 32-bit machines. For 64-bit machines, you need to download the ‘NUnit3 Test Adapter’ by following the same process as mentioned below.

Step 1) Navigate to Project-> Manage NuGet Packages

Step 2) In the next window

  1. Search NUnitTestAdapter
  2. Click Search Result
  3. Click Install

Step 3) Once install is done you will see the following message

Steps to download Chrome Driver

Step 1) Navigate to Project-> Manage NuGet Packages

Step 2) In the next window

  1. Search for Chromdriver
  2. Select the search result
  3. Click Install

Step 3) System may asked for permission. Click on ‘Yes to All’

Step 4) The below message will appear once the installation is complete.

Selenium and NUnit framework:

Selenium with NUnit framework allows differentiating between various test classes. NUnit also allows using annotations such as SetUp, Test, and TearDown to perform actions before and after running the test.

NUnit framework can be integrated with Selenium by creating a NUnit test class and running the test class using NUnit framework.

The below are the steps needed to create and run a test class using NUnit framework.

Steps to create a NUnit Test class in Selenium:

Step 1) In the Solution Explorer, Right clicked on project > Add > Class

Step 2) Class creation window will appear

  1. Provide a name to the class
  2. Click on Add button

Step 3) The below screen will appear.

Step 4) Add the following code to the created class. Please note that you need to specify the location of ‘chromdriver.exe’ file during chrome driver initialization.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Chrome;

using NUnit.Framework;
using NUnit.Framework.Interfaces;
using NUnit;

namespace RnD
    public class TestDemo1
        public IWebDriver driver;

        public void Initialize()
            driver = new ChromeDriver();

        public void BrowserTest()

        public void closeBrowser()

Step 4) Click on ‘Build’ -> ‘Build Solution’ or keypress ‘Ctrl + Shift + B’

Step 5) Once the build is successful, we need to open the Test Explorer window. Click on Test -> Windows -> Test Explorer

Step 6) Test Explorer window opens with the list of available tests. Right-click on Test Explorer and select Run Selected Tests

Step 7) Selenium must open the browser with specified URL and close the browser. Test case status will be changed to ‘Pass’ on the Test Explorer window.

Database Testing Checklist

Database Testing

  • Synchronization between the database and the values displayed in our client/web.
  • Query results, views, stored procedures, indexers Etc.
  • Data manipulation (Update, Delete, insert Etc.).
  • Database performance.
  • Data maintenance.
  • Table’s structure.
  • Data recovery.
  • Data integrity.
  • Others

Clean database testing

  • Verify clean database testing.
  • Input 1st data

Database system-level tests

  • Validate the DB behavior of any case of service failures (recovery, error handling Etc.).
  • Validate that all indexes are created when it can increase the system performance.
  • Validate that appropriate events are created ad sent to the EventVwr/trace log.
  • Validate that DB tables are created with informative and reasonable names.
  • Try to work when the storage is ‘0’ and the e database is in running state.
  • Perform your tests on different versions (SQL 2005, 2008, 2012 etc.).
  • Validate the software security model (User roles, permissions etc.).
  • Validate the connection strings against SQL/Win authentications.
  • Validate data migrations (Different Database, Cluster, etc.).
  • Validate the behavior of the system against SQL injections.
  • Validate date to DB when the server is loaded.
  • Try to work when the database server is down.
  • Try to work with difference instance.
  • Validate restore and backup plans.

Database Integration Testing

  • Check that all columns are set with the relevant data type (Bigint, int, string Etc.)
  • Check that all data is logically organized in the relevant DB tables.
  • Check that each data item is located under the relevant column.
  • Is there any irrelevant data in the software dedicated tables?
  • Check that each table contains the relevant data.
  • Try to insert invalid database values.
  • Verify the data encryption (if any).

Data field tests

  • Validate that “Allow Null” condition is not allowed in a place that result a software failure.
  • Validate that all tables are created with logical structure (Primary, foreign keys.)
  • Validate that “Allow Null” condition is set when you need to allow it.
  • Validate that mandatory fields are created, this issue is very important when you work with multiple tables that depends on each other.

Procedure tests

  • Validate that the data the affected by the procedure is changed as expected.
  • Validate that all procedures are triggered when they supposed to run.
  • Validate that all the conditions receive an appropriate date inputs.
  • Validate that all procedures are created with the relevant code.
  • Is there an appropriate error handling for a failed procedure?
  • Validate that all the loops receive an appropriate date inputs.
  • Validate the procedure’s parameters (types, names, etc.).
  • Test the SP while executing the code manually.
  • Validate important code with SQL profiler.
  • Validate that all procedures names
  • Run tests with missing parameters.

Database and software integration (Client, web Etc.)

  • Validate that the user data is saved when the user “Apply” or “Submit” the changes.
  • Try to insert “NULL” values on fields that doesn’t supposed to receive it.
  • Validate that the user receives the current result when pulling data.
  • Validate that transaction the data type boundaries (Minima Etc.)
  • Validate that empty spaces are not committed to the database.
  • Validate that the values displayed based on the database data.
  • Try to insert UNICODE on Unicode character strings.
  • Try to insert values that exceed the field boundaries.
  • Validate that transactions the negative data values.
  • Insert invalid date format on Date and time fields.
  • Validate that the data integrity is not affected when the “Apply” or “Submit transactions are failing during the process.
  • Validate that the “Roll Back” option is available when the DB transaction is failed in the middle.

Data checking

  • Create Data from frontend and check by Query
  • Delete Data from frontend and check by Query

Mobile Testing Checklist


  • Check OS depend on test
  • Check many OS’s we will support (Android / iOS / Windows Phone)?
  • What mobile / tablet device will be used?
  • What mobile / tablet screen size (Inch: 10 / 8)?
  • What will be happened if OS updated?

Device-Specific Features

  • Content – Text size, Content adjustment, Responsive design
  • UI- Touchscreen gestures- swipe, zoom, pinch, multi-touch, shake
  • Pre-install software (Such as for export or import file)?
  • Check if battery down
  • Check making/Receiving voice calls while the app is running
  • Check memory utilise overflow
  • Check resuming App from the same point as left at the time of switching to another app
  • Check data will be saved (SD card / internal memory)
  • Check happened if memory (SD card / internal memory) full and try to export
  • Check in portrait / landscape mode?
  • Check application for empty / large database
  • Check screen off / screen saver off.
  • What are difference real device and emulator?
  • Check minimise app while loading shows

Connectivity and Network Issues

  • Check data connection will be used (Mobile operator / wifi)
  • Check if data connection loss while saving data
  • Check if data connection slow while saving data
  • Check both connection are open; Now, lost wifi connection what will be happen; Vice versa
  • Check both connection are open; Now, slow wifi connection what will be happen; Vice versa
  • Check shows error message if connection failed
  • Check app bandwidth consumption

User Experenice

User Experience

  • Check app logo
  • Check menu logo
  • Check list page are searchable
  • Check list page are sortable
  • Check list page are filterable
  • Check screen resolution?
  • Check how many columns will display in list / details page?
  • Check able to export from list page?
  • Check able to print from list/ details page?
  • Check able to create design custom forms details page?
  • Check able to fill up fields in details page?
  • Check able to click button in list /details page?
  • Check navigation across different screen
  • Check responsiveness of the App Logo and Name
  • Check easy navigation across different screens
  • Check responsiveness of drop down lists
  • Check prompt display of errors and warning messages
  • Check spelling, typo and grammar in all kind of messages and labels
  • Check inactive buttons and active buttons
  • Check date format or date picker
  • Check amount with rounding figure
  • Check currency format
  • Check text field format
  • Check number key pad when number text field
  • Check auto save available
  • Check delete feature
  • Check Custom name feature or behaviour
  • Check sent email from on screen
  • Check description field enough space to enter data
  • Check easy way to ‘collapse or expand’ all data
  • Check all select feature in list page
  • Check user profile settings
  • Check notification feature available (Such as if new project add, delete or modified notification)
  • Check app version

Data Testing

  • Data Sync issue (If data added from mobile app but not showing in web app. Vice versa)
  • API testing
  • Check image / document upload and limitation
  • Check document / image view feature
  • Check list page data count shows or not
  • Check server down time
  • Check xero/ other third party software data sync (if applicable)
  • Check CRUD operation
  • Check concurrency message
  • Check will data save offline mode
  • Check data create/update/delete in offline but what will be happened when its in online
  • Check previous data access cache

Security Testing

  • Check login credential attach with mobile fingerprint
  • Check ‘Remmber me’ feature in login
  • Check app sign out / Sign in feature
  • Check cache clear and run application again
  • Check user logged in but inactive / locked from admin
  • Check non admin user logged in what data s/he can access
  • Check customer’s data security
  • Check customer payment data security
  • Check network protocols security for running application
  • Check user security policy
  • Check one user can see another user data or information
  • Check antivirus related issue

Performance Issue

  • Check time taken to launch the application
  • Check application performance at times of peak load conditions and continual key pad entry
  • Check splash performance check and ensuring it remains on screen for less than 1~2 seconds
  • Check application performance in low device battery and charging conditions
  • Check Integration with the device and other applications without hampering performance
  • Check application install/uninstall successfully within the desired timeframe
  • Check displaying error messages and exits gracefully at times of low memory issues
  • Check app performance at the time of a Network problem and error alert prompts
  • Check application performance when the Network is back in action
  • Check memory Consumption
  • Check hardware Utilisation
  • Check app behaviour if app crashed
  • Check device performance
  • Check server performance
  • Check network performance
  • Check Install or update app feature
  • Check OS based app limitation

Feedback Feature

  • Check ‘Contact Us’ feature
  • Check help guide available
  • Check legal feature available (Such as ‘Term and condition’ and ‘Privacy Policy’)

When search value in all tables under a database

If someone wants to search by specific value in database, it’s difficult to search a value whole database. Below code easy way to find out

DECLARE @SearchStr nvarchar(100)
SET @SearchStr = ''
CREATE TABLE #Output (TableLocation nvarchar(370), Details_Information nvarchar(3630))
DECLARE @SearchTableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET  @SearchTableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')
WHILE @SearchTableName IS NOT NULL
    SET @ColumnName = ''
    SET @SearchTableName = 
        WHERE         TABLE_TYPE = 'BASE TABLE'
            AND    QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @SearchTableName
            AND    OBJECTPROPERTY(
                        QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)
                         ), 'IsMSShipped'
                           ) = 0
    WHILE (@SearchTableName IS NOT NULL) AND (@ColumnName IS NOT NULL)
        SET @ColumnName =
            WHERE         TABLE_SCHEMA    = PARSENAME(@SearchTableName, 2)
                AND    TABLE_NAME    = PARSENAME(@SearchTableName, 1)
                AND    DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar', 'int', 'decimal')
                AND    QUOTENAME(COLUMN_NAME) > @ColumnName
        IF @ColumnName IS NOT NULL
            INSERT INTO #Output
                'SELECT ''' + @SearchTableName + '.' + @ColumnName + ''', LEFT(' + @ColumnName + ', 3630) FROM ' + @SearchTableName + ' (NOLOCK) ' +
                ' WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2
SELECT TableLocation, Details_Information FROM #Output

how to get restore history in sql server

SELECT [rs].[destination_database_name],
[bs].[database_name] as [source_database_name],
[bmf].[physical_device_name] as [backup_file_used_for_restore]
FROM msdb..restorehistory rs
INNER JOIN msdb..backupset bs
ON [rs].[backup_set_id] = [bs].[backup_set_id]
INNER JOIN msdb..backupmediafamily bmf
ON [bs].[media_set_id] = [bmf].[media_set_id]
ORDER BY [rs].[restore_date] DESC