Showing posts with label quick. Show all posts
Showing posts with label quick. Show all posts

Friday, 24 May 2019

stop loading images for Functionality testing. - For quick test execution

For Automation scrips to run faster, we can completely avoid loading images on to browser - which internally saves lot of time for execution.

Do you wanted to check how? 

here you go.




For Chrome Browser:

Step 1:
Map<String,Object> images = new HashMap<String,Object>();
images.put("images",2);

Step 2:
Map<String,Object> prefs = new HashMap<String,Object>();
prefs.put("profile.default_content_settings_values",images);

Step 3:
ChromeOptions options = new ChromeOptions()
options.setExperimentalOption("prefs",prefs);

Step 4:
WebDriver driver = new ChromeDriver(options);


For FireFox Browser:

Step 1:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("permissions.default.image",2);

Step 2:
FirefoxOptions options = new FirefoxOptions();
options.setProfile(profile);
options.setCapability(FirefoxDriver.PROFILE,profile);

Step 3:
WebDriver driver = new FirefoxDriver(options);

Saturday, 9 September 2017

Python | pytest | Quick tutorail

Install Pytest:

open command window at

C:\Users\PK\AppData\Local\Programs\Python\Python36-32\Scripts

pytest --version

pip install -U pytest

-------------------------------

Our first test:

GoogleTest.py

def inc(x):
    return x + 1

def test_answer():
    assert inc(3) == 5

-------------------------------
Run:

open command window at C:\Users\PK\AppData\Local\Programs\Python\Python36-32\Scripts

pytest C:\Users\PK\PycharmProjects\allure-reports-with-pytest\tests\GoogleTest.py

or

>py.test -q -s GoogleTest.py