vendredi 22 décembre 2017

Junit Test using Math.Random and strings involved

Im stuck on testing this little section of code and i have no idea how i would start with testing it? Can anyone help!?

TBH i dont even know if this is right?

  public int FindRandomNumber(){
          int index = (int) (Math.random() * (Bournemouth.bison.length / 3));
          String what = Bournemouth.bison[index * 3];
          String who = Bournemouth.bison[1 + index * 3];
           System.out.printf("%s said \"%s\"", who, what);

        return index;

Appium UiAutomatorViwer does not work

I have a problem with UiAutomatorViewer because it does not work. I use Win10, JDK8, of course I installed Android SDK. In command line I enter uiatomatorviewer and after that I get error like:

-Djava.ext.dirs=lib\x86_64;lib is not supported.  Use -classpath instead.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Some ideas how fix this problem?

Reference Error for Sencha Test

I'm trying a simple unit test with Sencha Test but keep taking this error;

System error: ReferenceError: myDemoApp is not defined at Object.<anonymous> (/Users/frontend/la-nuri/Dev/Demo/MyDemoApp/test/DemoScenario/DemoSuite2.js:6:27) at Object.call (/Applications/Sencha/Test/2_1_2_1/Sencha http://ift.tt/2kD6F4w) at Object.invoke (/Applications/Sencha/Test/2_1_2_1/Sencha http://ift.tt/2kYpIW0) at Object.me.wrapperFn (/Applications/Sencha/Test/2_1_2_1/Sencha http://ift.tt/2kF5VeV) at attemptAsync (/Applications/Sencha/Test/2_1_2_1/Sencha http://ift.tt/2kYpMoI) at QueueRunner.run (/Applications/Sencha/Test/2_1_2_1/Sencha http://ift.tt/2kF5XU5) at QueueRunner.execute (/Applications/Sencha/Test/2_1_2_1/Sencha http://ift.tt/2kYpNZO) at Spec.queueRunnerFactory (/Applications/Sencha/Test/2_1_2_1/Sencha http://ift.tt/2kD6Lco) at Spec.execute (/Applications/Sencha/Test/2_1_2_1/Sencha http://ift.tt/2kXGFQt) at Object.fn (/Applications/Sencha/Test/2_1_2_1/Sencha http://ift.tt/2kFKoTs)

I've generate a sample app with sencha cmd through this guide with this command;

sencha generate app -ext MyApp /path/to/my-app

Here is my test suite and some other code snippets;

describe('Demo Suite 2', function() {

    describe('onConfirm() method', function() {

        it('should be a function', function() {
            expect(typeof myDemoApp.view.main.MainController.onConfirm).toEqual('function');
        });

        it('should return a string', function() {
            expect(typeof myDemoApp.view.main.MainController.onConfirm()).toEqual('string');
        });
    });  
});

This is sencha-made controller;

/**
 * This class is the controller for the main view for the application. It is specified as
 * the "controller" of the Main view class.
 */
Ext.define('myDemoApp.view.main.MainController', {
    extend: 'Ext.app.ViewController',

    alias: 'controller.main',

    onItemSelected: function (sender, record) {
        Ext.Msg.confirm('Confirm', 'Are you sure?', 'onConfirm', this);
    },

    onConfirm: function (choice) {
        if (choice === 'yes') {
            console.log("this is a yess")
        }
    }
});

I want to check onConfirm method with that simple unit test suite. Why cannot reach to myDemoApp?

Job Shop Scheduling - help needed

I have the following problem that I need to solve. The full description of the problem is here.

  • A number of tests have to be performed in minimal time
  • Each test has a given duration and needs to run on one machine
  • While the test is running on a machine, no other test can use that machine.
  • Some tests can only be assigned to a subset of the machines, for others you can use any available machine
  • For some tests, additional, possibly more than one, global resources are needed. While those resources are used for a test, no other test can use the resource.

    The objective is to finish the set of all tests as quickly as possible.

Could someone point me in the right direction as to how to code the solution to this problem in something like NodeJS (JavaScript), Java, or Python? I do not necessarily need to find the optimal solution, I would be very happy with a greedy approach that finds a set of feasible solutions.

Integrating UI testing framework for web app

I know how to run UI tests using Jmeter (check it out, its really cool)
But I tried searching about integrating UI tests like what espresso is in Android Studio. All the frameworks I found were paid, so can anyone refer me some frameworks and maybe tell me how to implement them?

jeudi 21 décembre 2017

I want to use the moment.js (or any other script) in Postman Native App

I know the solution for Postman with Chrome Plugin....

the solution for my Postman with Chrome Plugin is on my mbp I've just add

in the file "~/Library/Application Support/Google/Chrome/Default/Extensions/fhbjgbiflinjbdggehcddcbncdddomop/5.4.0_0/html/tester_sandbox.html" or "~/Library/Application Support/Google/Chrome/Default/Extensions/fhbjgbiflinjbdggehcddcbncdddomop/5.4.0_0/html/requester.html" to be able to use that script in "Pre-request Script" or "Tests" but i can't find where the Postman Native App keeps these file path....

i've already try another solution that i found on google about add the script as an GlobalVariable then eval in "Tests" but it's still not work...

any ideas or any recommended ......

thanks

IndexedDB testing with Jest & enzyme - ReferenceError: indexedDB is not defined

I'm looking for help with unit tests for my app, where I'm using indexedDB. Before I implemented indexedDB functionality, tests were correct. But now, for all of them I see one error:

ReferenceError: indexedDB is not defined

Can someone give me an advice how to get rid of that error? I was searching information, and trying different ways to mock 'window', or 'indexedDB', but with no result.

Thanks.