Why You Should Be Testing in Production
Sauce AI for Test Authoring: Move from intent to execution in transactions.|xBack to ResourcesBlogPost
Sauce AI for Test Authoring: Move from intent to execution in transactions.
|
x
Blog
Why You Should Be Testing in Production
Testing in production means that new code changes are tested on unrecorded user traffic. Find out why testing in product can better your QA process.
Testing any software labor is an important step in order to find out how the software use. Learning when the project acts as expected (and when it perform not) is the ultimate goal of the testing process. Testing stops design errors from gain production codification. However, quiz should not only hap before code is deploy.
Because so much can go wrong initially, Quality Assurance engineers have traditionally set up a present area to manage testing, in hopes that problems will shew up in this scaffolding environment before they can affect exploiter.
However, this staging area is not where users will be affect with the undertaking. The examination staging area can mimic, but not genuinely recreate, the environment in which the project will actually be used.
Tests that use the production data kinda than a staging area will give QA a much best idea of what actually happens when real users start to interact with their projects.
What is testing in production?
Testing in product (TIP) mean that new code changes are test on alive user traffic rather than in a staging environment. It is one of the testing drill used by continuous delivery.
Continuous deliverygets codification alteration into production using tool to automate the deployments. Engineering teams will do changes to their software in short cycles, so that it can be screen and released more oft.
Benefits of testing in product
TIP hopefully ensures code functionality in the environment that the code features occupy. At the end of the day, no one care if features work in staging; they care if they work in production. The only way to know if they work in production is to essay them in production.
By moving to TIP, QA can besides avoid the wasted effort of having to set up a scaffolding area where preliminary examination occurs. Effort is always demand to create a staging test environment that reflects the actual use environment. By screen in the place where usage will pass, that sort of unnecessary attempt can be eliminated.
Given the dependencies that are present in modern production system as good as the many potential edge instance, production testing has go a growing portion of devops and software try. Companies such as Google, Netflix, and Amazon routinely test new features (albeit to a fraction of their user base) through the use of production testing.
Should you test in product?
TIP as a method comes with bounds. To be able to use this approach, the production codification affected needs to be resilient plenty to rebound from any testing-induced mischance. Poorly document and fragile legacy code that has ended up being used in product may not be resilient enough to avoid this pitfall.
If the code to be tested is restrain in orbit, TIP can add to the length of a tryout. As an example, if only part of the product code is affected by new codification, the production codification must be brought to the correct state of execution to allow a relevant test. This can increase the number of steps in the testing process that are needed just to attain that relevant codification state.
How To Implement TIP
The tool habituate to apply TIP will usually be either (for browser UIs) or (for mobile apps). Both are open-sourced with wide developer support.
Let ’ s start with Selenium. For running an end-to-end verification or the integration test of a specific UI lineament, Selenium may be just the thing.
Packages.json is the first specification that will be postulate. For Selenium, Chromedriver (Chrome is the examination browser hither) and a trial runner (Nunit) it would look like:
id= & quot; NUnit & quot; version= & quot; 3.8.1 & quot;
id= & quot; NUnit3TestAdapter & quot; version= & quot; 3.8.0 & quot;
id= & quot; Selenium.WebDriver & quot;
id= & quot; Selenium.WebDriver.ChromeDriver & quot;
Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script.
Getting the driver up is fairly straightforward:
public class ChromeTestBase
{
public IWebDriver _driver;
[SetUp]
public void ChromedriverSetup ()
{
_driver = new ChromeDriver ();
}
[TearDown]
public vacuum TestCleanup ()
{
_driver.Quit ();
}
}
A utility class can conserve some layer of abstraction from the literal driver and the examination. Here, a utility can find an component via XPath. In the test it can be called with the right parameters instead of worrying about what the XPath look like each clip:
public static IWebElement FindElementByXpath (this IWebDriver driver, thread tag, thread attribute, string value)
{
return driver.FindElement (By.XPath ($ & quot; // {tag} [contains (@ {dimension}, & # x27; {value} & # x27;)] & quot;));
}
A utility class can do just about any repeatable task. It may also contain any type of reclaimable data. If you plan on using something more than once, create this case of file.
NUnit will postulate a TestFixture class with some Test ticket. It will get the tags from the TF class and run them.
It sounds simple, but each test should do the minimum involve in order to test what necessitate to be essay. Should other measure be needed to get the code into the right state before the actual trial can be run (such as signing in), a usefulness class or method can be created to perform the repeatable step.
An representative of a Test Fixture is:
[TestFixture]
course Testcases: ChromeTestBase
{
[Test]
public void ErrorMessageAppearsNoNavigation ()
{
//Arrange
_driver.NavigateTo (Urls.WebsiteBase + Urls.SigninPage);
var startingUrl = _driver.Url;
//Act
_driver.FindElementByClass (PageElements.SignInButton) .Click ();
//Assert
Assert.AreEqual (startingUrl, _driver.Url);
}
}
Additional tests could be added in a similar manner in any one of the programming languages that Selenium supports.
Testing mobile
Appiumcan be thought of as Selenium for wandering device. Notably, it percentage Selenium & # x27; s protocols and methodologies. Appium can be used to test Mobile Native App, Mobile Web App and Hybrid App (Native+Web). Appium tests can also run on multiple nomadic platforms. Appium API allows testing on iOS, Android and Windows platforms. It uses vendor-provided automation frameworks for compilation tasks. The supported framework are:
For Android 2.3+ Google ’ sInstrumentation
For Android 4.2+ Google ’ sUiAutomator/UiAutomator2
For iOS 9.3 and lowerApple ’ s UIAutomation
For iOS 9.3 and higherApple ’ s XCUITest
For Windows Microsoft ’ sWinAppDriver
Each tone of the mobile device will command different drivers and automation frameworks in the testing code, similar to how differing web browser need different try codification. Because of these variance in code, a full review of them is beyond the range of this blog. However, the principles utilise in Selenium TIP carry over to Appium tests.
Tests should be abstracted from drivers for best event. Tests themselves should typically not use driver commands straightaway.
Test files, framework setup, helpers, etc. should be in different files that reference each other. This allows leisurely gain to the trial repository while avoiding monolithic file.
Appium Client Libraries enforce the Mobile JSON Wire Protocol (Mobile JSONWP), which is the mobile-specific extension of the JSON Wire Protocol (JSONWP)) expend by Selenium as good as elements of W3C WebDriver specification. The purpose of the clients is to furnish an interface to a give language (like Java, Python, Ruby), while enshroud the protocol details.
Thus, the structure of Appium tests will be familiar to Selenium users with appropriate substitutions in the code for mobile use cases.
Conclusion
Application examination is a high priority for any software development organization. Most organizations prioritize test as lots as possible prior to production deployment (and rightfully so) to ensure the smoothest transition post-deployment. But production testing can provide some unique benefits for a DevOps organization that should not be overlooked. From preparing the team to respond to disastrous circumstances in product to providing a best user experience for the customer, production testing is go more and more of an essential portion of covering testing as time goes on.
Automate This With SUSA
Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.
Try SUSA FreeTest Your App Autonomously
Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.
Try SUSA Free