Behavior, Content, Money – 3 Things you should never give away for free!!!

BCmoney MobileTV

SeleniumIDE “.side” JSON parser for “Durable Selectors”, more maintainable Test Automation

Posted by bcmoney on April 27, 2019 in Automated Testing, DevOps with No Comments


No Gravatar

Selenium is the leading open source Test Automation framework. Its WebDriver specification is in the process of being adopted by all the major browser vendors, with most having fairly complete support at this point. WebDriver is the spec document, language-specific SDK bindings, and associated browser-specific driver implementations that enable you to remotely control a browser in an automated manner. This uses a “selector” in the form of:

  • id – attribute “id” of the element
  • name – attribute “name” of the element
  • css selector – full CSS syntax querySelector like “div#search.find”
  • css path – dotted class names like “.my > .thing > .stuff”
  • xpath – xml path based retrieval like “//html/body/div”
  • linktext – “a” anchor tag text values

Choosing a selector for each “Test Step” in a given “Test Case” enables you to fire “commands” at your browser. Using this recipe we can create and run (record & playback) Selenium tests which automate the repetitive mind-numbing testing steps that a Tester would traditionally carry out manually, such as clicking around within a web application, mobile application or website; entering some data, submitting forms, clicking through E-Commerce flows to make purchases, interacting with specific on-screen elements, etc… all to simulate user behavior with your web/mobile application or website in the “real-world”. This frees up QA Testers for more intellectual work such as Performance Testing to help provide suggestions to speed up the app and support more users, Exploratory Testing “fuzz/negative tests” to try to break the system and find its boundaries by using intentionally wrong inputs, Security/Penetration Testing to identify vulnerabilities, Accessibility Tests to improve support for those with disabilities and regulatory compliance, Usability Tests to improve the UI to help end-users, A/B Tests with Marketing team to improve conversions, etc..

There’s just one catch, creating Selenium tests (and test automation in general) can be seen as a significant investment for most companies, one that certainly not all businesses will agree is worth the upfront cost (or that they’ll even fully understand the value of for that matter). This is a problem in today’s fast-moving marketplaces where if you don’t innovate and move with the speed of the market, you stand a real chance at becoming irrelevant and passed up for more “customer-centered” up and coming competitors. Even large enterprises who once enjoyed long lifetimes as monopolies, oligopolies, or simply “difficult to challenge incumbents” are increasingly seeing competition from all corners. Development teams in all companies are being asked to do more with less, and to keep pace; but how can we possibly move quickly and maintain quality, when all of our testing is manual and acts as a gatekeeper or bottleneck to releases getting out the door? This is what the DevOps series on this blog is meant to address.

What if we had a tool for recording and “playing back” a set of manual steps we’ve carried our one time? Could it be possible to “seed” our test automation this way? In fact, yes this is one possible way, and when it comes to Selenium, then SeleniumIDE for the longest time was the answer. Selenium IDE was historically considered as somewhat of the “black sheep” of the Test Automation industry. You wouldn’t kick it out of your Automated Testing flock (toolkit) completely, it still has useful wool to provide, but you might not be able to sell it as easily to a Dev, Ops or QA team as the “best” long-term solution for their test automation efforts. This became especially true recently as Mozilla’s FireFox team, announced they were deprecating their legacy NSAPI/XUL plugin frameworks in favor of the more standardized and modern W3C’s WebExtensions specification. FireFox being originally the only browser that SeleniumIDE 1.x-2.x was built to work on, this effectively set a ticking clock on the lifetime of SeleniumIDE’s usefulness, and as promised, immediately as FireFox 55 was released, QA engineers relying on SeleniumIDE recorded tests confirmed the death of the legacy test automation tool.

All seemed lost for “record & playback” test automation in Selenium, until Visual Test Automation company Applitools got behind an open source project aimed at a revival of SeleniumIDE. There’s pretty clear benefits to them in having an easy-to-use browser-based automation recording too:

  • it lowers the barrier to Test Automation for most Dev, Ops & QA teams out there (not all of which or all members of which will have coding skills to write a bunch of Selenium scripts by hand)
  • it helps companies seed/bootstrap a suite of Automated Tests where they may be in the unfortunate situation of having absolutely none to start out with
  • it puts Applitools on the map in Developer & QA engineer mindshare by contributing a worthwhile project to the open source community
  • folks who previously didn’t know anything about their company now are more likely to hear about them and at least give them a try
  • it enables companies to quickly get up and running with some recorded Selenium tests, then integrate those tests to Applitools’ visual testing (although of course there’s no requirement to do so, you can just go ahead with basic Test Automation and skip the visual stuff or even roll your own basic visual DIFF tool, a possible topic for a future article)

Whatever their main motivations, their efforts are certainly applauded by myself and many others in the open source & Test Automation communities. Documentation for SeleniumIDE in terms of the commands available can be found here: https://www.seleniumhq.org/selenium-ide/docs/en/introduction/getting-started/

You can download the following flavours of SeleniumIDE:

Installation is easy, but in case you need a walkthrough with screenshots this will take you through the main steps:
https://www.guru99.com/install-selenuim-ide.html

So that’s pretty much all the context you’ll need for why “Record & Playback” has value but if you’re still not convinced, listen to the following podcast and webinars:

Read the rest of this entry »

Noise Isolation .vs. Cancellation .vs. Reduction – protect your ears and work in peace & quiet

Posted by bcmoney on August 14, 2017 in E-Learning, Multimedia with No Comments


No Gravatar

Most of the time, Developers’ day-to-day jobs can be a bit stressful. With tight deadlines, high expectations, and often unwieldy applications/codebases to manage, you can see how there really is a need to be able to concentrate in order to succeed in this role. Of course, this applies to non-technical roles as well, but in particular you want to maximize the productivity of those building your company’s mission critical applications, products and services. That’s of course assuming whatever industry you’re in, those have already been in some way affected by the pervasiveness of the internet, always-on mobile devices and constantly adapting technology in all its various forms. For instance, the frequent headlines about how modern cars now contain more lines of code than airplanes (not just the passenger/cargo planes, even when compared to military fighter jets).

Noise Isolation

Noise Isolation means that the headphones, earphones or similar device is ergonomically designed to block out as much noise as possible from entering the ear canal through careful selection of optimum construction materials and muffling/insulation layers. It does not do much to block low-level surrounding noise and does not make use of any power or electronics to do “Active” blocking of noise. This “Passive Noise minimization” approach typically does not offer much if any protection to your ears against loud noises, but can definitely help your podcasts, audiobooks, music, radio, E-Learning courses, etc take over from the ambient and background noises in your office or around your home.

Ideal usage: task concentration, or, distraction-free multi-tasking

Noise Cancellation

Also known as Active Noise Control (ANC), or active noise reduction, is a method for reducing unwanted sound by the addition of a second sound specifically designed to cancel the first.

Idea usage: …

Noise Reduction

NRR rating for protecting your ears from sudden loud noises.

Idea usage: …

 

Conclusion

Check out the video below for a nice overview of the difference certain Noise Cancelling technologies make to the sound you hear with and without music:

Integrate PHP based SOAP RPS game server in another language, JAVA desktop GUI

Posted by bcmoney on February 23, 2017 in Gaming, Java, PHP, Web Services with No Comments


No Gravatar
Rock-paper-scissors chart

Rock-paper-scissors chart (Photo credit: Wikipedia)

Now that we have a Web Service ready to consume (even though it is SOAP based), it should be pretty easy to extend to Java, which also means it should be possible with a little bit of effort to create a Desktop GUI.

For more on creating a Java-based SOAP server to have an all-Java version of this solution, see:
https://netbeans.org/kb/docs/websvc/jax-ws.html

 

 

See the other parts here:

Exposing your PHP Rock Paper Scissors game via SOAP Web Services

Posted by bcmoney on January 14, 2017 in Gaming, PHP, Web Services with No Comments


No Gravatar

Rock-paper-scissors chart

Rock-paper-scissors chart (Photo credit: Wikipedia)


So why SOAP? Well quite simply this was what I used back when I was first working through PHP and learning the hard way how to expose some server-side “business logic” as a Web Service. This was over a decade ago (late 2006 through 2007), and Google’s SOAP Search API had yet to be phased out, and was still one of the biggest reference implementations of SOA. In all truth I’d almost never use SOAP for creating Web Services from scratch anymore, but it does have a few minor advantages in niche cases thanks to ws-security, SAML integration, well-formed response guarantee via schema validation, contract-first development for more stability amongst separate inter-dependent departments/organizations, etc.

It also serves as a useful tool to go back and review every now and then, especially if your consulting ever takes you to an enterprise gig that still uses legacy SOA technologies (and yes despite REST taking over 6 years ago followed shortly by JSON replacing XML, there are still a decent amount of SOAP-based WS deployments out there at big companies, the kind of big enterprises with big budgets at stake and/or political reasons to keep their legacy technology stacks running). REST/JSON may have won the internet thanks to its simplicity, but there’s something to be said about what the various organizations that came up with SOAP and the ws-* stack had in mind (aside from complexity and lucrative implementation contracts/tooling sales), namely robustness and predictability. Take Netflix and YouTube for example, two of the most frequently called APIs on the web, both “RESTful-ish” but each taking their own liberties with Fielding’s original REST thesis in unique ways, particularly around Auth mechanisms and Usage Policies required to work with the data, DRM, Advertising, somewhat creative usage-restricting API metering, and/or pay-per-use schemes that come into play as soon as you want to do anything serious with the data, and both have suffered their developer communities significant amounts of non-backwards-compatible disruptive versioning, changes and feature deprecation.

Endpoint
http://bcmoney-mobiletv.com/widgets/games/rps/soap

Web Service Description Language (WSDL)
This is the “contract” part of SOAP that tells SOAP clients how to interact with our Web Service. In general, you can reach the WSDL of a SOAP-based Web Service:
http://bcmoney-mobiletv.com/widgets/games/rps/soap?wsdl

A useful tool for validating your WSDL is the W3C WSDL Validator service.

XML Schema (XSD)
I’m a big fan of keeping the same basic format between requests and responses rather than many Web Services out there with vastly different request and response formats. This just creates unnecessary work writing (or annotating/generating) distinct XML parsers.

Request format:

 <rps>
  <game id="1234">
    <player id="1234#p1">
      <choice>PAPER</choice>
    </player>
    <player id="1234#p2">
      <choice="SCISSORS</choice>
    </player>
   </game>
 </rps>

Response format:

<rps>
  <game id="1234">
    <player id="1234#p1" outcome="WON">
      <wins>5</wins>
      <losses>4</losses>
      <draws>2</draws>
    </player>
    <player id="1234#p2" outcome="LOST">
      <wins>4</wins>
      <losses>5</losses>
      <draws>2</draws>
    </player>
   </game>
 </rps>

Notice how only the data underneath the player element changes between request and response, and the two formats are virtually identical.

For more easily visualizing WSDL’s available operations and the data formats within each operation’s response check out the XML Grid – XSD/WSDL Viewer service.

Check some of the classic SOAP API examples that are still around today including Amazon’s Product Adveristing API (WSDL) which I’ve previously used as a product data source in my XmasListz Facebook App or the WebServiceX Currency Exchange API (WSDL) which was used in my post on how to work with SOAP in JavaScript & jQuery.

See the other parts here:

Moving a command-line PHP Rock Paper Scissors game to the Browser

Posted by bcmoney on December 1, 2016 in Gaming, PHP with No Comments


No Gravatar
Rock-paper-scissors chart

Rock-paper-scissors chart (Photo credit: Wikipedia)

In the first part we saw an example for creating a PHP Rock Paper Scissors game that waits for user input via the command-line and then evaluates the output of the game. Next we see an example for porting our basic command-line PHP Rock Paper Scissors game to the browser to reach a broader audience, since well, not that many people play command-line games these days.


Benefits of the Browser

With a Browser we have a few more useful tools at our disposal, as we can start to keep track of games played (wins/losses) over the lifetime of a particular user session. We also have the potential to open up the game to multiplayer more easily, as a player could play against others if we added a login mechanism (while a proper multi-user session persistence and secure login/logout mechanism is outside the scope of this example, a simple demo will be presented for enabling “play against a friend” mode with unique Game IDs).


Sessions

Sessions in PHP combine the use of short-term server-side persistence which lasts the lifetime of the page our code sits on, in combination with Cookies to extend that lifetime beyond an accidental page reload or tab close so that a session can be resumed. When you use a Session you’ll get a session ID of the name:

PHPSESSID

With a long unique alphanumeric identifier, such as:

49cdf231ddf8502e307c437ef98fd632

The Cookie representing this name/value pair looks roughly as follows (as viewed in the CookieManager+ plugin for FireFox):
In raw text that Cookie would look simply like this:

PHPSESSID=hfdvcdrj8hr6p6blkg9tt00av6; path=/; domain=gtk.php.net

And the value will be passed with each request from the client to the server along with the regular HTTP Headers (User-Agent, etc), in order to identify our device/browser/OS combination. It looks like this:

Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Connection keep-alive
Cookie PHPSESSID=hfdvcdrj8hr6p6blkg9tt00av6; LAST_LANG=en; COUNTRY=NA%2C156.34.241.222
Host gtk.php.net
Upgrade-Insecure-Requests 1
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0


Multiplayer

Multiplayer in the traditional sense would require a scalable, dedicated server for connecting large pools of users or a sophisticated P2P routing algorithm. Ideally, these days, a P2P networking solution would be used to enable direct communication between the parties playing a game together.

 

Read the rest of this entry »

BC$ = Behavior, Content, Money

The goal of the BC$ project is to raise awareness and make changes with respect to the three pillars of information freedom - Behavior (pursuit of interests and passions), Content (sharing/exchanging ideas in various formats), Money (fairness and accessibility) - bringing to light the fact that:

1. We regularly hand over our browser histories, search histories and daily online activities to companies that want our money, or, to benefit from our use of their services with lucrative ad deals or sales of personal information.

2. We create and/or consume interesting content on their services, but we aren't adequately rewarded for our creative efforts or loyalty.

3. We pay money to be connected online (and possibly also over mobile), yet we lose both time and money by allowing companies to market to us with unsolicited advertisements, irrelevant product offers and unfairly structured service pricing plans.

  • Archives