#retry design pattern c
Explore tagged Tumblr posts
codeonedigest · 2 years ago
Text
Retry Design Pattern for Microservices Tutorial with Examples for API Developers
Full Video Link https://youtu.be/sli5D29nCw4 Hello friends, new #video on #retrypattern #designpattern for #microservices #tutorial for #api #developer #programmers is published on #codeonedigest #youtube channel. @java #java #aws #awsclo
In this video we will learn about Retry design pattern for microservices.    In a microservices architecture, the retry pattern is a common pattern for recovering from transient errors. An application lost connectivity for a short period of time. A component is unavailable for a short period of time. This usually happens during maintenance or automatic recovery from a crash. A component is…
Tumblr media
View On WordPress
1 note · View note
toknowmore · 4 years ago
Text
Utilizing Payment investigation and experiences to develop your business
Presently like never before, associations approach a lot of information that can be utilized for their potential benefit. This period of large information and examination has permitted dealers to settle on more key and educated operational choices. Be that as it may, the space of installments has frequently been sidelined in the streamlining of information. While putting resources into examination for regions, for example, advertising is more normal, one ought not belittle the possible effect of installment information and bits of knowledge. Given the development in online exchanges, this moment is the ideal opportunity to figure out how to use inside and out detailing highlights for online installments. This will empower dealers to essentially diminish their expenses as well as produce higher incomes. Allow us to investigate how this is accomplished.
Client conduct One manner by which traders can build their income is by better obliging their clients. To do this, they need to have perceivability on their clients' shopping designs, featuring the regions that require improvement. By knowing the clients' exchanges history, the nation they're from, installment techniques and monetary forms they execute in, how regularly they shop and what their normal exchange esteem is, traders can measure their clients' inclinations and conduct. This gives them a superior comprehension of installment techniques and highlights they should offer to help changes and lessen truck quitters. Singular client profiling should likewise be possible utilizing each client's record subtleties and gadgets plotted against different clients on a strong interconnected client personality diagram. This permits one to perceive and separate ordinary steadfast clients from the rest, break down these client sections and offer them client unwaveringness rewards. On account of clients who are not dynamic any longer as seen with a decrease in their exchanges, traders may likewise think that its advantageous to offer them designated advancements. There is additionally much more that should be possible with the stashes of experiences acquired from such a chart. In the event that one trusts in the well-known adage "Client is King", the requirement for such an examination arrangement is very clear. Acquirer wellbeing check Vendors with a Multi-acquirer arrangement can significantly profit with bits of knowledge on the entirety of their acquirers. It's imperative to collaborate with an installment stage that can make a solidified dashboard utilizing a huge number of data like the acquirer's foundation wellbeing, execution, and noteworthy history. A wellbeing check of such kind would incorporate every acquirer's prosperity rate, purposes behind fruitless exchanges, money based change rates, and simple to-explore dissemination diagrams for something similar. At the point when an acquirer is working in numerous monetary standards, their transformation rates for every money may fluctuate. For example, an acquirer may perform preferred in USD over they do in EUR. These experiences empower dealers to add or take away various monetary standards from acquirers and thus, upgrade their exchange achievement rates. As consistently calls for new exchanges and insights on the equivalent, it is observational for shippers to monitor the progressions in information and change their installment methodologies in like manner. On the off chance that a trader detects an example of ineffective exchanges, this may demonstrate a halfway or full blackout on the acquirers' end. For this situation, one can utilize falling where failover exchanges are consequently shipped off an optional gaining bank. When settling on acquirers, shippers are presently ready to arrange savvy exchange steering (ITR). ITR has been known to advance the steering of exchanges while permitting the expense effective progression of business tasks. Peruse more regarding this matter in our blog: What you should think about Intelligent exchange steering Experiences into singular exchanges Other than the previously mentioned investigation, conditional information can likewise be used on a more granular scale. The information followed incorporates the beginning of every exchange, how frequently the client retried the installment, and why it fizzled. This guarantees that information on a total level or in compromise reports are effectively detectable, adding to information quality. Also, having broad conditional information for each and every installment can extraordinarily improve traders' client support capacities. For example, if a client documented a grumbling identified with the acquisition of an item, the trader could without much of a stretch check the exchange being referred to and recognize the issue, speedily adjusting the client and tackling their objection. Additionally, in the event of a bombed installment, a shipper could use singular exchange information to quickly check the mistake and send the client an alternate installment choice, for example, pay-by-connection or QR-code installment, at last upgrading consumer loyalty. Webstore examination Finally, it is critical to bring up that installment examination ought not be an independent usefulness, but instead incorporated with the remainder of the webstore's investigation, like Google Analytics. This can expand the value of information by permitting vendors to see new associations, examples, and experiences from the entire client venture. The accumulation of installments and webstore examination additionally implies that traders don't have to sign in at various places and endeavor to coordinate with information or battle to extricate some important data from isolated information records. All things considered, they can see the entire client venture on one dashboard with all the data merged progressively. Subsequently, incorporating webstore investigation with installment information works on the information examination measure and gives a total perspective on the customer. Plainly, there is no seriously cutting and dicing of information! Conclusion It is protected to say, banding together with an installment stage that effectively totals and cycles information while at the same time giving significant ongoing examination, is the best approach. Such experiences would then be able to be utilized to expand the organization's everyday proficiency and coherence. It engages senior administration to all the more likely comprehend the regions that need their consideration. Alongside this, directing data empowers the simple location of issues and assists one with setting key steering rules for future arranging. Having definite exchange data across all channels and geologies additionally permits dealers to perceive and anticipate installment patterns while growing abroad. Generally speaking such an answer is a significant resource with regards to momentary dynamic and business examination for the shippers. At WLPayments we offer an assortment of top to bottom revealing highlights that you can investigate.
0 notes
synthesia233-blog · 6 years ago
Text
Something Awesome Project#1
CAPTCHA
A CAPTCHA (an acronym for "completely automated public Turing test to tell computers and humans apart") is a type of challenge–responsetest used in computing to determine whether or not the user is human. (From wiki)
The CAPTCHA has been improved as the oldest CAPTCHA is too simple and easy to be solved by machine.
Tumblr media
This CAPTCHA is created by twisting the letters and adding slight background color gradient.
Tumblr media
CAPTCHA can be created by fuzzifing the letters.
Tumblr media
The waviness and horizontal stroke were added to increase the difficulty of breaking the CAPTCHA with a computer program.
http://antimatter15.com/ocrad.js/demo.html
A program that can recognite the letters in a picture.
Why we need CAPTCHA? 
(https://www.maxxor.com/blog/why-do-we-need-captchas/)
CAPTCHA can identify wether the user is a human or robot, in other words, CAPTCHA can prevent robots doing something we don’t want them to do. For example, robots can register hundreds of email accounts and send junk email to everyone again and again. Also, robots can buy multiple limited tickets on websites instantly and resell the tickets in other ways. What’s more, robots can bombard comment sections in a few seconds and push the blog or news to the top of the searching rank. Besides, we can hide some information that we don’t want robots to get by using CAPTCHA such as your account profile, which can be used for internet harassment.
However, if we ask users to input CAPTCHA before these operations, we can prevent the internet from ruinning by the robots.
Most CAPTCHAs are based on texts. However, there are CAPTCHAs the are completely distorted so that even human can hardly recognize the answer. Also, there are CAPTCHAs that are rarely distorted and can be read by a robot easily. To solve this problem, graph-based and sound-based CAPTCHAs are created.
Tumblr media
reCAPTCHA
reCAPTCHA is a CAPTCHA-like system designed to establish that a computer user is human (normally in order to protect websites from bots) and, at the same time, assist in the digitizationof books or improve machine learning. reCAPTCHA was originally developed by Luis von Ahn, David Abraham, Manuel Blum, Michael Crawford, Ben Maurer, Colin McMillen, and Edison Tan at Carnegie Mellon University's main Pittsburgh campus. It was acquired by Google in September 2009. 
reCAPTCHA v3 by Google:
https://youtu.be/tbvxFW4UJdU 
A Frictionless User Experience
Over the last decade, reCAPTCHA has continuously evolved its technology. In reCAPTCHA v1, every user was asked to pass a challenge by reading distorted text and typing into a box. To improve both user experience and security, we introduced reCAPTCHA v2 and began to use many other signals to determine whether a request came from a human or bot. This enabled reCAPTCHA challenges to move from a dominant to a secondary role in detecting abuse, letting about half of users pass with a single click. Now with reCAPTCHA v3, we are fundamentally changing how sites can test for human vs. bot activities by returning a score to tell you how suspicious an interaction is and eliminating the need to interrupt users with challenges at all. reCAPTCHA v3 runs adaptive risk analysis in the background to alert you of suspicious traffic while letting your human users enjoy a frictionless experience on your site.
More Accurate Bot Detection with "Actions"
In reCAPTCHA v3, we are introducing a new concept called “Action”—a tag that you can use to define the key steps of your user journey and enable reCAPTCHA to run its risk analysis in context. Since reCAPTCHA v3 doesn't interrupt users, we recommend adding reCAPTCHA v3 to multiple pages. In this way, the reCAPTCHA adaptive risk analysis engine can identify the pattern of attackers more accurately by looking at the activities across different pages on your website. In the reCAPTCHA admin console, you can get a full overview of reCAPTCHA score distribution and a breakdown for the stats of the top 10 actions on your site, to help you identify which exact pages are being targeted by bots and how suspicious the traffic was on those pages.
Fighting Bots Your Way
Another big benefit that you’ll get from reCAPTCHA v3 is the flexibility to prevent spam and abuse in the way that best fits your website. Previously, the reCAPTCHA system mostly decided when and what CAPTCHAs to serve to users, leaving you with limited influence over your website’s user experience. Now, reCAPTCHA v3 will provide you with a score that tells you how suspicious an interaction is. There are three potential ways you can use the score. First, you can set a threshold that determines when a user is let through or when further verification needs to be done, for example, using two-factor authentication and phone verification. Second, you can combine the score with your own signals that reCAPTCHA can’t access—such as user profiles or transaction histories. Third, you can use the reCAPTCHA score as one of the signals to train your machine learning model to fight abuse. By providing you with these new ways to customize the actions that occur for different types of traffic, this new version lets you protect your site against bots and improve your user experience based on your website’s specific needs.
In short, reCAPTCHA v3 helps to protect your sites without user friction and gives you more power to decide what to do in risky situations. As always, we are working every day to stay ahead of attackers and keep the Internet easy and safe to use (except for bots).
CAPTCHA VS reCAPTCHA
https://bestwebsoft.com/captcha-vs-recaptcha-what-to-choose/
Everyone knows that CAPTCHA is a system testing whether the user is human or not. It is a popular tool since it prevents spam attacks and protects websites from bots. 
Both tools provide the same functionality increasing the security level of your websites, but the way of how it looks is different.
Captcha asks you to complete the math equation like addition, subtraction, or multiplication. The equation can show up using numbers, letters, or images, therefore bots have no chances.
Tumblr media
ReCaptcha is a system similar to captcha which also serves to protect the website and, at the same time, assists in the digitization of books (even its slogan was “Stop Spam, Read Books”). It supports two versions. The first offers you to enter some words or digits from the image, and the second offers you to mark the checkbox “I’m not a robot”.
Tumblr media Tumblr media
Captcha and Recaptcha do the same thing, but in different ways. They also have differences in their features.
Tumblr media
Programming
Actually there are quite a lot code of CAPTCHA recognition on github and I prefer to use python code.
https://github.com/PatrickLib/captcha_recognize (failed) https://github.com/dee1024/pytorch-captcha-recognition (worked)                        
This program includes a train set, a test set and a predict set which can recognize 4 letters CAPTCHA with numbers and uppercase letters.
Run in python, I generated 100000 CAPTCHAs to train and it seems will take a long time to finish.....
Tumblr media
Waiting for the completion...
After more than 10 hours work, the result finally came out. However it shows only about 5% accuracy.....
Retry the trainning with 10000 samples and 16 epoches, the test result was about 7.5% accuracy. Still too low.
Tumblr media Tumblr media
Try again with trainning 100000 samples and the test result was about 98% accuracy.
Tumblr media
Now it can identify some captchas.
https://github.com/hanc00l/captcha-python-test(partially feasible)
Can only recognize some easy captchas
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
0 notes
kelsusit · 7 years ago
Text
Dell Computer
– A great spot to buy computer systems, personal computer parts, electronics, software program, accessories, and DVDs on-line. (16) Faculties and Perform Units ought to make every effort to replace laptop workstations much more than three years old due to the threat of the equipment not getting reputable for use or capable of supporting the University’s SOE. Technology Services do not support or keep out of warranty computer workstations. This table shows the approximate calendar year in the course of which pick Dell pc models had been originally released. The models shown here are those most frequently purchased for use by faculty and employees who acquire support from ECN’s User and Desktop Services group. To swiftly estimate your computer’s age, simply uncover it in the table.
youtube
This was such a nightmare to troubleshoot that I just had to document the procedure. In my scouring the internet, I discovered several like me experiencing the very same woes in setting up their WOL. My whole objective for doing this was in the interest of saving energy. I could place my computer to sleep and nonetheless be capable to wake it up remotely so I can RDP (Remote Desktop Protocol) into it to access my files while away. EDIT: I recently discovered this great article on WoWLAN by Andrew vonNagy which information some of the positive aspects and downsides to using this technology, and gives a good cost analysis for an organization case study. Verify it out if you’re interested in the Wireless WOL.
Our Quiet Workstation Pc is our Intel 5th Generation (Socket 1151) Xeon E3 Powerhouse Pc developed for the executive who needs a price-successful Computer, where reliability, up-time, stability, and wide compatibility are the foremost priorities. To get hardware and application help as shown in the list below, your pc need to run either the Mac OS X operating program (version 10.7 or later) or the Windows operating system (version 7 Enterprise or version 8.x Expert). If you have an unsupported OS X or Windows OS version, our CRC consultants can help you upgrade. There is only limited “best effort” computer software support for desktop Linux distributions.
No disk that can be employed for recovering the technique disk can be found. Attempt the following: 1) A probable program disk may have been excluded by error. a. Evaluation the list of disks that you have excluded from the recovery for a most likely disk. b. Kind LIST DISK command in the DISKPART command interpreter. The probable technique disk is normally the 1st disk listed in the benefits. c. If attainable, remove the disk from the exclusion list and then retry the recovery. two) A USB disk could have been assigned as a technique disk. a. Detach all USB disks from the pc. b. Reboot into Windows Recovery Environment (Win RE), then reattach USB disks and retry the recovery. three) An invalid disk may possibly have been assigned as technique disk. a. Physically detach the disk from your laptop. Then boot into Win RE to retry the recovery.
Workstations tended to be really high-priced, generally a number of times the expense of a normal Pc and occasionally costing as considerably as a new vehicle However, minicomputers sometimes expense as considerably as a house. The high expense typically came from utilizing costlier elements that ran faster than those located at the local personal computer shop, as nicely as the inclusion of characteristics view it now not identified in PCs of the time, such as high-speed networking and sophisticated graphics. Workstation companies also tend to take a “balanced” strategy to system design, making certain to keep away from bottlenecks so that information can flow unimpeded between the numerous various subsystems inside a pc. Moreover, workstations, provided their a lot more specialized nature, have a tendency to have higher profit margins than commodity -driven PCs.
Immerse your self in operate or entertainment in ergonomically engineered luxury and comfort. The Droian’s circular frame and dual monitor setup offers a shelter from visual distractions and offers privacy while you work, creating a distraction-cost-free atmosphere for the user. Designed with genuine leather energy seat, constructed-in seat warmer and cooler, and lumbar support, the Droian is the future of ergonomic personal computer workstations. Perfectly developed as a spending budget workstation Computer, our Workstation Personal computer will operate completely in a very-utilized management atmosphere and will excel at executive tasks, which includes accounting, database management, spreadsheets, and so on. This workstation is the perform-horse of the office. We base our Workstation Laptop around the trustworthy and robust Supermicro X11SAE-F.
Personal computer workstations come in a selection of shapes and sizes. Totally recessed monitor workstations are single student desks that are typically configured in rows and are designed to home a personal computer, monitor, mouse and keyboard whilst nonetheless enabling students to have a huge work surface. These workstations also supply a certain quantity of protection from damage to the pc. Rolling lectern style laptop workstations offer just adequate desk leading surface for a laptop pc, mouse and information projector. Pneumatic stand-up style laptop workstations are also usually just huge adequate for an typical sized personal computer. ADA pc workstations are specially developed for students in wheel chairs, but are also useful when a flexible personal computer workstation is required for students of varying sizes.
So in order to explore this concept a little further and in greater detail we will now cover some essential differences amongst a workstation Computer and a regular computer in the CAD workstations – what’s the distinction section. At initial glance, a workstation and a desktop may possibly not look that different, but on the inside, these are two quite distinct systems. Workstation PCs have a lot of energy and operate at a higher-functionality, but they also come with a steep cost tag. Desktops might not have as significantly power as workstations, but they provide a lot of bang for the buck, specifically if you do not need all the higher-end features.
An operating method (sometimes abbreviated as “OS”) is the program that, soon after becoming initially loaded into the laptop by a boot system, manages all the other applications in a computer. It offers a platform to application software. A significant segment of the desktop industry are computers anticipated to perform as workstations, but making use of Pc operating systems and components. Component makers will often segment their item line, and market premium elements which are functionally equivalent to the more affordable “customer” models but function a greater level of robustness or efficiency.
“Dude! You are getting a Dell.” Those words are as prophetic today as they had been 15 years ago, when Dell and a scrappy spokes-teen introduced the now iconic phrase into the lexicon of American pop culture. But it was an additional young upstart who was accountable for the meteoric rise of the tech firm: Michael Dell. At the age of 19, Dell borrowed $1,000 from his family to start what he was then calling PC’s Limited. Whilst nevertheless a student at the University of Texas at Austin, Dell operated the fledgling enterprise out of his dorm room, and inside a year he had designed a laptop that sold for significantly less than an IBM machine. The outcome was practically immediate recognition, and a gushing report in Computer Week catapulted the company into the spotlight.
This Workstation Pc attributes ample expansion slots, USB 3.1, and VGA video capabilties proper from the board (DP, HDMI, and DVI-D from the board when paired with a E3 v5 CPU featuring Intel® HD Graphics P530). Walking towards the 3 computers near the escalators, the rightmost (ROW302) is a LIRA workstations. A wide assortment of Modular Computer Workstations is supplied by us to consumers in bulk at most reasonable prices. The provided Modular Personal computer Workstations are designed by us as per the requirements of the buyers. Modular Pc Workstations are mainly identified for their longer shelf life.
(19) All computer workstations will have a 3-year on-web site warranty which is serviced by approved local vendors with certified computer support staff guaranteeing that the computer is repaired swiftly and at no cost throughout its 3-year life. The Software program Licensing Service reported that the laptop could not be activated with a Volume license solution crucial. Volume-licensed systems call for upgrading from a qualifying operating technique. Please speak to your system administrator or use a different sort of important.
A handful of hours later I get a telephone contact back from the guy (Indian) who says that I need to confirm that I’m a actual individual. I give him my delivery address specifics and e mail address. He has an situation with my hotmail address (which is 1 that I’ve had for more than 15 years and utilised to purchase all of my computers in the past). Apparently because everybody can sign up for a hotmail account it is not excellent sufficient to confirm that I am a real particular person. He wants me to send an email from my perform address. I dispute this simply because I am acquiring this laptop for private use. Ultimately I give up and tell him that I will do this in the subsequent 5 minutes. I get an immediate “out of office” reply back from the email address. No indication of whether my order has been moved out of the holding pattern it was presently in.
We pride ourselves on being a computer and technologies & full service company. We stock all properly-recognized laptop brands and carry one particular of the ideal assortments of desktop computer systems – Perth has to provide. If you are seeking for accessories or further hardware for your house technique, browse our online catalogue. We also supply maintenance and repairs solutions, keeping you working, playing and gaming from house or office, with minimal disruption.
Filed under: Tagged: computer, inspiron, personal from KelsusIT.com – Refurbished laptops, desktop computers , servers http://bit.ly/2A1AmoM via IFTTT
0 notes
shashikant86 · 8 years ago
Text
Stabilizing the CI By Re-runing Flaky iOS XCUI Tests
  Apple has released Xcode UI Testing a.k.a XCUI Test framework at WWDC 2015 which enable UI testing of iOS application straight from Xcode without any third party tools like Appium, Calabash or KIF.  These tools that call themselves mobile testing frameworks but they’re actually little more than wrappers to UIAutomation or Instruments.  The release of iOS 10 has broken all these open-source mobile test automation frameworks as Apple stopped supporting Instruments technology. The only options remained was to use XCTest framework from Apple or wait for those tools to build a wrapper around XCUITest.  XCTest is not a new framework but it has evolved quite well with Xcode releases. You can read more about Pros and Cons of using XCTest for iOS app testing here
XCUITest + Continuous Integration Problem
XCUITest framework is still new and some users already complained it’s very fragile especially when we run against Continuous Integration (CI) server. XCUI tests seems to be passing locally but those tests are nondeterministic on CI. You can find lot’s of questions about XCUITest on StackOverflow. The result of that is, CI pipeline become unreliable and  untrusted. The teams keeps ignoring  failing UI tests and everybody loose trust on those UI Tests which can become reason for Continuous Integration failures. The broken UI tests are always being ignored by the development team. However,  Continuous Delivery won’t allow broken build to be deployed to production. Now, everyone have attention to broken UI Test. In order to fix the problem team might have done the following to ensure your UI tests are as resilient as possible
Followed ‘Ports and Adapter‘ pattern to cover all business logic at domain layer without writing any UI Tests. The good example of this would be writing faster iOS acceptance tests or contract tests with Fitnesse
Considered  testing UI in isolation using stub backends or mock web server to guard against unexpected data to replace real word UI tests.
Added XCUI computed retry  to find UI element on application or loop until XCUIElement found.
Resetting simulators on each CI build or each test suite.
Added Static wait to XCUITests to make tests reliable.
After doing all this efforts, perhaps few tests are still non-deterministic and  fails randomly and people gets frustrated. This is general behaviour of the UI tests, they are fragile, brittle and hard to maintain, no matter how much efforts you put to fix or how much you defend against it peculiarities of the runtime environment can conspire against you.
Now that, your release to production is blocked because of the flaky UI tests. What to do now ?
Solution
In the scenario mentioned above, we can try one sensible thing. Let’s take just failing XCUITests and try to re-run them but hang one, there is another problem. Apple’s command line tool ‘xcodebuild‘ still not have easy way to run single XCTest from command line. It can take Xcode schemes to test but it’s bit tricky to pass individual tests to ‘xcodebuild’.  The new version of ‘xcodebuild’  has ‘only-testing’ option but it’s bit hard to implement with script. Fortunately, there is a fastlane plugin called ‘fastlane-plugin-setup_fragile_tests_for_rescan‘  to rescue from the problem of flaky XCUI Tests. The full credit goes to author of the plugin ‘lyndsey-ferguson‘ . This plugin does following things
Takes failed tests from generated Junit reports from fastlane scan
Modifies specified XCUITest scheme to skip passed test and failed tests to scheme
Re-runs ‘scan’ 3 times to see the results of test.
This make sense to fix the current CI and get going but ideally,  non-determinstic test should either be fixed for good or deleted however sometimes the world is just not that perfect, maybe for example you aren’t able to improve underlying infrastructure issues etc etc. Hence this may still be a valid course of action.
Let’s see that in Action
Just to demo re-runing failed XCUI tests, I have created an demo iOS app called ‘CoinTossing‘. This application has a “Toss” button and the textField showing result of toss either “Heads” or “Tails”. We also have couple of XCUI Tests to check the results. The probability of failing test is 50%.
Create XCUITest Scheme and Share it
Let’s create new scheme for XCUITest and call it “CoinTossingUITests” and make it ‘Shared” so that CI can see it and  we can pass to fastlane scan.
  Setup Fastlane with Plugin
Now that, we will setup fastlane from Gemfile and bundler. We need to have ‘bundler’ gem installed.
Add fastlane to ‘Gemfile’
source "http://ift.tt/JAcC9p; gem "fastlane"
Now we can install bundle with command
$ bundle install
This will download all the required fastlane tools. We will create ‘Fastlane’ directory manually and add empty Fastfile.
$ mkdire Fastlane $ touch Fastlane/Fastfile
Now we need to add the fastlane plugin to the project using command.
$ bundle exec fastlane add_plugin setup_fragile_tests_for_rescan
This will ask permission to change ‘Gemfile’ type ‘y’ to allow. This will create another file in the ‘Pluginfile’ inside ‘Fastlane’ directory.
Now we have setup our plugin which is ready to use. Let’s add the following code to Fastfile.
lane :test do |options| scheme_to_test = "CoinTossingUITests" scan_options = { scheme: scheme_to_test, device: 'iPhone 6', output_directory: 'artifacts/tests', custom_report_file_name: 'report.xml' } begin retry_count ||= 0 scan(scan_options) rescue => e UI.important("failure noted: #{e}") report_filepath = File.absolute_path('../artifacts/tests/report.xml') unless File.exist?(report_filepath) raise e end if (retry_count += 1) < 3 setup_fragile_tests_for_rescan( project_path: File.absolute_path('../CoinTossing.xcodeproj'), scheme: scheme_to_test, report_filepath: report_filepath ) clear_derived_data reset_simulator_contents if retry_count > 1 retry end end end
Note that, we are passing ‘CoinTossingUITests’ scheme to the fastlane scan and  running scan 3 times if test failed. Now that, we should able to run ‘test’ lane
$ bundle exec fastlane test
We should be able to see the tests running and if test failed only failed tests will be run again. This will modify out original ‘CoinTossingUITests’ scheme.
  Setup CI Server with Travis
The Fastlane plugin  ‘fastlane-plugin-setup_fragile_tests_for_rescan‘ modifies the scheme and add only failed tests for re-running. It uses ‘xcodeproj’ gem to modify the scheme settings which is the same library that Cocoapods use to change Xcode settings and files. This plugin is  not designed to run locally. The idea is to run them on CI server where we don’t care if scheme is getting modified as we checkout fresh source code for every build. Let’s add TravisCI config to the project so that we can run it on CI server.  Now, enable repository to run on TravisCI and Create ‘.travis.yml’ file with following code
os: - osx osx_image: xcode8.2 xcode_sdk: iPhone 7 (10.2) language: objective-c before_install: - rvm install 2.3.3 - rvm use 2.3.3 - gem install bundler - bundle install # cache: cocoapods script: - pwd - xcrun simctl list - bundle exec fastlane test
Now, we should be able to run those tests on TravisCI. Checkout the latest output from TravisCI here
Try Yourself
The source code for this demo is available on GitHub repo ‘CoinTossing‘. In order to quickly check how plugin works. Clone the project and try running test. Assuming you have Ruby environment setup,  you can run following commands to test this
$ git clone http://ift.tt/2jmbcsu $ cd CoinTossing $ gem install bundler $ bundle install $ bundle exec fastlane test
Now, you can see the tests starts running in the simulator. Observe the test output, if one the test fails it should see that plugin will re-run that tests couple more times as shown in the above GIF.
Things to Remember
Now that, we should be ale to re-run failed XCUI tests in order to make CI happy and carry on however there are couple of things we should remember before we do this
 Do not run tests with Fastlane plugin locally. This plugin modifies the scheme and we have to make sure we revert the changes made by plugin. This plug should only be used on CI server
The flaky and non-determinstic test should either be fixed for good or deleted
Keep the retry ‘scan’ count 3 if test fail after couple of time then there is real issue with the test.
Currently we are clearing simulators if retry count is more than 1 but it’s up to you if really wanna clear the simulators.
Conclusion
Apple’s new Xcode UI Testing framework might be little flaky on CI server but we can re-run the flaky tests using the Fastlane plugin to make the XCUITests more robust and reliable. Hopefully this will help to reduce your pain  of flaky XCUI Tests on CI server.
The post Stabilizing the CI By Re-runing Flaky iOS XCUI Tests appeared first on SHASHIKANT JAGTAP .
via SHASHIKANT JAGTAP http://ift.tt/2jm5Pd0
0 notes