Visual Unit Tests with Cypress

Unit testing is all great until something changes. The current issue with writing traditional unit tests is that you miss out on the point of front end development — to create experiences for the end user. While unit tests may do very well in determining if an input produces an expected output, it only captures moment in time rather than a complete flow of actual events.

This is where Cypress excels, especially in the end-to-end space.


read more

#web-development #javascript #angular #testing

What is GEEK

Buddha Community

Software Testing 101: Regression Tests, Unit Tests, Integration Tests

Automation and segregation can help you build better software
If you write automated tests and deliver them to the customer, he can make sure the software is working properly. And, at the end of the day, he paid for it.

Ok. We can segregate or separate the tests according to some criteria. For example, “white box” tests are used to measure the internal quality of the software, in addition to the expected results. They are very useful to know the percentage of lines of code executed, the cyclomatic complexity and several other software metrics. Unit tests are white box tests.

#testing #software testing #regression tests #unit tests #integration tests

Mikel  Okuneva

Mikel Okuneva

1596793726

Where To Learn Test Programming — July 2020 Edition

What do you do when you have lots of free time on your hands? Why not learn test programming strategies and approaches?

When you’re looking for places to learn test programming, Test Automation University has you covered. From API testing through visual validation, you can hone your skills and learn new approaches on TAU.

We introduced five new TAU courses from April through June, and each of them can help you expand your knowledge, learn a new approach, and improve your craft as a test automation engineer. They are:

These courses add to the other three courses we introduced in January through March 2020:

  • IntelliJ for Test Automation Engineers (3 hrs 41 min)
  • Cucumber with JavaScript (1 hr 22 min)
  • Python Programming (2 hrs)

Each of these courses can give you a new set of skills.

Let’s look at each in a little detail.

Mobile Automation With Appium in JavaScript

Orane Findley teaches Mobile Automation with Appium in JavaScript. Orane walks through all the basics of Appium, starting with what it is and where it runs.

javascript

“Appium is an open-source tool for automating native, web, and hybrid applications on different platforms.”

In the introduction, Orane describes the course parts:

  • Setup and Dependencies — installing Appium and setting up your first project
  • Working with elements by finding them, sending values, clicking, and submitting
  • Creating sessions, changing screen orientations, and taking screenshots
  • Timing, including TimeOuts and Implicit Waits
  • Collecting attributes and data from an element
  • Selecting and using element states
  • Reviewing everything to make it all make sense

The first chapter, broken into five parts, gets your system ready for the rest of the course. You’ll download and install a Java Developer Kit, a stable version of Node.js, Android Studio and Emulator (for a mobile device emulator), Visual Studio Code for an IDE, Appium Server, and a sample Appium Android Package Kit. If you get into trouble, you can use the Test Automation University Slack channel to get help from Orane. Each subchapter contains the links to get to the proper software. Finally, Orane has you customize your configuration for the course project.

Chapter 2 deals with elements and screen interactions for your app. You can find elements on the page, interact with those elements, and scroll the page to make other elements visible. Orane breaks the chapter into three distinct subchapters so you can become competent with each part of finding, scrolling, and interacting with the app. The quiz comes at the end of the third subchapter.

The remaining chapters each deal with specific bullets listed above: sessions and screen capture, timing, element attributes, and using element states. The final summary chapter ensures you have internalized the key takeaways from the course. Each of these chapters includes its quiz.

When you complete this course successfully, you will have both a certificate of completion and the code infrastructure available on your system to start testing mobile apps using Appium.

Selenium WebDriver With Python

Andrew Knight, who blogs as The Automation Panda, teaches the course on Selenium WebDriver with Python. As Andrew points out, Python has become a popular language for test automation. If you don’t know Python at all, he points you to Jess Ingrassellino’s great course, Python for Test Programming, also on Test Automation University.

Se

In the first chapter, Andrew has you write your first test. Not in Python, but Gherkin. If you have never used Gherkin syntax, it helps you structure your tests in pseudocode that you can translate into any language of your choice. Andrew points out that it’s important to write your test steps before you write test code — and Gherkin makes this process straightforward.

first test case

The second chapter goes through setting up a pytest, the test framework Andrew uses. He assumes you already have Python 3.8 installed. Depending on your machine, you may need to do some work (Macs come with Python 2.7.16 installed, which is old and won’t work. Andrew also goes through the pip package manager to install pipenv. He gives you a GitHub link to his test code for the project. And, finally, he creates a test using the Gherkin codes as comments to show you how a test runs in pytest.

In the third chapter, you set up Selenium Webdriver to work with specific browsers, then create your test fixture in the pytest. Andrew reminds you to download the appropriate browser driver for the browser you want to test — for example, chromedriver to drive Chrome and geckodriver to drive Firefox. Once you use pipenv to install Selenium, you begin your test fixture. One thing to remember is to call an explicit quit for your webdriver after a test.

Chapter 4 goes through page objects, and how you abstract page object details to simplify your test structure. Chapter 5 goes through element locator structures and how to use these in Python. And, in Chapter 6, Andrew goes through some common webdriver calls and how to use them in your tests. These first six chapters cover the basics of testing with Python and Selenium.

Now that you have the basics down, the final three chapters review some advanced ideas: testing with multiple browsers, handling race conditions, and running your tests in parallel. This course gives you specific skills around Python and Selenium on top of what you can get from the Python for Test Programming course.

#tutorial #performance #testing #automation #test automation #automated testing #visual testing #visual testing best practices #testing tutorial

Tamia  Walter

Tamia Walter

1596754901

Testing Microservices Applications

The shift towards microservices and modular applications makes testing more important and more challenging at the same time. You have to make sure that the microservices running in containers perform well and as intended, but you can no longer rely on conventional testing strategies to get the job done.

This is where new testing approaches are needed. Testing your microservices applications require the right approach, a suitable set of tools, and immense attention to details. This article will guide you through the process of testing your microservices and talk about the challenges you will have to overcome along the way. Let’s get started, shall we?

A Brave New World

Traditionally, testing a monolith application meant configuring a test environment and setting up all of the application components in a way that matched the production environment. It took time to set up the testing environment, and there were a lot of complexities around the process.

Testing also requires the application to run in full. It is not possible to test monolith apps on a per-component basis, mainly because there is usually a base code that ties everything together, and the app is designed to run as a complete app to work properly.

Microservices running in containers offer one particular advantage: universal compatibility. You don’t have to match the testing environment with the deployment architecture exactly, and you can get away with testing individual components rather than the full app in some situations.

Of course, you will have to embrace the new cloud-native approach across the pipeline. Rather than creating critical dependencies between microservices, you need to treat each one as a semi-independent module.

The only monolith or centralized portion of the application is the database, but this too is an easy challenge to overcome. As long as you have a persistent database running on your test environment, you can perform tests at any time.

Keep in mind that there are additional things to focus on when testing microservices.

  • Microservices rely on network communications to talk to each other, so network reliability and requirements must be part of the testing.
  • Automation and infrastructure elements are now added as codes, and you have to make sure that they also run properly when microservices are pushed through the pipeline
  • While containerization is universal, you still have to pay attention to specific dependencies and create a testing strategy that allows for those dependencies to be included

Test containers are the method of choice for many developers. Unlike monolith apps, which lets you use stubs and mocks for testing, microservices need to be tested in test containers. Many CI/CD pipelines actually integrate production microservices as part of the testing process.

Contract Testing as an Approach

As mentioned before, there are many ways to test microservices effectively, but the one approach that developers now use reliably is contract testing. Loosely coupled microservices can be tested in an effective and efficient way using contract testing, mainly because this testing approach focuses on contracts; in other words, it focuses on how components or microservices communicate with each other.

Syntax and semantics construct how components communicate with each other. By defining syntax and semantics in a standardized way and testing microservices based on their ability to generate the right message formats and meet behavioral expectations, you can rest assured knowing that the microservices will behave as intended when deployed.

Ways to Test Microservices

It is easy to fall into the trap of making testing microservices complicated, but there are ways to avoid this problem. Testing microservices doesn’t have to be complicated at all when you have the right strategy in place.

There are several ways to test microservices too, including:

  • Unit testing: Which allows developers to test microservices in a granular way. It doesn’t limit testing to individual microservices, but rather allows developers to take a more granular approach such as testing individual features or runtimes.
  • Integration testing: Which handles the testing of microservices in an interactive way. Microservices still need to work with each other when they are deployed, and integration testing is a key process in making sure that they do.
  • End-to-end testing: Which⁠—as the name suggests⁠—tests microservices as a complete app. This type of testing enables the testing of features, UI, communications, and other components that construct the app.

What’s important to note is the fact that these testing approaches allow for asynchronous testing. After all, asynchronous development is what makes developing microservices very appealing in the first place. By allowing for asynchronous testing, you can also make sure that components or microservices can be updated independently to one another.

#blog #microservices #testing #caylent #contract testing #end-to-end testing #hoverfly #integration testing #microservices #microservices architecture #pact #testing #unit testing #vagrant #vcr

Jamal  Lemke

Jamal Lemke

1603580400

Ten Principles For Agile Testers

In the previous blog we saw that what exactly is Agile testing and in this blog we will see in introduction to Principles For Agile Testers.

What is an Agile tester?

  • So get into the principles for Agile testers we first need to know what is an Agile tester? A professional tester who is not scared of change has knowledge about technical and business aspects as well and understands the concept of using tests to document requirements to drive development is an Agile tester.
  • Now let’s see what are in ten principles for Agile testers:
  • Provide continuous feedback.
  • Deliver value to the customer.
  • Enable face-to-face communication.
  • Have courage.
  • Keep it simple.
  • Practice continuous improvement.
  • Respond to change.
  • Self-organize.
  • Focus on people.
  • Enjoy

Provide Continuous Feedback

  • Continuous feedback is the key to agile testing success. By providing feedback we can improve and not make the same mistakes again and again. The main aim is to learn from your mistakes. Testers should help product owners or customers visualize requirements for the stories. Their feedbacks helps in designing the test cases early in the software life cycle. As retrospectives are an important part of the Agile process, providing feedback in it is also helpful. It is one of the most important principles for Agile testers.

Deliver Value to the Customer

  • As a tester, it’s your responsibility to tell customers which really is an important function and which is not. The testers help them identify the main functionality instead of just some cool features. The main focus is to try and deliver critical functionality and enhance it later. Critical functionalities should be worked on first as after seeing them implemented, customers can see what enhancements they want. Testing should work on corner cases but should not forget about the happy path of the service. As we get involved in testing it is possible to get involved in corner cases so much that we miss the core functionality. So, we need to maintain a balance between them.

Enable Face-to-Face Communication

  • Good communication is the key to success. Agile’s success is totally dependent upon communication. Whether it is between customer and developer or between developers and the testers all communication is very important. Testers should look for unique ways to communicate. Teams may be working in geographically divided. But it should not hinder communications between the teams.
  • Testers should never get in the way of any direct customer-developer communication but should help to make sure that communication happens. If a tester finds out that the developer has some confusion regarding the requirements. It’s the responsibility of the tester to set up a meeting between the developer and the business.
  • The testers understand the story from the customer’s perspective and from the developers’ technical angle as well. The tester should be able to communicate both ways, that’s why it’s in testers’ best interest to be good at communicating, as they need to do it more than any other team member. Testers act as a bridge between customers and developers.

Have Courage

  • The testers should have the courage to speak their minds. They should not be intimidated by anyone. If they find any issue they should report it. If they see any gap in the business requirements they should discuss it.
  • The testers should be comfortable in asking customers for examples or developers for help. Asking for examples is the best way for getting the real-world use case of the services. In Agile anyone can perform any task. So, a developer can help a tester in testing some particular scenario. And a tester can help the developers in debugging an issue ass well.
  • Testers should not be scared to fail but should learn from their mistake. It’s natural to make some mistakes but we should always learn from them and improve ourselves.

#api testing #integration testing #quality assurance (qa) #testing #unit testing #agile #agile teams #agile transformation #agiledeveloper #automation #automation testing #testing skills

Jamal  Lemke

Jamal Lemke

1603587600

Agile Testing: An introduction

When we talk about Agile the first thing that pops into our mind is Agile development. But here we are going to see and learn about an introduction to Agile Testing that how testers work in Agile, the contrast between Agile Testing and development, and traditional vs. Agile approach.

What is Agile Testing?

  • In the world of software development, there are two very common terminologies, Developers (programmers) and testers. When we hear programmer we think of a person whose main task is to write production code. And when you hear tester you think of a person whose main task in testing and quality assurance.
  • In Agile no one has only one task to perform, here everyone works on it with one aim in the mind that is to deliver the quality their customers need. In a traditional approach, this would have been the primary concern of the tester or the QA of the team. But in Agile even the development team tries to deliver quality end product to the customer.
  • Agile is an iterative development methodology, where requirements evolve through collaboration between the customer and self-organizing teams. Agile aligns development with customer needs. Several core practices used by agile teams relate to testing.
  • Test-driven development (TDD) is used for the development of the services. Where the programmer writes the tiny piece of test which fails. Then tries to write the code around it to make the test pass. It is an approach that many teams follows as it is a smart technique to avoid any bugs.

ROLES AND ACTIVITIES ON AN AGILE TEAM

The roles are divided into mainly two teams:

  • Customer team
  • Developer team
Customer team
  • The customer team comprises business experts, product owners, domain experts, product managers, business analysts, etc. The customer team writes the stories for the development to work on. They provide examples and logic behind the requirements. Their main task is to clear any doubts and give clarification with real world use cases or examples. They are available in each iteration for guiding the Dev and QA teams as well.
  • In a customer team, the testers have a crucial role to play. They help the customers express their requirements as tests.
Developer team
  • The developer team comprises of Developer team includes programmers,system administrators, architects, database administrators, technical writers,security specialists. Each person in the team can be responsible for multiple roles. A developer can also be helping out in testing related activities and a tester could be helping the developers in debugging a issue.
  • Testers are in the developer team as well because testing is one of the core tasks in Agile. Both the testers and the developers help each other in achieving the best quality end product for the customer.

Interaction between Customer and Developer Teams

  • The customer and developer teams work closely together with a common goal to deliver value to the organisation. Testers does not have the sole responsibility for the quality of the product under development. The developer also helps them achieve this by trying to maintain the quality from the first phase of the development.
  • The customer team with developer team prioritise stories which are crucial and are to delivered in each sprint. It’s totally up to the customer that what they want the developer team to work on. They can even request changes in between the sprint and the developer can work on it. If it does not affect the current scope of the story too much. Even if it does they can pick it up in the next upcoming sprint.
  • It is not totally in the hands of the customer team to dictate how much work they want the development team to work on. The developer picks up work according to there bandwidth, estimates it and then starts working on it.
  • Testers have a foot in each world, understanding the customer viewpoint as well as the complexities of the technical implementation. The testers or the QA team acts as a bridge between the customer and the developers. They don’t just understands the customer requirements but also looks at it from a technical viewpoint. and tries to see if it is feasible or not from the developers point of view as well.

**HOW IS AGILE TESTING DIFFERENT? **

  • By now you must be wondering how is Agile testing different from the the other traditional approach? Let’s see how it is like to work on a traditional team vs. an Agile team.

Working on Traditional Teams

  • In traditional team or approach the testers are not involved with developers from the starting phases of the software. Testers are involved in the last phases of the development where they get very little time to test the services on which the developers works for months.
  • Each release cycle is for around 6 months where all the tasks are to be completed and released to the customer. Testers are involved in release planning and requirements definition.But after that they are involved in the end with rushed testing phase and sometimes a delayed release as well.
  • The quality is the sole responsibility of the QA team only. If any of the requirements were missing or any other issue was found the testers were responsible. They didn’t even have the control over if the developer has even tested there code or not.
  • The testers have the power to stop or postpone the release of they find any major issues in the release or if it is not according to the requirements.
  • 6 months seems like a very long time but is not as even after this time the end result is not according to the customers expectations. Things gets deviated from the path and the end result is not covering all the requirements.
  • The testers create there test plans according to the API specs but if the end product is not according to the defined requirements then the whole test plan simply fails.

#agile #api testing #integration testing #quality assurance (qa) #scaled agile #scrum #testing #unit testing #agile teams #agile transformation #test automation