CCCMI —— Wenyu Shi Profile

Software Testing Part 1

Main topic:

  1. What are software testing and the processes of software testing?
  2. What is Automation Testing?
  3. Why test APIs?
  4. How to use Appium && WebdriveIO (Automation testing tools) in React Native?

Navigation

Software Testing Part 1

Software Testing Part 2

Software Testing Part 2

API testing

API testing

What is Software Testing?

The process of Software Testing

  1. Planning: The planning stage is the part where the effect of the development is determined, and impact analysis is performed.
  2. Creation of Scenarios: It is the stage where “expected” and “realized” outputs are prepared according to the content of the project to be tested
  3. Preparation of Test Environment and Data Creation: This is the preparatory phase for the test. All necessary preparations are made in this step before starting the test. The project to be tested is successfully installed in the test environment.
  4. Run the Scenarios: This is the stage where the tests are run. Test scenarios that have been written are applied in this step.
  5. Reporting of Results: It is the stage in which the situation that occurs after all specified scenarios are applied is communicated to the person concerned. 
Reference: Software Testing Process and Levels of Testing

Levels of Testing

testing level.png

  1. Unit testing in computer science, it is the process of testing whether a block of code (usually method) that calls or uses another block is performing its task correctly by separating it from the other block to which it is associated. Unit tests will fail if the task is not performed correctly. What we call units is usually a method or a function.
  2. The integration test is, therefore: testing the operation of two or more slave modules as a group. In short, integration testing; checks the combination of codes that can be tested with unit tests.
  3. System testing (or end-to-end testing [E2E]). Is a complete system testing. When unit tests and integration tests are testing parts of the system, this one is targeting the system as a whole.
  4. Acceptance Tests refers to the testing of end-user scenarios. It can also be considered as integration tests but refers to testing a user story.

Automation Testing

Automation testing is a Software testing technique to test and compare the actual outcome with the expected outcome. This can be achieved by writing test scripts or using any automation testing tool. Test automation is used to automate repetitive tasks and other testing tasks which are difficult to perform manually. The aim of Automation Testing in Aquality 2.0 is to test the system as a whole and at the same time it tests integration as well.

Reference: What Is Automation Testing

Design test case

Before writing test scripts, we need to know the flows and steps of flows. I used a document to record test tasks for each flow.

The tets flows will not change too much in the process of implementation, but steps would be change based on users feedback, for example, the user suggests us to add a pop-up window and shows tips of the current screen.

The benefit of test script documentation:

  1. Clear the steps of operation and simulate the actions
  2. Easy to follow and judge if matching with expected test results for each test task
  3. Easy to show bugs to developers if testing results did not match with expected result  

Why test APIs?

API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. In Aquality 2.0, the server provides APIs to the frontend and the frontend talks to the server by sending requests to the server via APIs.

API is a part of the whole product system and the user needs to interact with the Application to view data or save data via it. It's important to make sure all of them are working and developers need to check the report before using it in Frontend.

How to set up Appium environment && WebDriverIO into React Native?

Aquality 2.0 is written on React Native and it can run on Android and iOS at the same time, React Native brings a lot of conveniences, but testing is difficult if testing the application on two operating systems.

Appium is an open-source test automation framework for use with native, hybrid and mobile web apps, it drives iOS, Android, and Windows apps using the WebDriver protocol.

Appium is a cross-platform black-box testing tool, which supports testing on two main mobile operating system iOS and Android. Besides, Appium testing scripts can be written in any scripts such as Java, Python or JavaScript, Ruby, C#, it can be used in any language project, it is powerful and does not require a specific programming language for testers.

 

How to use WebdriverIO with Appium?

This way will set up the Appium environment globally and set up all tests scripts in a separate folder with a unit test and the test cases can be run independently. Combine WebdriverIO with Appium together will let you easy to write test scripts.

Setting Steps:
  • Install Appium globally with the command:
        npm install -g appium
  • Create a new folder called `appium_test` and create a new file called ` json` inside appium_test folder, add content as:

package.json

  • Install all dependencies with the command:
npm i
  • Generate a wido config file with the following command and using mocha framework, full set up as below:

    npx wdio config

wido.png

  • Fix wdio.conf.js file:

wido.config.png

  • Set test cases folder path in specs field, set appropriate automationName for different operating systems and different version: XCUITest for iOS 9.3 and above, UIAutomation for iOS 9.3 and lower, UiAutomator/UiAutomator2 for Android 4.3 and above.
  • Run the test case:

Run the Appium desktop server as an administrator
Run react-native app in the emulator
Run command `npm run testandroid` to execute all test cases

Test Script Example

testScriptExample.png

All test case should set inside it API and define the test case description, then using `$` symbol to find the tested element which is marked by `accessibilityLabel` in source code, setValue function is used to insert the fake value, click function used to simulate click action. Expect keyword is using to compare actual results and expected result, getAlerText function is used to get the text content of the alert dialogue. Execute keyword is used in setting the state of accept alert or reject alert. The APIs of WebdriverIO are easy to understand and pretty straightforward, more API can be found here APIs.  

Report Example

testreport.png

After the test finished, spec reporter will display the results, it will show the running environment and which APK of Android, it will report how many tests are passed and which test is failed.

Before developerd commit changes into GitHub, the test case should be passed in corresponding page or screen.