Tuesday, January 24, 2017

AUTOMATION 25 - Thinking about maintainability with methods

Today we're picking up again on the automation series of articles that I started last year.  You might wish to refresh yourself with what we've covered by following this link.

Technical level: ***

Previously on this blog, I’ve taken you through some an introduction to Java, which has been about understanding and playing with some core features around using the language effectively.  I chose Java because it’s popular, and my team uses it, but some of the concepts coming out about using methods, data hiding and objects are common to many languages.

Meanwhile, on the automation series, we took a look at several technologies, thinking about how they worked best … or not so well for checking.

In doing so, we’ve covered a lot of material, over 40 articles so far!  And here’s where it starts to pay off, as we bring the two together for the remainder of the automation series!

I’ve held a whole load of interviews with people around Wellington to talk about their automation, where people are now, and what “came before this”.  What’s a common story is that initially it’s been seen that they wanted testers to write automation scripts, and their testers weren’t very good at coding.  So they’ve ended up picking tools like Selenium IDE or Coded UI.

These kinds of record and playback tools can have their advantages if used well, but they’re rather clunky.  Typically they use a very simplistic language, which doesn’t allow for loops, ifs, methods or any other features of a programmable language.

So you end up with long scripts, with no real brains to them – you don’t benefit from any kind of code reuse, so everything’s written out long hand.

So you write out 100 scripts this way, and the first few steps of each one is to log in.  Then your project changes … there’s a decision to scrap the current login page, and use Facebook to provide your login service.  The developers say this isn't too big a change – but it won’t be quick for your automation.  You will need to find a change that works, and then copy and paste it into a 100 test scripts.

I like to say that in such scenarios we've taken on (without realising it) a kind of test automation debt, one that because of the limitation of our tool, we can never pay off.  Some of this will feel a bit deja vu because we talked about it here under our denial in testing series.

This is where the power of computer languages come into their own and why Selenium Webdriver (over IDE) has really come into it’s own.  As we've covered, Selenium Webdriver is driven by a fully structured language like Java.

Using WebDriver and a language like Java, you can define your steps to login as a method, and have all your 100 test scenarios call that method.

Now when the login changes, you change the login method, and the change ripples down to all the tests that use it.  This is the heart of building maintainable code, using the features of your programming language to reduce your overhead.

Don’t define something twice, when you can extract it as a method and use it over multiple tests.  We looked at how methods help us to avoid tangled code during our Java series here.

Next time we'll consider some design patterns which can be used with tools like Selenium WebDriver.

5 comments:

  1. Saya ingin berbagi cerita kepada anda bahwa saya IBU HERAWATI seorang TKW dari malaysia dan secara tidak sengaja saya buka internet dan saya melihat komentar IBU DARNA yg dari singapur tentan AKI SYHE MAULANA yg telah membantu dia menjadi sukses dan akhirnya saya juga mencoba menghubungi beliau dan alhamdulillah beliau mau membantu saya untuk memberikan nomor Togel/lottrey toto 4D dr hasil ritual/ghaib melalui jarak jauh dan alhamdulillah itu betul-betul terbukti tembus dan menang RM.230.000 Ringgit ,kini saya kembali indon membeli rumah dan kereta walaupun sy Cuma pembantu rumah tanggah di selangor malaysia, sy sangat berterimakasih kepada AKI SYHE MAULANA dan tidak lupa mengucap syukur kepada ALLAH karna melalui AKI MAULANA saya juga sudah bisa sesukses ini. Jadi kawan2 yg dalam kesusahan jg pernah putus asah, kalau sudah waktunya tuhan pasti kasi jalan asal anda mau berusaha, ini adalah kisah nyata dari seorang TKW, AKI MAULANA adalah guru spiritual terkenal di indonesia. jika anda ingin seperti saya kunjungi situs/website KLIK DISINI RITUAL PESUGIHAN DUNIA GHAIB



    SUCCESS STORY OF HERAWATI MOTHER

    I want to share the story to you that I am HERAWATI MOTHER a TKW from malaysia and accidentally I open internet and I see DARNA MOTHER comment from singapur about AKI SYHE MAULANA who has helped him become successful and finally I also tried to contact him and alhamdulillah he Want to help me to give the number Togel/lottrey toto 4D dr ritual results / unseen and alhamdulillah it really proved translucent and won RM.230.000 Ringgit, now I am back indon buying house and train although sy Just a housemaid at selangor malaysia, sy very thankful To AKI SYHE MAULANA and do not forget to give thanks to ALLAH because through AKI MAULANA I also can be as successful as this.So kawan2 who in distress jg ever break down, when it's time god must be the road of origin you want to try, this is the true story of a migrant worker, AKI MAULANA is a famous spiritual teacher in Indonesia. If you want to like me visit the website CLICK HERE RITUAL GHAIB TEMBUS LOTTREY


    ReplyDelete
  2. Terimakasih banyak AKI karna melalui jalan togel ini saya sekarang sudah bisa melunasi semua hutang2 orang tua saya bahkan saya juga sudah punya warung makan sendiri hi itu semua berkat bantuan AKI JAYA yang telah membarikan angka 4D nya menang 275 jt kepada saya dan ALHAMDULILLAH berhasil,kini saya sangat bangga pada diri saya sendiri karna melalui jalan togel ini saya sudah bisa membahagiakan orang tua saya..jika anda ingin sukses seperti saya hubungi no hp O85-244-015-689 AKI JAYA,angka ritual AKI JAYA meman selalu tepat dan terbukti..silahkan anda buktikan sendiri. 2D 3D 4D 5D 6D







    Terimakasih banyak AKI karna melalui jalan togel ini saya sekarang sudah bisa melunasi semua hutang2 orang tua saya bahkan saya juga sudah punya warung makan sendiri hi itu semua berkat bantuan AKI JAYA yang telah membarikan angka 4D nya menang 275 jt kepada saya dan ALHAMDULILLAH berhasil,kini saya sangat bangga pada diri saya sendiri karna melalui jalan togel ini saya sudah bisa membahagiakan orang tua saya..jika anda ingin sukses seperti saya hubungi no hp O85-244-015-689 AKI JAYA,angka ritual AKI JAYA meman selalu tepat dan terbukti..silahkan anda buktikan sendiri. 2D 3D 4D 5D 6D









    Terimakasih banyak AKI karna melalui jalan togel ini saya sekarang sudah bisa melunasi semua hutang2 orang tua saya bahkan saya juga sudah punya warung makan sendiri hi itu semua berkat bantuan AKI JAYA yang telah membarikan angka 4D nya menang 275 jt kepada saya dan ALHAMDULILLAH berhasil,kini saya sangat bangga pada diri saya sendiri karna melalui jalan togel ini saya sudah bisa membahagiakan orang tua saya..jika anda ingin sukses seperti saya hubungi no hp O85-244-015-689 AKI JAYA,angka ritual AKI JAYA meman selalu tepat dan terbukti..silahkan anda buktikan sendiri. 2D 3D 4D 5D 6D


    ReplyDelete

  3. This blog is having the general information. Got a creative work and this is very different one.We have to
    develop our creativity mind.This blog helps for this. Thank you for this blog. This is very interesting and useful...

    SEO Training in Chennai

    ReplyDelete

  4. Baccarat in ways that many people do not miss.

    IBCbet Website to Present Luck To risk the world wide. Betting Markets World wide betting opportunities Online casino games are fun activities that are fun to have a habit. The new desire to win the chance to create a good view. The opening of the financial path created is excellent. Meet new betting games. A way to play a game that brings you to the overwhelming victory. Meet the ultimate gambling luck. Open the path of fun. Online casino games, casinos, slots, slots and many other leading sports are one of the online gambling sites that open the path to happiness. With many casinos are known to be excellent. Relaxing game opens the path of finance to the perfect. Choosing an alternative to gambling that is fun every day. Open your eyes to the gambling industry. Join the fun. With more than 200 games to choose from more fun games with special discounts for you to play with. Bet on the web. Sbobet

    ReplyDelete