mercredi 27 décembre 2017

Bluetooth legacy feature testing challenges

We are testing Bluetooth over the device and we have to verify HSP profile (not HFP) for DUT, but available devices (which will be paired) in market support HFP which is a superset of HSP. So, difficult to test the HSP separately.

Similarly currently, devices support eScO links and devices which only support SCO link are not available (i didn't found).

how to verify these features?

mardi 26 décembre 2017

Junit 4 Testing coverage

I am unable to cover next method:

protected void dealDamage(int damage, String damageType) {
    this.setDamageDealt(damage);
    this.setDamageDealtType(damageType);
}

My test looks like this:

@Test
@Parameters({"30, physical"})
public void dealDamage(int damage, String damageType) throws Exception {
    this.creature.setDamageDealt(damage);
    this.creature.setDamageDealtType(damageType);
    assertEquals(this.creature.getDamageDealt(), 30);
    assertEquals(this.creature.getDamageDealtType(), "physical");
}

Test return success, but method is not covered at all. Where could be my mistake? Do I miss something?

Java testing if two void methods do the same

I have a class of paired void methods: each method has an equivalent one that should perform the same operation but in a different way. For example:

public void example1_1(){
    Integer i = new Integer(1);
}

public void example1_2(){
    Integer i = Integer.valueOf(11);
}

or

public void example2_1(){
    String result = "hello";
    for (int i = 0; i < 10; i++) {
        result += result;
    }
}

public void example2_2(){
    StringBuffer result = new StringBuffer("hello");
    for(int i = 0; i < 10; i++) {
        result += result;
    }
}

How can I test that the methods actually perform the same operations in pair?

How to Test an app in Alpha (Android) on a tablet

I have:

  • ... already tested an App in Alpha earlier. It seems there where conceptional changes meanwhile. (All gets better :-))
  • A new app version published for Alpha-Testing
  • I have a User in a testing group assigned and Testing Group is assigned to Alpha-Test
  • a link for testing the app and sent the link to the testing User.
  • User klicks on the link and brwoser opens. User signs-in with User-Account which is Member of the testing Group and gets the error-message: "To access this content you need to install and set up a web browser app."

So now I am unable or too stupid to simply test an app.

Can someone help me ?

How to exclude node_modules from create-react-app testing?

I want to make tests of my create-react-app using jest.

One of node_modules have test-error,

enter image description here

but I don't want jest to work with node_modules folder.

In the documentation I found configuration property "collectCoverageFrom" and tried to use itin my package.json:

  ....
  "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test --env=jsdom ",
        "eject": "react-scripts eject"
  },
  "jest": {
        "collectCoverageFrom": [
            "!/node_modules/*"
         ]
  }

But there is nothing changed.

how to handle this popup on "http://ift.tt/LpUYtP"

title : handle popup box selenium code for handle div pop on same windows //package booking;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;


public class Dubai {
    public static void main(String[] args) throws Exception {
    System.setProperty ("webdriver.chrome.driver",
                       "C:\\Users\\miyau\\Desktop\\test\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.get("http://ift.tt/LpUYtP");
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
        driver.findElement(By.xpath("//div[text()='Not Now']")).click();
        System.out.println("operation complit");
      }
 }
// snapshot of popup## Heading ## 

enter image description here

Right way to terminate testing mongodb server

We are using mongodb-prebuilt package for perform unit/integration testing (CI/CD) for the developed software, which performs interaction with mongodb database.

Common use case is following: launch testing mongodb server with prebuild package, perform test suite execution and then terminate server. First and second items are done easily, but third one causes some problems.

If mongodb-prebuilt-started server had not been terminated, test runner will hang forever. Instead, if try to terminate server by testConnection.command({ shutdown: 1 }) command, then unhandledRejection fires, which refers on closed connection - which of course had been forcefully closed by stopping the server.

Which is right way to dispose mongodb-prebuilt at afterAll test section? Test engine is jest, but it does not matter strongly.
Example code here:

import { MongodHelper } from 'mongodb-prebuilt';
import { MongoClient } from 'mongodb';

describe('Test suite', () => {
    let testConnection;
    beforeAll(async () => {
        const mongodHelper = new MongodHelper(['--port', "27018"]);
        await mongodHelper.run();
        testConnection = await MongoClient.connect(`mongodb://localhost:27018/admin`);
    });
    afterAll(async () => {
        await testConnection.dropDatabase();
        await testConnection.command({ shutdown: 1 });
        await testConnection.close();
        testConnection = null;
    });
    /* Here follows some test suite that uses testConnection  */
}

There was some attempts to solve problem:

1) Don't await testConnection.command({ shutdown: 1 })-generated promise, and instantly initiate client connection closing - it works on some machines, but most likely depends on execution speed, so works unstable.

2) Because of client connection termination at the end of the tests does not matter strongly - it's possible to setup process.on('unhandledRejection', ...) handler in afterAll section and just mute exception - works well, but seems to be ideologically incorrect

So, maybe is there stereotypical solution for original task?

IMPORTANT NOTE: suggesting use some mock packages instead live mongodb is not appropriate at all, since developed software is specific adapter for mongodb and should respect all aspects of live database, including timings, admin commands and so on