Selenium Framework - Part 9 - Static Block for the Rescue

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 28

  • @chaitanyabuddi5968
    @chaitanyabuddi5968 2 роки тому +2

    Got much Clarity on Static Block Usage.. Thanks Amuthan

  • @jaysree3678
    @jaysree3678 3 роки тому +1

    Very useful. Got good clarity on property file nand static block usage

  • @ArvindKumar-xz2fu
    @ArvindKumar-xz2fu 3 роки тому

    Best video on youtube

  • @gauravvarma6483
    @gauravvarma6483 Місяць тому

    Hi Amuthan, thanks for the video. It's too good, Just worth it.
    I have one doubt, how are we achieving singleton design pattern in our framework?

    • @TestingMiniBytes
      @TestingMiniBytes  Місяць тому

      @@gauravvarma6483 you dont gave to force fit an design pattern

  • @ArunKumararunpgb
    @ArunKumararunpgb 4 роки тому +1

    Amuthan Bro I think I spot Right place at right time,can u please speed up the series to post videos on daily basis :)

    • @TestingMiniBytes
      @TestingMiniBytes  4 роки тому

      I am trying my best to post videos as much as possible. Thank you for your patience and understanding.

  • @uhsay1986
    @uhsay1986 2 роки тому

    Hi, When to use HashMap and when to use hashtable in framework . Both are based on key-value concept .

  • @vivekbhardwaj2785
    @vivekbhardwaj2785 2 роки тому +1

    How to change the name of property file at run time in static block?

    • @TestingMiniBytes
      @TestingMiniBytes  2 роки тому

      Then you should consider using owner library. That is better way of dealing with property files

  • @django4084
    @django4084 3 роки тому +1

    Below is another way to create the HashMap,
    for (String key : properties.stringPropertyNames()) {
    propertiesMap.put(key, properties.getProperty(key));
    }

  • @piyushmathpal4244
    @piyushmathpal4244 3 роки тому +1

    Hey amuthan, why I need to create static block when I can also declare Properties file object in my constructor as well

    • @TestingMiniBytes
      @TestingMiniBytes  3 роки тому +3

      Constructors are meant for instantiating instance members and static blocks helps to initialise static data members.
      It is also termed as eager initialisation and we can be sure that the data from property file will definitely be available for us to use.
      You can do that without static blocks using methods but what if there is an unhandled exception before calling method.
      Your entire test suite will fail because of NPE. The cause will be due to the property values are not read.

    • @piyushmathpal4244
      @piyushmathpal4244 3 роки тому +1

      @@TestingMiniBytes Good man, thanks for sharing

  • @xoda345
    @xoda345 2 роки тому

    can I also make the private static Properties property = new Properties(); as private static final Properties property = new Properties();?

  • @ArunKumararunpgb
    @ArunKumararunpgb 4 роки тому +1

    Amuthan Bro,if we have more than 1 Properties files ,it wouldnt help na in single static blocks, we have to create another static block, am i right?? please help me out on this

    • @TestingMiniBytes
      @TestingMiniBytes  4 роки тому +1

      You can have it in the same static block. You can use another one too. It is entirely the way you code. There is no impact to the performance as such.
      But I would advice to limit the number of property files.

  • @ahmedmustaq5854
    @ahmedmustaq5854 3 роки тому +1

    Hi bro
    Got to learn lot from your framework tutorial, can you please share the git link for our reference.
    Thanks in advance

    • @TestingMiniBytes
      @TestingMiniBytes  3 роки тому

      github.com/amuthansakthivel/SeleniumAutomationFramework_UA-cam

  • @mjj3tube
    @mjj3tube 4 роки тому +1

    Amuthan have we solved the issue that we got for the feature file ? The null pointer?

    • @TestingMiniBytes
      @TestingMiniBytes  4 роки тому

      We are not using any feature file in our framework.

    • @mjj3tube
      @mjj3tube 4 роки тому

      @@TestingMiniBytes sorry my bad I was referring to the property file .

    • @mjj3tube
      @mjj3tube 4 роки тому

      @@TestingMiniBytes got it amuthan , thanks

  • @Durga1625
    @Durga1625 3 роки тому

    Hi, I am getting error at vidoe time :15:25, ConfigMap.put and the error is:The method put(String, DocFlavor.STRING) in the type HashMap is not applicable for the arguments (String, String) , please help me to fix this

    • @Durga1625
      @Durga1625 3 роки тому +1

      I got the issue brother thanks.

  • @RanganathanPbecse
    @RanganathanPbecse 3 роки тому

    Hi Amuthan, which version of java you are using. I installed both 1.8 and 15 but below statement Objects.isNull(key) throwing an error "The method isNull(objects) is undefined for the type Objects".
    Then i made the changes to pom to compile with 15 with below setting for both 1.8 T 15 & none worked.



    org.apache.maven.plugins
    maven-compiler-plugin
    3.2

    15
    15





    So how to correct this issue.

    • @TestingMiniBytes
      @TestingMiniBytes  3 роки тому

      What is the package you are importing. There can be classes from other dependencies. Try to use the one from java

  • @rmt0858
    @rmt0858 Рік тому

    Static block initialise only once when class is loaded .