Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
4.4k views
by
retagged by
I have a test case where I am supposed to scan a barcode. How do you do that?

Like, I have a web application that generates the barcode. And, I open my mobile app to scan that barcode.
by Contributing Tester (79 points)
Release cycles are shortening like never before! Automation testing, is now, thus, a necessity. To support faster time to market, fully automate your regression tests using our recently launched QAppAssure Automation Testing platform.
 
Read through MOZARK’s recent blog on How QAppAssure (https://aquamark.mozark.ai/QAppAssure/ ) can help Automation Testers leverage our APIs and real device cloud to reduce their testing times.
 
Blog link - https://mozark.ai/blogs/qappassure-bring-back-the-focus-to-what-really-matters-quality-of-user-experience/
 
And don’t forget to avail your free trial. It’s FREE for a limited time period!

5 Answers

1 like 0 dislike
by
Is this a mobile app or a website?

If it's a mobile app then you can instrument the camera API to inject an image or video of your choice. This is a reliable, consistent way to substitute manual testing and expand your coverage to include various scenarios, depending on what you wish to test: different barcodes with various content, or various visual conditions such as smudging etc. You simply prepare in advance a set of images representing different scenarios.

If it's a web page then we're talking HTML5 or PWA, in which case I'd recommend using Javascript in automation to overload the action when the page wants to open the scanner and instead inject an image from a local folder. (disclaimer: I've not tried that one yet..).
1 like 0 dislike
by Contributing Tester (31 points)

Appium has a function to do it. You can start Appium with flag settings set to relaxed security. After that you are able to use adb commands and then you can use the command mobile:shell. So you are able to use the cmd. You ask the Developers for the barkode key and barcode type and go for it. with 

adb shell am startservice -n "youraddress" --es "barcode_key" "yourbarcodekey" --es "barcode_label_type" "DUMMY"

by New User (10 points)
Hey, do you know if there is any sample project in git using the mobile scanner barcode function?
0 like 0 dislike
by
Hi

The way to automate these scenarios involve image injection methods that can be either done by pointing one device to the other with either the camera on or the expected image in front and using appium framework validate this. For that you need to control the lab so you setup both devices one in front of the other.
0 like 0 dislike
by New User (11 points)

Here I show how this can be done with a quite simple setup: QR code scanning UI test automation

Basically I use two phone: One showing the QR code and the other one running the test. Then I control both devices to run the test.

0 like 0 dislike
by Contributing Tester (79 points)

Hello,

You can use QAppAssure https://aquamark.mozark.ai/QAppAssure/ by MOZARK. Their APIs are the most comprehensive I have ever used.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...