lundi 29 février 2016

Why does "yield return new WaitForEndOfFrame()" never returns in batchmode?

I am trying to write integration tests by using unity test tools package.

Tests run without problem in the editor (in play mode).

But when I try to run the integration test from the command line (in batchmode) WaitForEndOfFrame coroutine never returns.

Is this a known issue or am I missing something?

I am using the below command to run the tests:

 /Applications/Unity-5.3.1-f1/http://ift.tt/1oPae27 \
  -batchmode \
  -nographics \
  -logfile \
  -projectPath $(pwd) \
  -executeMethod UnityTest.Batch.RunIntegrationTests \
  -testscenes=TestScene \
  -resultsFileDirectory=$(pwd)

How see code coverage for package which other than test class?

The question is about integration testing where test class often invoke code from various packages. Suppose that there is a SomeServiceTest class in package com.some.service, but it invoikes code from com.some.handler, but when run test from Intellij Idea, it shows code coverage for com.some.service only. Is there a way to configure it to show all packages which are invoked during test?

Tried everything, ADB is not detecting my nexus on windows 7

I'm trying to add my external device(nexus 5) to test. for that
1) I have installed Google USB drivers
2) set environment variables as ANDROID_HOME & PATH
3) set android:debugger="true" in manifest, same in gradle.
4) if I list devices connected to ADB in command prompt, gets no devices.
5) Driver for nexus 5 is uptodate as i have checked from device manager of windows 7.
6) enabled usb debugging on my phone in developer options.

It seems nothing is working on my way here, how can I test my camera/bluetooth app on my nexus 5? please, help.

What are the different settings I should test for a custom WPF UI component?

I have developed a fancy WPF control based on WPF popup that can positioned on the screen using absolute screen coordinates. To test it, I made sure I test it with high DPI and various resolutions.

Only recently though have I noticed its positioning is broken on tablet PCs due to Windows handedness settings. I have fixed that as well but now I need to make sure I have not missed any other setting or configuration.

Asserting that __init__ was called with right arguments

I'm using python mocks to assert that a particular object was created with the right arguments. This is how my code looks:

class Installer:
    def __init__(foo, bar, version):
        # Init stuff
        pass
    def __enter__(self):
        return self

    def __exit__(self, type, value, tb):
        # cleanup
        pass

    def install(self):
        # Install stuff
        pass

class Deployer:
    def deploy(self):
        with Installer('foo', 'bar', 1) as installer:
            installer.install()

Now, I want to assert that installer was created with the right arguments. This is the code I have so far:

class DeployerTest(unittest.TestCase):
    @patch('Installer', autospec=True)
    def testInstaller(self, mock_installer):
        deployer = Deployer()
        deployer.deploy()

        # Can't do this :-(
        mock_installer.__init__.assert_called_once_with('foo', 'bar', 1)

This is the error I get:

  File "test_deployment.py", line .., in testInstaller
    mock_installer.__init__.assert_called_once_with('foo', 'bar', 1)
AttributeError: 'function' object has no attribute 'assert_called_once_with'

open-source java programs with an accessible source-code?

I'm making a research within software testing field, during the research I will be studying and analyzing a decent amount of open-source programs written in java specially! My question is where can I find a suffecintlly large projects with an accessible source-code? What I mean by suffecintlly large projects; are projects with a range of 500K lines of code and with a base user >10 000! It deos not need to be the exact number, but more or less! Also would such projects have thier source code accessible via github or some other VCS's websites?

thanks!

Swiftmailer not sending mail on Symfony2 service test

I am having trouble on testing Symfony services that send notification emails.

In my NotificationService I have a function that persists the notification into the database and sends a notification email using a simple MailHelper class:

public function saveNewNotificationUser($newnotificationuser){
    // Get necessary repositories
    $doctrine = $this->getDoctrine();
    $repo_user = $doctrine->getRepository('AppBundle:User');
    $em = $doctrine->getManager();

    $notificationuser = $this->getNotificationUserById($newnotificationuser['idnotificationuser']);
    $user = $repo_user->findOneByIduser($newnotificationuser['iduser']);
    $notification = $this->getNotificationById($newnotificationuser['idnotification']);

    if ($notification && $user){
        // Persist on database
        $notificationuser->setDate(new \DateTime("now"));
        $notificationuser->setRead(0);
        $notificationuser->setUseruser($user);
        $notificationuser->setVariables($newnotificationuser['variables']);
        $notificationuser->setNotificationnotification($notification);
        $em->persist($notificationuser);
        $em->flush();
        // Send notification email
        // Generate notification structure
        $not = $this->createNotificationStructure($newnotificationuser['idnotification'],$newnotificationuser['variables']);
        // Define user's dafault language and send notification email
        $languagecode = $user->getLanguagelanguage()->getCode();
        $mailTo = $user->getEmail();

        // Get notification next on user's default language
        $text = $not["languages"][$languagecode]["language"];

        $this->get('mailHelper')->sendMail("notification",$mailTo,array('body' => $text["description"]), $text["title"]);

        return $notificationuser->getIdnotificationUser();
    }else{
        return false;
    }
}

When I test the function, the database insert in done correctly but the email is never sent. Here is my test class:

private $container;
private $em;

public function setUp()
{
    self::bootKernel();

    $this->container = self::$kernel->getContainer();
    $this->em = $this->container->get('doctrine')
        ->getManager();
}

public function testSaveNewNotificationUser()
{

    $notificationService = $this->container->get('notificationService');
    $newnotificationuser = array(
        'idnotificationuser' => '99',
        'iduser' => '69',
        'idnotification' => '1',
        'variables' => '32;12'
        );

    $id = $notificationService->saveNewNotificationUser($newnotificationuser);

    $item = $this->em
    ->getRepository('AppBundle:NotificationUser')
    ->findByIdnotificationUser($id);

    $this->assertCount(1, $item);
}

protected function tearDown()
{
    parent::tearDown();
    $this->em->close();
}

public function testNotificationAction()
{
    $client = static::createClient();

    $crawler = $client->request('GET', '/api/login/testnotif');

    $mailCollector = $client->getProfile()->getCollector('swiftmailer');

    // Check that an email was sent
    $this->assertEquals(1, $mailCollector->getMessageCount());
    $this->assertTrue($client->getResponse()->isSuccessful());
}

However, if I call SaveNewNotificationUser within a Controller Action, using the same "fake" data as used in testSaveNewNotificationUser, the email is sent (when disable_delivery set to false) and I can catch it via the mailCollector.

Am I missing anything? Am I taking a wrong approach to build the tests?

AngularJS Karma Test ignore app initialization GET Request

I'm working on testing an angularjs factory/service which makes a GET request, but I'm running into an issue. When I call module('app'), our application makes a GET request for localization files, and I would like to be able to ignore/avoid this request when doing tests with $httpBackend. Is there a way to do this, or do I just have to expect the localization requests before each test?

Test Code:

/* global describe, beforeEach, afterEach, inject, it, expect, fdescribe, fit, browser, element, by */
'use strict';
describe('dataservice', function() {
   beforeEach(module('app'));

   var $httpBackend;

   beforeEach(inject(function($injector){
      $httpBackend = $injector.get('$httpBackend');
   }));

   afterEach(function(){
      $httpBackend.flush();
      $httpBackend.verifyNoOutstandingExpectation();
      $httpBackend.verifyNoOutstandingRequest();
   });

   it('should form a request', function(){
      $httpBackend.expectGET('http://localhost:8080/api/data/data');
      dataservice.getData('data');
   });
});

Service Code:

/*jshint-W030*/

(function(){
   /* jshint expr:true */
   'use strict';
   angular
      .module('app')
      .factory('dataservice', dataservice);

   /* @ngInject */
   function dataservice($http){
      return{
         getData: getData
      };

      function getData(data){
         return $http.get('/api/data' + data)
            .then(getSuccess)
            .catch(getFailure);

         function getSuccess(response){
            return response;
         }

         function getFailure(error){
            return error;
         }
      }
   }
})();

app.controller.js:

(function () {
   'use strict';

   angular
      .module('app')
      .config(config)
      .controller('pageCtrl', pageCtrl)
      .controller('headerCtrl', headerCtrl);

   function config($translateProvider) {

      $translateProvider
         //...
         .useStaticFilesLoader({
            files: [{
               prefix: '/assets/lang/locale_',
               suffix: '.json'
            }]

         })
         .uniformLanguageTag('bcp47')
         .determinePreferredLanguage()
         .fallbackLanguage('en')
         .forceAsyncReload(true);
   }
   //...
})();

MessageBodyWriter not found for media type=multipart/form-data in JerseyTest

I'm trying to create a test for a POST method in a resource class in a Jersey program.

Here's the POST method of the resource:

@POST @Path("/new")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response HTTPPostMethod(@FormDataParam("file") InputStream fileIS, 
                           @FormDataParam("file") FormDataContentDisposition contentDispositionHeader) {
    // ... some code that handles the InputStream
}

My ResourceConfig is created in the following way:

public class MyApp extends ResourceConfig {

    public MyApp(String param) {
        register(createMoxyJsonResolver());     
        register(MultiPartFeature.class);
        register(MyResource.class);
    }

     private static ContextResolver<MoxyJsonConfig> createMoxyJsonResolver() {
        final MoxyJsonConfig moxyJsonConfig = new MoxyJsonConfig();
        Map<String, String> nsPrefixManager = new HashMap<String, String>(1);
        nsPrefixManager.put("http://ift.tt/ra1lAU", "xsi");
        moxyJsonConfig.setNamespacePrefixMapper(nsPrefixManager).setNamespaceSeparator(':');
        return moxyJsonConfig.resolver();
    }

    /**
     * Start the Grizzly HTTP Server
     * 
     */
    public final void startHttpServer(int port) {
        try {
            final String url = "http://localhost:" + port + "/myapp";
            final HttpServer server = 
                    GrizzlyHttpServerFactory
                        .createHttpServer(URI.create(url), this);

            Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
                public void run() {
                    server.shutdown();
                }
            }));
            Thread.currentThread().join();

        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args)  {
        try {
            final MyApp app = new MyApp(args[1]);
            int port = Integer.parseInt(args[0]);
            app.startHttpServer(port);
        } catch(NumberFormatException e) {
            e.printStackTrace();
        }
    }
}

My jersey test setup:

public class TestBase extends JerseyTest {

    protected Application app;
    protected static final String param = "myparam";

    @Override
    protected Application configure() {
        // The MultiPartFeature is registered.
        this.app = new MyApp(param);
        return app;
    }
}

Finally, the test that's causing problems:

public class MyResourceTest extends TestBase {

// ...

    @Test
    public void testHTTPPost() {

        try {

            FileDataBodyPart filePart = new FileDataBodyPart("file", new File("path/to/a/file/i/know/exists"));
            FormDataMultiPart formDataMultipart = new FormDataMultiPart();
            FormDataMultiPart multipart = (FormDataMultiPart)formDataMultipart.bodyPart(filePart);

            Response result = target("/myResource/new").request().post(Entity.entity(multipart, multipart.getMediaType()));
            formDataMultipart.close();
            multipart.close();

            assertEquals(Response.Status.OK.getStatusCode(), result.getStatus());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

// ...

}

I'm always getting the error:

org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyWriter not found for media type=multipart/form-data, type=class org.glassfish.jersey.media.multipart.FormDataMultiPart, genericType=class org.glassfish.jersey.media.multipart.FormDataMultiPart.
    at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:247)
    at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
    at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
    at org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:502)
    at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:388)
    at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:285)
    at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:255)
    at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:684)
    at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:681)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444)
    at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:681)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:437)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:343)
    at services.MyResourceTest.testHTTPPost(MyResourceTest.java:151)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

I tried the following code in the TestBase, but it didn't work:

@Override
    protected Application configure() {
        ResourceConfig app = new ResourceConfig();
        app.register(MultiPartFeature.class);
        app.register(MyResource.class);
        this.app = app;
        return app;
    }

Same error. What am I doing wrong here?

Simple function calling doesn't work in Robot Framework

I'm new to Robot FW and I'm in the learning stage. In order to try calling external libraries, I made a very simple function and saved in tryingLibrary.py file. The content:

def myAdding(x, y):
    z = x + y
    return z

Then I worte the following RF test

*** Settings ***
Documentation    Suite description
Library          tryingLibrary.py

*** Variables ***
${x}

*** Test Cases ***
TestTest
    ${x}=  myAdding     30      26

However, when I check the log file, I find ${x} = 3026. I mean I'm expecting of course 56 not 3026

So where might be the problem?

Run Server when Integration Testing with Gradle

I've developed a client-server-architecture using Kryonet and Gradle with roughly the following structure

  • Parent project X, containing projects A and B
  • Project A (server)
  • Project B (client), containing integration and unit test classes

Now whenever I'm running the goal 'integrationTest' on project B (or project X, if that was easier), I'd like the server to get started in advance so that the integration tests won't fail.

This is what I've got so far in the build.gradle of project B - it doesn't run the server, though:

task integrationTest(type: Test) {
    testClassesDir = sourceSets.integrationTest.output.classesDir
    classpath = sourceSets.integrationTest.runtimeClasspath
    outputs.upToDateWhen { false }
}

Siesta - Run test based on certain Condition

I have setup siesta lite to test my ExtJs 4 application. I want to run a test depending upon the value of window.xxx and window.yyy of my application. So if xxx= 1 and yyy= 'xyz', I want to run a particular test file lets say test1.js. I read the siesta documentation but I couldn't find anything.

Here is my code:

var harness = new Siesta.Harness.Browser.ExtJS()
window.harnessObj = harness;
harness.configure({
    title              : 'My Tests',
    preload : [
       /* '../resources/extjs-4.2/resources/css/ext-all.css',
        '../resources/extjs-4.2/ext-all-debug.js',
        '../resources/json/textLabels.js',*/
    ]
});

harness.start(
    {
        group: 'Unit Tests',
        pageUrl: '../index.html?unittest',
        items:
        [
            {
                title : 'PopUpWindow',
                url : 'tests/PopUpWindow.js'
            },
            {
                title : 'S_0-R_PjM',
                url : 'tests/S_0-R_PjM.js'
            }
        ]
    }
);

harness.on('testsuitestart', function (event, harness)
    {
        //debugger;
        console.log('I fucking love Testing')
    }, this, 
    { single : true }
)

I want to run 'tests/S_0-R_PjM.js' inside 'tests/S_0-R_PjM.js' depending upon the certain value of windows object which is set by my application index.html.

My index.js looks like this:

// also supports: startTest(function(t) {
describe(function(t) {
    t.diag("PfalzkomApp Loading Test");

    t.ok(Ext, 'ExtJS has been loaded');
    t.ok(Ext.Window, 'ExtJS.Window has been loaded');


    t.ok(PfalzkomApp, 'Pfalzkom Application has been loaded.');
    t.ok(PfalzkomApp.Utilities, 'Pfalzkom.Utilities.js has been loaded.');
    t.ok(PfalzkomApp.LeafletMapView, 'Pfalzkom.LeafletMapView.js has been loaded.');
    t.ok(window.jvar_prozessstatus, 'window.jvar_prozessstatus has been loaded with value :' + window.jvar_prozessstatus);
    t.ok(window.jvar_rolle, 'window.jvar_prozessstatus has been loaded with value :' + window.jvar_rolle);

    debugger; // Here I want to start a particular test depending upon window.jvar_prozessstatus  && window.jvar_rolle

     t.it('Should be possible to open all tabs', function (t) {
        t.chain(
            { click : ">>tab[text=Adito Belegpositionen]" },

            { click : ">>tab[text=Standortübersicht]" }
        );
    });

    t.done();   // Optional, marks the correct exit point from the test
})

Can some one guide me?

xcodebuild gets stuck with literals on test target

I'm trying to integrate tests on my project but I'm having a problem, as soon I add literals in my testing code, xcodebuild gets stuck without any message. It wait forever with this message:

Touch /Users/serluca/Library/Developer/Xcode/DerivedData/my_app-glgzugfganivsggqoytrqgbvxlhi/Build/Products/Debug-iphonesimulator/RCAnalyticsTests.xctest
cd /Users/serluca/Workspace/rc-app
export PATH="/Applications/http://ift.tt/21vkzGM"
/usr/bin/touch -c /Users/serluca/Library/Developer/Xcode/DerivedData/my_app-glgzugfganivsggqoytrqgbvxlhi/Build/Products/Debug-iphonesimulator/RCAnalyticsTests.xctest

It works if I execute tests from XCode, any suggestion? This is the command that I'm using:

xcodebuild -workspace 'my-workspace' -scheme 'my-scheme' -configuration "Debug" -destination 'platform=iOS Simulator,id=B0059CD3-FE9D-4DBE-9A8A-CBE7EE595D9A' -sdk iphonesimulator9.2 -verbose clean build test

Rails Minitest not executing last assertion

This is my test:

require 'test_helper'

class ProvinceTest < ActiveSupport::TestCase
  def setup
    @country = Country.find_by_iso("AO")
  end

  test "name has to be unique for its country" do
    exception = assert_raises(RecordInvalid) { @country.provinces.create!(name: "Luanda") }
    assert_equal "Has to have unique name for its country", exception.message
  end
end

The problem I'm having is that assert_equal "Has to have unique name for its country", exception.message it's not being executed (I know because I tried to execute a several commands between both assertions and they're not executed. However, whatever I put before the first assertion it will be executed.

What happens and why the test doesn't execute the second assertion?

I followed this question to build the test: Rails ActiveSupport: How to assert that an error is raised?

jMeter does not receive some cookies

I'm doing a test on jMeter but I came across the following problem: after doing the same requests as browser, I receive less cookies in the response compared to the actual browser. I think this problem compromises my project because there are also login requests which are missing cookies.

I'm using a Cookie Manager, which saves and sends cookies correctly when it has them stored.

I also added the CookieManager.save.cookies=true string to users.properties file as suggested around the web.

If it can help, I do not receive some cookies named ADRUM pretty much everywwhere, and a cookie named ak_bmsc.

Thank You for your suggestions.

Formal Design Language for a Real Time System with simple Message and Timing Diagrams

We make a consumer electronics product with some real-time constraints, usually timings and latencies that are acceptable in the user interface. The software engineering team is guided by user experience designers who specify these latencies but have no experience in software design, or the usual tools & methods normal in software companies. We need a simple tool the designers can use to specify sequences and timings in a formal way and the specification needs to be something we can import into the test system to use for automated validation.

PlantUML looks promising and something like the example below would suffice, but the timing specification in the group name can be made to work but is a bit of a kludge. If the requirements do grow, and they almost certainly will, this approach will scale badly. Can anyone suggest something better?

autonumber 1 1 "<b>[000]"
user -> UI: click
group fade 500ms
    UI -> Audio: Fade volume down
    Audio -> UI: Fade done
end
group track switch 100ms
    UI -> Audio: next track
    Audio -> FileSystem: File stream open
    FileSystem -> Audio: File stream opened
    Audio -> UI: stream started
end
group fade 500ms
    UI -> Audio: Fade volume up
    Audio -> UI: Fade done
end

enter image description here

node.js, testing a method that uses oauth2 and google calendar api

I have a helper method that inserts a calendar event via google's calendar API. I want to write tests for it, however I can't figure out a way to mock the oAuth2 request, each time I try to run tests it gives me an error saying that the user access/refresh token is not set.

Any ideas on how to test such a method? Can I use sinon.stub or rewire?

module.exports = function addToCalendar(userId) {
    return new Promise((resolve, reject) => {
        User
        .findById(userId, (err, user) => {
            if (err) {
                reject(err);
            }
            if (!user) {
                reject(new Error('User not found'));
            } else {
                const email = user.email;
                const calendar = google.calendar('v3');
                const event = {
                    summary: class.title,
                    location: class.location.address,
                    start: {
                        dateTime: class.startDate,
                        timeZone: 'America/Los_Angeles'
                    },
                    end: {
                        dateTime: class.endDate,
                        timeZone: 'America/Los_Angeles'
                    },
                    attendees: email
                };
                oauth2Client.setCredentials({
                    refresh_token: user.refreshToken
                });
                calendar.events.insert({
                    auth: oauth2Client,
                    calendarId: 'primary',
                    resource: event
                }, (err, data) => {
                    if (err) {
                        reject(err);
                    } else {
                        resolve(data);
                    }
                });
            }
        });
    });
}

dimanche 28 février 2016

Reduce Mobile Phone reception for app testing

I know this is not directly programming related, but is there a way to purposely limit the signal strength on a testing mobile device to determine how your app performs under weak signal conditions?

I have an app that streams video and audio to a server, and need to test how it performs in low signal areas.. Any suggestions please?

Quickcheck: generate a string made of chars from a given pool

propertyForStringsFromMyCharPool :: String -> Bool
-- implementation

main = T.quickCheck propertyForStringsFromMyCharPool

Right now QuickCheck generates all kinds of strings, but I want to test my property only for strings from my pool of characters.

My output now is:

*** Failed! Falsifiable (after 3 tests and 2 shrinks):    
"-"

But it is not a real failure because - is not included in my charset and no string containing it should have been generated in the first place.


  • I have tried to read the read the docs of QuickCheck but they are very abstract and hard, I did not find a sloution.

  • I have seen a solution on StackOverflow but it seems so much code for what looks like an easy problem, that I fear it is over-engineered.

Another way to debug an android app

I want to debug my android application, I have Eclipse Installed fully setup for android developement.

The problem is,

1) I can't run android emulator(Hardware Concerns).

2) I can't attach phone to my computer(Driver Concerns).

Now,
Is there a way to get debug functionality by putting directly the apk into the phone storage and installing it from there.

I wanted get the logcat of the application that I'll be running.

Basically I'm quite naive in android, I'm not quite sure of the terms I said but, What I want is a way to test my app on my phone without the role of my PC.

Usage of SDLC in Companies to improve its Product?

I am trying to find a stories of companies which implements different software development life cycle in manufacturing of his product to improve his product efficiency and make them cost effective.

"Invalid use of argument matchers" but I use matchers only

I get the error message:

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Invalid use of argument matchers! 0 matchers expected, 1 recorded: -> at *.SegmentExportingTest.happyDay(SegmentExportingTest.java:37) This exception may occur if matchers are combined with raw values: //incorrect: someMethod(anyObject(), "raw String"); When using matchers, all arguments have to be provided by matchers. For example: //correct: someMethod(anyObject(), eq("String by matcher"));

but in reality I use only matchers in arguments of the method.

The next code is a source of the error above.

ConfigReader configReader = mock(ConfigReader.class);
    when(configReader.getSparkConfig())
            .thenReturn(new SparkConf().setMaster("local[2]").setAppName("app"));
    when(configReader.getHBaseConfiguration()).thenReturn(new Configuration());

    SparkProfilesReader sparkProfilesReader = mock(SparkProfilesReader.class);
    ProfileSegmentExporter profileSegmentExporter = mock(ProfileSegmentExporter.class);

    //--
    new SegmentExporting().process(configReader, sparkProfilesReader, profileSegmentExporter);
    //--

    InOrder inOrder = inOrder(sparkProfilesReader, profileSegmentExporter);
    inOrder.verify(sparkProfilesReader).readProfiles(any(JavaSparkContext.class),
            refEq(configReader.getHBaseConfiguration()));

Different ETL Testing defect?

Can anyone give some example of different kind of defect in ETL Testing? 1. High Priority and High severity 2. High Priority and Low severity. 3. Low Priority and High severity. 4. Low Priority and Low severity.

How to unit test database functions? (Doctrine2)

I may dont understand the concept of testing. Here is a function:

$qb->select('u')
   ->from('User', 'u')
   ->where('u.id = ?1')
   ->orderBy('u.name', 'ASC');

it is then "very" easy to write a mock, replace, expect the parameters, expect something result, etc. This is also detached from the database (no need real database then).

But what if I miss the ordering? I can still write a good test for it, without making sure it actually works. Another example:

function add($a, $b)
{
    return $a-$b;
}

our imaginary test:

function testAdd()
{
    $a = 1;
    $b = 4;

    $mock = $this->getMock(test);
    $mock->expects($a)->once()->with(1);
    $mock->expects($b)->once()->with(4);

    $this->assertEquals (-4324,534, testAdd($a, $b);
}

this (fictional) test is similar to database test above. Lets take some parameters, expect that they run once, and produces a fake value. But actually, I still dont know it my "Add" method works well.

samedi 27 février 2016

generating file system data for application testing

I am testing changes to rsync and evaluating several file systems to run it on.

What is the recognized way research papers on this area use to generate data?

i was halfway writing a script that would generate 500~3000Gb of data, taking into account compressible data, non-compressible data, sparse files, big files, etc.

But surely there must be already something like that

Testing - acheving condition coverage with nested if's?

I am trying to find out if it's possible to have a set of test inputs that achieves 100% condition coverage for the following code.

bool a = ...;
bool b = ...;
if (a == True){
    if (b == True && a == False){
        ...
    } else{
        ...
    }
} else{
    ...
}

However, most of the resources I have found only deal with one condition. Therefore I am not sure what to do with nested ifs. Specifically, I am not sure what to do with the second if statement. Since "a == False" should never be true given the outer if statement, is it correct to say that this code can never have 100% condition coverage test cases?

Should I put my automated regression tests inside a web application?

Question

Is it worth building a web application front-end for my department's automated regression tests? I've searched quite a bit and I don't think anything like this exits. Basically the web application would allow a user to specify a URL, expected inputs, and expected outputs and an expected return URL. On the back-end a headless browser would be running on the server to test the scenario just defined by the user, most likely using calls to a headless browser... I've searched quite a bit to see if something as simple as this exists but I haven't had any luck. I've found lots of tools for allowing programmatic operation of browser commands but a web front-end for testing another web application I have not.

Background

My team has dedicated automated regression tests that the testers run on their local machines. The tests are written in Python, utilize some Selenium integration plugins, and use an excel spreadsheet as input on what to test. They are maintained by the QA department.

Problem

  • Nobody outside the QA team knows how extensive these regression tests are because they exist only on individual laptops.
  • They have no central repository, and the dev team has no means of actively updating these tests as we build new features. We must leave it 100% up to the QA department.
  • The business analysts don't have access to the results of these tests. Because of all this, a lot of uncertainty exists around our automated testing increasing reluctance to change things without instructing the QA team to perform full scale manual regression tests...

This has led me to consider putting all of our Selenium tests in the cloud behind a user-friendly web front-end that anyone can use and access from anywhere. They could then easily create new tests using dropdown menus. Everyone, developers, testers, and business analysts, can see whats covered in a test sequence and update them as we add new features. I believe this would also make it easier to have Jenkins jobs trigger tests to run at timed intervals if web application exposed web service hooks for jenkins... But I feel like perhaps I'm re-inventing the wheel. Is what I'm proposing to build worth it?

How to compare char* with string in boost unit test?

I have got code like below:

BOOST_FIXTURE_TEST_CASE(test, TestSuite1)
{
    unsigned int length = 5;
    char* content1=new char[length];
    content1="abcde";
    string content2("abcde");

    BOOST_REQUIRE( length == content2.length() );

    for(unsigned int i=0;i<5;++i)
    {
        BOOST_CHECK( content1[i] == content2[i] );
    }

    if(content1 != nullptr)
    {
        delete[] content1;
        content1 = nullptr;
    }
}

The question is how to compare char* with string in boost unit test? I have used loop, but I don't know if it is a good way. Is there any better solution? Thank you very much.

Best way to recognize test classes?

I am building a program that recognizes test classes and gives the coder an idea how much test code he wrote compared to the actual source code. My question is how can I make the program recognize a test class despite the type of tests that has been used? what is the main sign that you may find in a test class? Is it the @Test notation? If so how to handle it?

This is a piece of code of a class that I made to recognize test classes:

public void walk(String path) throws FileNotFoundException {
    int countFiles = 0;
    File root = new File(path);
    File[] list = root.listFiles();
    if (list == null) {
        return;
    }

    for (File f : list) {
        if (f.isDirectory()) {
            walk(f.getAbsolutePath());
        }

        if (f.getName().endsWith(".java")) {

            System.out.println("File:" + f.getName());
               Scanner sc2 = new Scanner(f);

            while (sc2.hasNextLine()) {

                count++;

                String str = sc2.nextLine();

                for (int i = 0; i < str.length(); i++) {
                    if(str.equals("@Test")){
                    System.out.println("this a test clsee!");
                }

But unfortunately my idea is not working. So what can I do?

How to know that in QTP/UFT which add-in's were used in any random test project?

Here the situation is that I have a already tested project and I Don't know that which add-ins is being used in that tested project so my question is that how can I know which add-in is used in that test project using that test script to prepare the test environment ?

What is the difference between visit and current_path and use of .should in rails?

Then /^I should be on the free signup page$/ do
  *current_path.should == free_signup_path* 
end

Then /^I should be on the free signup page$/ do
   *visit free_signup_path* 
end

What is the difference between these two ?

vendredi 26 février 2016

No runnable methods on Android JUnit4 Instrumentation Tests

Ce résumé n'est pas disponible. Veuillez cliquer ici pour afficher l'article.

PHP laravel 5, No tests executed

I'm trying to write my very first unit test in PHP Laravel 5 framework. As per the documentation followed the steps but it always ended up with

C:\xampp\htdocs\IntelliKid>phpunit
PHPUnit 4.8.21 by Sebastian Bergmann and contributors.

Time: 744 ms, Memory: 3.00Mb

No tests executed!

Below is my test class in the /test directory.

<?php

use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class TestSample extends TestCase
{
    /** @test */
    public function testExample()
    {
        echo "MY TEST EXECUTING";
        $this->assertTrue(true);
    }
}

Further, below is my phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="bootstrap/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false">
    <testsuites>
        <testsuite name="Application Test Suite">
            <directory>./tests/</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist>
            <directory suffix=".php">app/</directory>
        </whitelist>
    </filter>
    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="QUEUE_DRIVER" value="sync"/>
    </php>
</phpunit>

Any help, appreciated. Thanks!

LLVM check-all with clang

I guess the problem is easy-solvable but I just can't figure out how.

I have built llvm + clang (release 38) using clang-3.5 as a compiler. Now I want to check-all, and here the trouble comes: a lot of tests crash with reports like bellow:

*** Do not use 'clang' in tests, use '%clang'. ***-cc1 -internal-isystem ../llvm/build/bin/../lib/clang/3.8.0/include -nostdsysteminc -fms-compatibility -fms-extensions -fsyntax-only -verify -std=c++11 .../llvm/tools/clang/test/SemaCXX/attr-selectany.cpp

Exit Code: 127

Googling this doesn't help a lot - at least, I couldn't find anything useful.

I can't understand, what does it mean - use %clang in tests instead of clang?

Getting value from hex dump of Visual Studio test log

Visual Studio stores the testlog in LoadTestTestLog table of Loadtest2010 database. The test log value looks to be a hex dump. any pointers on how I could actually get data from it like context parameter name or other test related data?

I tried converting the dump into string readable format and it looks like the entire data is serialized in some manner.

Snapshot of decode

Creating a TravisCI config for automated testing of a Go application

I would like to create a .travis.yml config that performes the following:

  • fetches a Go application source code from Github,
  • installs the other required libraries with go get
  • attempts to build the go application with go build
  • run tests with go test

I new to Go application testing with TravisCI, therefore I would appreciate any help or examples someone could point me to.

Access option values webdriver.io

Right now with my ui tests using WebdriverIO, I have this in my configuration file:

var baseUrl = 'http://localhost:3000';

global.testParameters = {
  baseUrl: baseUrl
};

This gives me access to my base url in the tests however it has to be fixed in the configuration file and I can't use the --baseUrl option when running wdio command. The reason for this is because from everything I have read, I don't see a way to have access to command line option values in my tests.

Is there a way to access the value of the command line options (specifically --baseUrl) in my actual test files?

how to measure the productivity difference of two nurses

I have this data with 60 observations for continues three days hours, in which two nurses work in irregular shifts to cover this whole period:

hours   Productivity    Nurse 
1                 50%       A
2                 40%       A
3                 20%       B
4                 10%       A
5                 60%       B
6                15%        B
7                15%        B
.   .   
.   .   
.   .   
60                5%         A

I have been asked to build a time series model for the Productivity and decide whether there a strong Productivity difference between nurse A and nurse B. what is the right statistical approach to handle this question? thanks for the kind help in advance

Testing nested routes in rails

I was writing integrations tests for my application. I am familiar with the controller tests and the normal integration testing. However, I am not sure how to test nested resources in the integration testing. I have a teams model which is nested inside the scoreboards model. The relevant routes code is given below.

resources :scoreboards do 
   resources :teams, only: [:edit, :create, :destroy, :update]
 end

I want to test all the important workflows for teams. For example, the invalid and valid creation of teams. The test code is written below.

def setup
    ActionMailer::Base.deliveries.clear
    @scoreboard = scoreboards(:scoreboard_a)
  end



test 'Invalid creation of the teams' do
    assert_no_difference 'Team.count' do
      post scoreboards_teams_path(@scoreboard), team: {name: " ", 
                                                        win: 0, 
                                                       loss: 0, 
                                                        tie: 0 }

    end
  end 

I have the validation set up in such a way that team name must be present. The problem is with the routes. I also have an association set up with scoreboard_a. The teams.yml file is given below.

team_a:
    name: team
    win: 1
    loss: 2
    tie: 0
    id: 2
    scoreboard: scoreboard_a 

I get a no method error. The error is given below.

`NoMethodError: undefined method `scoreboards_teams_path'. 

Since teams are nested inside scoreboards show page. Therefore, there isn't a new action I can call the get request to. My question is, how would I call a post request to the teams object. I am not exactly sure how to do that. I have tried looking through documentation but there isn' really anything on nested routes. I have other objects that are nested inside scoreboards as well. Therefore, understanding how nested routes are tested in rails would really go a long way. As always, any help is greatly appreciated. Thanks!!

Spring: "NoSuchBeanDefinitionException: No bean named 'dataSource' is defined" when testing

I have been trying to test the DAO layer of an application, however I keep getting this error.

Here is the Test class

RegionDAOTest.java

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.teamw.ibt.dao.impl.RegionDAOImpl;
import com.teamw.ibt.model.Region;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(locations = "classpath:app-context.xml")
public class RegionDAOTest extends AbstractDAOTest {

 @Autowired
 private JdbcTemplate jdbcTemplate;
 private RegionDAOImpl regionDAOImpl;

 @Before
 public void setUp(){
     regionDAOImpl = new RegionDAOImpl();
     regionDAOImpl.setJdbcTemplate(jdbcTemplate);
 }

 @After
 public void tearDown(){
 }

 @Test
    public void testContext() {
        assertNotNull(regionDAOImpl);
    }

 @Test
 public void FindByCodeTest() {
    Region region = regionDAOImpl.findByCode("1");
    assertEquals('1', region.getCode());
    assertEquals("Region 1", region.getName());
 }
}

RegionDAOImpl.java

@Repository
public class RegionDAOImpl implements RegionDAO {

@Autowired
private JdbcTemplate jdbcTemplate;

public RegionDAOImpl() {

}

@Autowired
public RegionDAOImpl(JdbcTemplate jdbcTemplate) {
    this.jdbcTemplate = jdbcTemplate;
}

@Autowired
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
    this.jdbcTemplate = jdbcTemplate;
}


public void insert(Region region) {
    String query = "INSERT INTO IBT.REGION (code, name) VALUES ('" + region.getCode() + "','" + region.getName() + "');";
    jdbcTemplate.update(query);
}

public Region findByCode(String code) {
    String query = "SELECT * FROM IBT.REGION WHERE CODE = '" + code + "';";
    return jdbcTemplate.query(query, new ResultSetExtractor<Region>() {
        @Override
        public Region extractData(ResultSet rs) throws SQLException, DataAccessException {
            if (rs.next()) {
                return new Region(
                    rs.getString("code"),
                    rs.getString("name")
                );
            }

            return null;
        }
    });
}
}

app-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://ift.tt/GArMu6"
  xmlns:xsi="http://ift.tt/ra1lAU" 
  xsi:schemaLocation="http://ift.tt/GArMu6
  http://ift.tt/QEDs1e ">

<!-- Initialization for data source -->
 <bean id="dataSource" 
   class="org.springframework.jdbc.datasource.DriverManagerDataSource">
   <property name="driverClassName" value="org.h2.Driver"/>
   <property name="url" value="jdbc:h2:mem"/>
   <property name="username" value="SA"/>
   <property name="password" value="test"/>
 </bean>

 <bean id="JdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    <property name="dataSource" ref="dataSource"></property>
 </bean>

<bean id="regionDAOImpl" name="regionDAOImpl" class="com.teamw.ibt.dao.impl.RegionDAOImpl">
  <constructor-arg ref="jdbcTemplate"/>
</bean>
</beans>

As far as I know, I have set up everything correctly, but for some reason it says dataSource is not defined.

Creating a Batch file that pings google constantly and testing the response time

I'm trying to create a batch file that will constantly ping google.com and check the response time - "time=Xms".

  • If the time <= 39ms the text of that ping(or the background) should be green.
  • If the time > 40ms and < 80ms the text of that ping(or the background) should turn orange.
  • If the time >= 80ms the text of that ping(or the background) should turn red.

I have this batch at the moment which pings google every 3 seconds changes the background from green to red if the response fails:

    @echo off
:color 97

:start
PING -n 1 www.google.com 
call :color
goto :start

:color
    IF %ERRORLEVEL% EQU 0 (
        COLOR 27
    ) else (
        COLOR 47
    ping -n 1 127.0.0.1 >nul
    COLOR 74
    ping -n 1 127.0.0.1 >nul
    COLOR 47
    )
    ping -n 3 127.0.0.1 >nul
    GOTO:EOF

This works fine but I don't know how to test response times.

Non cloud base cross-browser testing Tool

I am looking for A software that would allow my to test multiple browsers and cell devices.

but due to privacy policies we cannot have this on a cloud, everything has to stay local.

i found the following 2 products but haven't heard much of them before

http://ift.tt/V42Dx3

http://ift.tt/1PF0F2n

Gallery of example matrices in python

Where can I find a gallery (library) of example matrices for python?

I'm thinking of stuff like Matlab's magic() and gallery() (especially 'randcorr')

Testing Random Number Generators(RNG)

There are numerous tests of RNGs. Consider that we tested RNG with lots of different seeds and the output is as follows: with certain seeds the RNG passes the test, with other seeds RNG doesn't pass. By passing I mean we 1.fix significance level, 2. find critical value, 3.If the test output is bigger than critical value we reject. Or we may do something like that with p-values. We can fix the seed and for fixed seed take random number sequences from RNG, and we see for some sequences RNG passes the test, for others doesn't pass. So the MAIN question is how check whether RNG good or not, IF some of sequences pass the test, some sequences of THE SAME RNG don't pass? Should I plot the distribution of p-values of test outputs, which we know that is uniformly distributed ?

Thank you very much in advance.

Selecting a value from jQuery Chosen Dropdown using CodeCeption test script

Hello i m trying to pick a value from jQuery Chosed Dropdown using codeception scripting, following is dev code

<div class="chosen-container chosen-container-single chosen-container-active" style="width: inherit;" title="" id="Merchantserviceproviders_country_chosen">
<a tabindex="-1" class="chosen-single"><span>United States</span><div><b></b></div></a>
<div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off"></div>
<ul class="chosen-results">
<li class="active-result" style="" data-option-array-index="0">Please select country</li>
<li class="active-result" style="" data-option-array-index="1">United States</li>
<li class="active-result" style="" data-option-array-index="2">Canada</li>
<li class="active-result" style="" data-option-array-index="3">United Kingdom</li>
<li class="active-result" style="" data-option-array-index="4">Ireland</li>
<li class="active-result" style="" data-option-array-index="5">South Africa</li>
<li class="active-result" style="" data-option-array-index="6">Turkey</li></ul></div></div>                                    
<span class="note"><div style="display:none" id="Merchantserviceproviders_country_em_" class="errorMessage"></div></span></div>

Although i am able to select it using xpath via following;(United Stated in this case)

$I->click(['css' => 'div#Merchantserviceproviders_country_chosen']);
$I->click(['xpath' => '//div[@id="Merchantserviceproviders_country_chosen"]/div/ul/li[2]']);

But the issue is that the selection is through position of the value in the list, so as if any new value(country is added) i will not be able to select it until i know its placement.

I want to know how would i be able to select the country using its Value(United States in my case) not the placement in the list.

TestNG Master Suite wont run defined suites

Im trying to run 3 suites from one master suite file but when i run the TestNG suite nothing happens as in the suite never starts.

If i run the suites individually the suites run so as far as i can see the problem is with the master suite. Any help would be appreciated.

Master Suite

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://ift.tt/19x2mI9">
<suite name="Chrome Test Suite" verbose="1">
    <suite-files>
        <suite-file path="./src/test/java/suites/CAR_MozillaTestSuite.xml"></suite-file>
    </suite-files>
</suite> 

CAR_MozillaTestSuite.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://ift.tt/19x2mI9">
<suite name="Mozilla Test Suite">
    <parameter name="browser" value="Mozilla" />
    <parameter name="domain" value="Caribbean" />
    <listeners>
        <listener class-name="utils.Listener"></listener>
    </listeners>
    <test name="Mozilla Test" preserve-order="true">
        <classes>
            <class name="tests.common.LoginLogout_Test" />
        </classes>

    </test>

</suite>

How can i exactly work with the setup of below code to capture the screenshots using AWS?

public boolean takeScreenshot(final String name) {
       String screenshotDirectory = System.getProperty("appium.screenshots.dir", System.getProperty("java.io.tmpdir", ""));
       File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
       return screenshot.renameTo(new File(screenshotDirectory, String.format("%s.png", name)));
   }

jeudi 25 février 2016

Step ‘Run Tests on AWS Device Farm’ aborted due to exception: javax.net.ssl.SSLHandshakeException: Could not generate secret

I am trying to integrate the Jenkins with AWS device Farm to automate the Mobile device testing. So, i had created an IAM user and attached the devicefarm policy to teh user. Generated AWS Access Key ID & AWS Secret Key ID and provied in the jenkins manage configurations.

But the Post-build Actions to Run Tests on AWS Device Farm leads to below exception. Could anyone be able to help me?

Exception stackstrace is as below:

[AWSDeviceFarm] Using Project 'BMS_OPDVO'
[AWSDeviceFarm] Using DevicePool 'LG Nexus5'
[AWSDeviceFarm] Using App '**/target/resources/org.wordpress.android.5.0.apk'
[AWSDeviceFarm] Archiving artifact 'org.wordpress.android.5.0.apk'
[AWSDeviceFarm] Uploading org.wordpress.android.5.0.apk to S3
ERROR: Step ‘Run Tests on AWS Device Farm’ aborted due to exception: 
javax.net.ssl.SSLHandshakeException: Could not generate secret
    at sun.security.ssl.ECDHCrypt.getAgreedSecret(ECDHCrypt.java:103)
    at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:1067)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:348)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:290)
    at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:259)
    at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:125)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:319)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
    at org.jenkinsci.plugins.awsdevicefarm.AWSDeviceFarm.upload(AWSDeviceFarm.java:359)
    at org.jenkinsci.plugins.awsdevicefarm.AWSDeviceFarm.upload(AWSDeviceFarm.java:330)
    at org.jenkinsci.plugins.awsdevicefarm.AWSDeviceFarm.upload(AWSDeviceFarm.java:317)
    at org.jenkinsci.plugins.awsdevicefarm.AWSDeviceFarm.uploadApp(AWSDeviceFarm.java:211)
    at org.jenkinsci.plugins.awsdevicefarm.AWSDeviceFarmRecorder.perform(AWSDeviceFarmRecorder.java:287)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1037)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
    at hudson.model.Run.execute(Run.java:1766)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:408)
Caused by: java.security.InvalidKeyException: ECDH key agreement requires ECPublicKey for doPhase
    at org.bouncycastle.jcajce.provider.asymmetric.ec.KeyAgreementSpi.engineDoPhase(Unknown Source)
    at javax.crypto.KeyAgreement.doPhase(KeyAgreement.java:567)
    at sun.security.ssl.ECDHCrypt.getAgreedSecret(ECDHCrypt.java:100)
    ... 34 more

Running Multiple Test Cases in same Window one by one

I am using Selenium Web Driver with Java for my Testing, I have a Problem with Running multiple Test Cases in Same Browser Window One By One. Can anyone help me??

Thank you!!

Coverage : ImportError: cannot import name config

When I try to run this code I am getting: ImportError: cannot import name config in line 32 of this file:

lib/python2.7/site-packages/tests/functional_tests/fixtures/__init__.py

Any idea about the reason of this error?

import os
COV = None
if os.environ.get('FLASK_COVERAGE'):
    import coverage
    COV = coverage.coverage(branch=True, include='app/*')
    COV.start()

from flask.ext.script import Manager, Shell
from app import create_app, db
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)

@manager.command
def test(coverage=False):
    """Run the unit tests."""
    if coverage and not os.environ.get('FLASK_COVERAGE'):
        import sys
        os.environ['FLASK_COVERAGE'] = '1'
        os.execvp(sys.executable, [sys.executable] + sys.argv)
    import unittest
    tests = unittest.TestLoader().discover('tests')
    unittest.TextTestRunner(verbosity=2).run(tests)
    if COV:
        COV.stop()
        COV.save()
        print('Coverage Summary:')
        COV.report()
        basedir = os.path.abspath(os.path.dirname(__file__))
        covdir = os.path.join(basedir, 'tmp/coverage')
        COV.html_report(directory=covdir)
        print('HTML version: file://%s/index.html' % covdir)
        COV.erase()

if __name__ == '__main__':
    manager.run()


error log:

python coverage.py test

ERROR: tests.functional_tests.test_providers (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: tests.functional_tests.test_providers
Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/lib/python2.7/unittest/loader.py", line 230, in _get_module_from_name
    __import__(name)
  File "/home/vagrant/myproject/venv/local/lib/python2.7/site-packages/tests/functional_tests/__init__.py", line 1, in <module>
    from . import fixtures
  File "/home/vagrant/myproject/venv/local/lib/python2.7/site-packages/tests/functional_tests/fixtures/__init__.py", line 32, in <module>
    from tests.functional_tests import config
ImportError: cannot import name config


----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)

How to detect a .lock file in a geodatabase

I am very new to python, but I have written a simple python script tool for automating the process of updating mosaic datasets at my job. The tool runs great, but sometimes I get the dreaded 9999999 error, or "the geodatase already exists" when I try to overwrite the data.
The file structure is c:\users\my.name\projects\ImageryMosaic\Alachua_2014\Alachua_2014_mosaic.gdb. After some research, I determined that the lock was being placed on the FGDB whenever I opened the newly created mosaic dataset inside of the FGDB to check for errors after running the tool. I would like to be able to overwrite the data instead of having to delete it, so I am using the arcpy.env.overwriteOutput statement in my script. This works fine unless I open the dataset after running the tool. Since other people will be using this tool, I don't want them scratching thier heads for hours like me, so it would be nice if the script tool could look for the presence of a .Lock file in the geodatabase. That way I could at least provide a statement in the script as to why the tool failed in lieu of the unhelpful 9999999 error. I know about arcpy.TestSchemaLock, but I don't think that will work in this case since I am not trying to place a lock and I want to overwrite the FGDB, not edit it.

Django testing, change request

I have a middleware from secretballot

class SecretBallotMiddleware(object):
    def process_request(self, request):
        request.secretballot_token = self.generate_token(request)

    def generate_token(self, request):
        raise NotImplementedError


class SecretBallotIpMiddleware(SecretBallotMiddleware):
    def generate_token(self, request):
        return request.META['REMOTE_ADDR']


class SecretBallotIpUseragentMiddleware(SecretBallotMiddleware):
    def generate_token(self, request):
        s = ''.join((request.META['REMOTE_ADDR'], request.META.get('HTTP_USER_AGENT', '')))
        return md5(s.encode('utf8')).hexdigest()

and I use this in my view (e.g. 'different_view'):

token = request.secretballot_token

How can I change this token form request in my tests?

class BasicTest(TestCase):
    def test_one(self):
        self.client.request['secretballot_token']='asd' #??
        response = self.client.post('/different_view/')

And I want to send post in this test to /different_view/ but with my own, changed token.

Opening test result from Release Management

Our build through RM executes tests and produces a result file (*.TRX extension). It had been added to the approved list in RM. However, when I clicked on the link "View Log" in the Deployment Log, it threw this error :"an error occurred while sending command to the application". How can I get it opened directly in Visual Studio?

enter image description here

enter image description here

How to run specific tests with frisby?

We are using frisby to run our integration tests and while developing them, it would be handy to execute one specific one or a group of tests, without having run all of them and see extra noise. Right now I am commenting out all the ones I don't want to run, which is getting tedious.

Is there a way, from the command line, to run specific frisby tests?

So basically, instead of

npm test

I want to be able to say

npm test --name: posts

Or something like that. I found this post about jasmine-only, but I'm not sure it will satisfy my needs.

Thanks so much!

patching a method in Ruby

How do you patch a method in Ruby as you do in Python via @patch decorator?

Whatever I've so far seen on Ruby's monkey patching falls into 'overloading' rather than patching. What I need now, is patch curb's curl method to return some expected results instead of actually looking up things. How do I do that? Import and overload curl.get()?

Is there even a same approach or should I start thinking somehow different?

SOATest value Assertion failed for data source lookup

I am using parasoft SOATest to test a service response and I got a failure Message: DataSource: products (row 1): Value Assertion: For element "../item", expected: abc but was: bcd

My Requirement is to validate the following response.

{
    "samples" : {
        "prds" : [
            "abc",
            "bcd"
        ]
    }
}

And I have a datasource table which is like follows. First row as the column name.

  1. prds
  2. abc
  3. bcd

In the SOATest I have a JSON Assertor and inside JSON Assertor I have configured a Value Assertion. In the Value Assertion I selected the first item and then in the next step I selected Apply to all "item[*]". Then Finish.

In the Expected Value I select Parameterized and select the prds from the drop down menu.

After all when the service return the above payload it failed with the above given message.

Is this a bug/limitation of SOATest or am I missing some step in here.

Passing parameters in integration test JAVA

I try to pass parameters in post request in integration test, but I get response that required parameter "source" aint detected. Maybe you will know what is cause. Thank you.

public void testUploadBundleFromRepository() throws IOException, InterruptedException {

    String boundary = "---------------"+ UUID.randomUUID().toString();

    String uri = String.format("http://%s:%d/upload/", HOST, PORT);

    HttpPost httpPost = new HttpPost(uri);
    httpPost.setHeader(HTTP.CONTENT_TYPE, ContentType.MULTIPART_FORM_DATA.getMimeType()+";boundary="+boundary);

    List<NameValuePair> postParameters = new ArrayList<>();
    postParameters.add(new BasicNameValuePair("source","repo"));
    postParameters.add(new BasicNameValuePair("id","1"));
    postParameters.add(new BasicNameValuePair("start", "true"));
    httpPost.setEntity(new UrlEncodedFormEntity(postParameters, "UTF-8"));

    HttpResponse response = getHttpClient().execute(httpPost);

    //assert in future
}

what is the theoretical benchmark upon which to make select the artifical network to predicting data?

I have trained neural networks for 50 times(training) now I am not sure which network (from 50nets) I should choose to predict my data?Among MSE(mean square error) of network or R-squred or validation performance or test performance?....Thanks for any suggestion

why class="form-control" makes conflicts with protractor

I have resolved this, but I would like to know why I had to do what I did. I will splain myself:

This is my code, so easy, a login form:

<div class="col-sm-8">
     <div class="form-group">
          <input type="text" class="form-control" name="username" placeholder="{{'layout.username' | translate}}" ng-model="credentials.username">
     </div>
     <div class="form-group">
          <input type="password" class="form-control" name="password" placeholder="{{'layout.password' | translate}}" ng-model="credentials.password">
     </div>
</div>

Now in protractor I will try to put some text in both inputs:

importedModule.putValueInElement(importedModule.passLogin,"editor");
importedModule.putValueInElement(importedModule.userNameLogin,"editor");
importedModule.clickWithDelay(importedModule.buttonSingIn);

where:

var userNameLogin = element(by.model('credentials.username'));
var passLogin = element(by.model('credentials.password'));
var buttonSingIn = element(by.id('buttonSingIn'));

After I execute it, i get this common error:

Failed: Timed out waiting for Protractor to synchronize with the page after 11 seconds. Please see http://ift.tt/OLBPn9

After testing different ways to fix it, I figured out that if I remove 'form-control' class, the problem is gone. But why?

Why JBehave maintain data across steps Given/When/Then during a Scenario?

I am trying JBehave and I need to understand why maintains data (instance variables from the steps) across scenarios (testCases -> Given/When/Then).

I mean, is it possible to clear the instance variable maintained during the execution of each scenario (Given/When/Then) without using @BeforeScensario?

Example:

public class GenerateReportSteps {

private String a;
private String b;
private String c;

@BeforeScenario
public void beforeEachScenario() {
    a = null;
    b = null;
    c = null;
}

.. .. }

If I'm not wrong, I understand that each scenario (Given/When/Then) have to be atomic, so the framework JBehave should initialize to null the instance variables before run each scenario per user story.

Thanks.-

Unit Testing days in a given month & year failing when should be correct. Swift 2

I have the below function within my AddNewViewController class:

func dayCount(year : Int, month : Int) -> Int {
    switch (month) {
    case 2:
        return year % 4 == 0 && year % 100 != 0 ? 29 : 28
    case 1, 3, 5, 7, 8, 10, 12:
        return 31
    case 4, 6, 9, 11:
        return 30
    default:
        return 0 // Invalid month number
    }
}

within my test class i have the following code:

import UIKit
import XCTest

class BudgetBuddiTests: XCTestCase {
 override func setUp() {
    super.setUp()
}

override func tearDown() {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    super.tearDown()
}

 func testDesignIsDisplayedAfterViewLoads() {
        let vc = AddNewViewController()
        let days = vc.dayCount(2016, month: 2)
        XCTAssertEqual(29, days, "The days in Feb 2016 should be 29 as its a leap year")
    }

}

When I try and run the test it says test failed and I'm confused as to why.

Any help would be appreciated.

java.lang.ClassNotFoundException: org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$Work in running my tests

So this is the error log which I am getting while running tests:

Caused by: java.lang.NoClassDefFoundError: org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl$Work
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:54) ~[spring-orm-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343) ~[spring-orm-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318) ~[spring-orm-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    ... 43 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$Work
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_65]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_65]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_65]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_65]
    ... 48 common frames omitted

2016-02-25 20:28:16.792  WARN 3257 --- [           main] o.s.boot.SpringApplication               : Error handling failed (Error creating bean with name 'delegatingApplicationListener' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metaDataSourceAdvisor': Cannot resolve reference to bean 'methodSecurityMetadataSource' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' is defined)
2016-02-25 20:28:16.793 ERROR 3257 --- [           main] o.s.test.context.TestContextManager      : Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@5f282abb] to prepare test instance [com.opensecret.Service.user.UserServiceImplTest@6f195bc3]

java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) ~[spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) ~[spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117) ~[spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) ~[spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:228) ~[spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:230) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:249) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137) [junit-4.12.jar:4.12]
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) [junit-rt.jar:na]
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) [junit-rt.jar:na]
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) [junit-rt.jar:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_65]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_65]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_65]
    at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_65]
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) [idea_rt.jar:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl$Work
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:829) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
    at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
    at org.springframework.boot.test.SpringApplicationContextLoader.loadContext(SpringApplicationContextLoader.java:98) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) ~[spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) ~[spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    ... 28 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl$Work
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:54) ~[spring-orm-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343) ~[spring-orm-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318) ~[spring-orm-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    ... 43 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$Work
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_65]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_65]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_65]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_65]
    ... 48 common frames omitted

java.lang.IllegalStateException: Failed to load ApplicationContext

    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:228)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:230)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:249)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl$Work
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:829)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764)
    at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
    at org.springframework.boot.test.SpringApplicationContextLoader.loadContext(SpringApplicationContextLoader.java:98)
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)
    ... 28 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl$Work
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:54)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
    ... 43 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$Work
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 48 more

This is my build.gradle:

buildscript {
    ext {
        springBootVersion = '1.3.1.RELEASE'
        junitVersion = '4.12'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
    }
}

apply plugin: 'spring-boot' 

jar {
    baseName = 'open-secret'
    version = '0.0.1-SNAPSHOT'
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    compile("org.springframework.boot:spring-boot-starter-security")
    compile("mysql:mysql-connector-java")
    testCompile("org.springframework.boot:spring-boot-starter-test")
    testCompile("junit:junit:${junitVersion}")
    testCompile("org.mockito:mockito-core")
    testCompile("org.hsqldb:hsqldb")
}


eclipse {
    classpath {
         containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
         containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
    }
}

This is my application-test.properties file which is api/src/test/com/myapp/resources:

spring.profiles.active: test
spring.jpa.database: HSQL
spring.datasource.url= jdbc:hsqldb:mem:opensecret
spring.jpa.hibernate.ddl-auto: update
spring.jpa.hibernate.dialect= org.hibernate.dialect.HSQLDialect
spring.datasource.driver-class-username=org.hsqldb.jdbcDriver
spring.datasource.username: root
spring.datasource.password: password

And this is my UserServiceImplTest:

package com.opensecret.Service.user;

import com.opensecret.OpenSecretApplication;
import com.opensecret.model.Authority;
import com.opensecret.model.UserInfo;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import static org.junit.Assert.*;

@RunWith(SpringJUnit4ClassRunner.class)
@Transactional
@Rollback(true)
@ActiveProfiles("test")
@SpringApplicationConfiguration(classes = {OpenSecretApplication.class })
public class UserServiceImplTest{

    @Autowired
    private UserService userService;

    @Before
    public void setUp(){
        UserInfo userInfo = new UserInfo();
        userInfo.setEmail("abc@email.com");
        userInfo.setUsername("james");
        userInfo.setPassword("password");
        userInfo.setAuthority(Authority.USER.toString());
        userInfo.setEnabled(true);
        userInfo.setCreated_at(new Date());
        userInfo.setUpdated_at(new Date());
        userService.createUser(userInfo);
    }

    @Test
    public void testGetAllUsers() throws Exception {
        Collection<UserInfo> users = userService.getAllUsers();
        assertEquals(users.size(), 1);

        List userList = new ArrayList(users);
        UserInfo user = (UserInfo) userList.get(0);
        assertEquals(user.getEmail(),"abc@email.com");
        assertEquals(user.getUsername(),"james");
        assertEquals(user.getPassword(),"password");
        assertEquals(user.getAuthority(),"USER");
        assertEquals(user.isEnabled(),true);
    }
}

I think its related to some version issue but not sure.So I have one more application.properties file which is in my api/src/main/com/myapp/resources which is this

 server.port: 9000
management.port: 9001
management.address: 127.0.0.1

spring.datasource.catalog=opensecret
spring.datasource.url= jdbc:http://mysqllocalhost:3306/${spring.datasource.catalog}
spring.datasource.driver-class-username=com.mysql.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=password

spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.dialect= org.hibernate.dialect.MySQLInnoDBDialect

So having two file application.properties, is this causing this error or some other issue? Need help.