Posts

Showing posts from May, 2019

Selenium-TestNG: Set Execution Order Priority of Test Methods

TestNG also provides a way to set the priority of test cases. By priority I mean, priority of execution. It can be used with @Test annotation. Below is the syntax for it:

@Test(priority=0)




In below code example,
We have four test methods And we have set the priority of each method as 0,1,2,3 The method which has 0 priority will be executed first Then method with priority 1 will be executed and so on  So, this how TestNG gives us a very easy way to control the execution of our test methods/cases.

Program: importorg.testng.annotations.Test; publicclassTestngPriority { @Test(priority=0) publicvoidone() { System.out.println("This is test case 1"); } @Test(priority=2) publicvoidtwo() { System.out.println("This is test case 2"); } @Test(priority=1) publicvoidthree() { System.out.println("This is test case 3"); } @Test(priority=3) publicvoidfour() { System.out.println("This is test case 4"); } }
Ou…

Fundamentally, What is programming?

Image
Fundamentally, it’s arranging patterns so that, when fed to a machine, certain desirable patterns come out. This is a Jacquard loom: This is the device that inspired Charles Babbage to invent the computer. As you can see, it’s weaving a carpet. This is not a computer (there are certain important things that are missing, like internal state and the ability to also change the patterns on the paper), so this loom didn’t involve computer programming, but I think it’s still programming - just look at the tape; that’s obviously code, and I don’t think it’s unreasonable to call the person that wrote it a programmer.
Guest Author Vladislav Zorovprogramming enthusiast.
Lives in Bulgaria Love my answers? Donate to my gaming budget: paypal.me/vladizorov

What is the most beautiful computer program?

Image
The null program (i.e. empty program): In many languages it’s a quine (a program that prints its own source code).Full test coverage by default.Has a cyclomatic complexity of 1, the smallest possible value.Runs in O(1)O(1).People think their first program is “hello world”, but actually the first valid program they have written is most likely the null program.Is very portable, not just across operating systems and compilers but also across programming languages.Is at the base of every other program ever written.Sometimes, it is the program being written (The /bin/true Command).It literally breaks the charts on all metrics that are “per line of code”. Everything else is downhill from there :)

Guest Author Vladislav Zorov

Some basic Python Optimizations

Image
WARNING!

For CPython, if you want performance you should prefer algorithmic optimizations (i.e. find better algorithms for what you're doing) or, if that's not possible, rewrite parts of your code in Cython.

You should generally aim for readability, and avoid micro-optimizations - except in cases where it's the same, like comprehension expressions: they are both more readable and faster (special-cased, emit less instructions than loops because there's no possibility of break, continue or return - compile.c, Ctrl+F, "List and set comprehensions").

You should always profile your application before optimizing, and you should profile with real (or realistic) data and in an as complete state as possible - concentrate on optimizing stuff that actually matters, not stuff you think matters.

You have been warned. On to the fun part.

>>>from dis import dis>>>def fn(a): b = a

Journey of a Techie - From being fired to become the most viewed Automation Writer on Quora

Image
“Congratulations, Jatin!! You are promoted!!”my manager said to me!! Well,2017 and 2018 were not my years. I was going through tough times in my personal life dealing with breakup and other family issues. When you’re going through tough times, you tend to look for signs that can actually give you and your family a little bit of happiness. This promotion was a sign for me and my family! I came out of the meeting room and called my mom to share this “good” news. There is this one thing with all Mom’s. No matter how much you try to hide your sadness and worry, they can easily sense it! She was sad because I was sad, and she knew that she couldn’t do anything about it. I wanted to give this good news to her so that she could actually divert her thoughts from the tough times I was going through. Feb 5th, 2018: I was back from a mini vacation and was feeling really good! I thought, from now on, to start a new chapter of my life, filled with positivity and happiness. Little did I know that God ha…