jeudi 30 novembre 2017

Is there a website to manage beta testing?

I'm currently managing the beta testing of my software using trello and freedcamp. Now that the beta testers are more and more, it's getting hard to track their licences, provide them the new builds and, generally speaking, managing the beta testing phase. I'm wondering if there's a platform where I can invite users, share their download links and licences privately, collect bugs and talk about testing with them?

Unit test on SystemWorkbench for STM32

i have question about Unit Test on STM32. Is any way to do it on Windows and SystemWorkbench for STM32? I need tutorial step-by-step : ). Thank You for help : D

Rails: How do I ensure that he db reverts to its original state after tests?

I'm trying to write a test that involves creating a new user. However, the test fails all but the first time because the user remains permanently in the db after the initial run.

require 'test_helper'
require 'minitest/autorun'

describe UserMailer < ActionMailer::TestCase do
  it 'will send an email when a new user is created' do
    original_mail_count = ActionMailer::Base.deliveries.count
    User.create(email: "new_user@test.com", password: "password").save
    ActionMailer::Base.deliveries.count.must_equal original_mail_count + 1
  end
end

How do I ensure that the db returns to its pre-test state after the test is run?

Is there any way to combine CollectionFixtures with ClassFixtures in XUnit?

I have some code that needs to get initialized once for all test classes, so I've placed this code in a CollectionFixture.

[CollectionDefinition("TestCollectionFixture")]
public class BaseTestCollection : ICollectionFixture<BaseTestFixture>
{
}

But then one of the test classes has some extra code that needs to get initialized once for all of its methods. So, I'd like to combine the CollectionFixture with an IClassFixture. So, I'd like something like the following:

[Collection("TestCollectionFixture")]
public class DummyTestClass : IClassFixture<DummyTestFixture>
{
    public DummyTestClass (BaseTestFixture baseTestFixture, DummyTestFixture dummyTestFixture)
    {
        // Do some stuff here, hopefully using both fixtures..
    }
}

Is this possible in any way?

Ionic 3 infinite-scroll simulate in e2e test jasmine/protractor

If you go here: http://ift.tt/2nin9mg

Inspect the demo and click the last item on the list:

enter image description here

Then in the console type: $0.scrollIntoView()

Infinite Scroll is never triggered.

Is there a way to programmatically trigger infinite-scroll in protractor context?

Evaluating the status code using chai framework

My return object structure of e._data.info is as follows

  { errors: 
       [ { status: 404,
           message: 'Not Found',
          }
         ],
      }

I am trying to assert some stuff here (Ex status) using the includes, should be patterns. Ex :

expect(e._data.info).to.include('404');

But it is not working out.

Any quick tip will be appreciated.

how to pass values in xpath for cucumber in rails

how to pass values in xpath for cucumber in rails

Xpath: "/html/body/div[2]/div/div/div/div/div[2]/div/form/div[1]/input" Values "8221021730"

mock python http requests for testing and development

I am using python "requests" and it works great, but now I want to be able to "mock" responses instead of touching the real servers.

I am doing this:

r = requests.get(self.url+'/somepath', params=payload)

In guzzlephp I could do this:

$mock = new MockHandler([
    new Response(200, ['X-Foo' => 'Bar'], 'mocked response')
]);

$handler = HandlerStack::create($mock);

$client = new Client(['handler' => $handler]);

is there something similar here in requests or in python?

Thanks!

Angular 5 component testing select and triggered event

I have a component which has a dropdown. When changed it triggers an event which filters through an array to get the selectedProduct from an array based on the event value.

My code is as follows:

  public onProductChanged(event): void {
    this.selectedProduct = this.arrayProducts.find((product: Products) => product.id == event.target.value);
  }

My select dropdown:

<select id="product" (change)="onProductChanged($event)">
    <option>--- Please Select ---</option>
    <option *ngFor="let product of products" [value]="product.id">  </option>
</select>

The product object is an object:

{ "id": 1, "name": "name_here", "displayName": "Name Here" }

This all works however I want to test in my component test that changing the select value triggers the event and the correct value is retrieved.

My test code is as follows:

  describe('Product selection', () => {
    it('should select product', () => {

      expect(component.selectedProduct).toBeUndefined();
      productSelectElement.nativeElement.value = 'Product Name';
      productSelectElement.nativeElement.dispatchEvent(new Event('change'));

      fixture.detectChanges();

      expect(component.onProductChanged).toHaveBeenCalled();
      expect(component.selectedProduct).toEqual({ "id": 1, "name": "product_name", "displayName": "Product Name" });
    });
  });

The productChanged event has been called and that test passes. My selectedProduct is however always null. How do I get the event to fire using the changed value in the dropdown?

Is it possible to get a tree of work items in a test plan without parent/child links?

Im working with a project in TFS (2017) where a test plan has been made along with suites and cases that have no relationship between them (that is, no links or parent/child relationship). In other words, they are all top level according to any queries I run. I was wondering if there was any other relationship without having to link all of these work items that could be used to query the test plan and return a tree of work items?

How to control target load in Grinder distributed test?

So I'm using the instructions from http://ift.tt/2AJxxt0 to make a CloudFormation stack for running a Grinder distributed test.

The instructions include a DesiredLoad (tests/sec) parameter that the console/agents try to reach.

My question is: Is there a way to control the test so that once the load is reached, the test will sort of "pause" and run tests at that level for a short period of time?

My goal is to gradually increase the load at regular intervals to see at which load the test starts slowing down. The way it works right now, the load and response time just sort of ramp up really quickly, so it's hard to tell at which load the slow-down occurs.

Should I try increasing the interval between the Grinder worker processes' ramp up? Or should I try implementing a thread ramp up? Or should I do both? Does controlling the DesiredLoad parameter not have the desired effect?

Thanks for your help.

Is it possible to trigger programmatically a ember mirage request response

I use Ember mirage in my tests. I need to check the state of my tested component after a request has been send but before the respond has been received.

How it is possible to configure my test to avoid the mirage server responds automatically and trigger the response programmatically?

I used to do that with sinonjs but I do not find the way to manage this use case with Ember mirage. It is possible?

How to make py.test ignore test args in decorator?

Hi i tried to made my custom mock class for py.test. I want to send mock_data in test, as first param. But py.test recognize it like fixture name, and raise exception. if remove decorator.decorator using, it losing fixtures in params.

from decorator import decorator

class mocker(object):
    ...
    def __call__(self, func):
        def patched(*args, **kwargs):
            self.setup_mocks()
            return func(self.mock_data, *args, **kwrgs)
        return decorator(patched, func)

...

@mocker
def test_some_func(mock_data, some_fixture)
    pass

rises it:

def (mock_data, some_fixture)
E       fixture 'mock_data' not found
...

Django testing function with request.user

I'm trying to write a test for a custom function in my Django model and having some issues. The function works correctly tested manually so this is a test code issue. I have read all the related questions on this but they have not solved my problem. I am using pytest. Code examples below:

models.py - I want to test this function

def save(self, *args, **kwargs):
    if self.in_progress:
        MyModel.objects.filter(user=request.user, flag=True).update(flag=False)
    super(MyModel, self).save(*args, **kwargs)

tests.py

class MyTest(TestCase):

    def setUp(self):
        self.factory = RequestFactory()
        self.user = UserFactory.create()

    def test_that_works(self):
        request = self.factory.get('/mypage/')
        request.user = self.user
        response = my_view(request)
        self.assertEqual(response.status_code, 200)

    def test_that_doesnt_work(self):
        request = self.factory.get('/')
        request.user = self.user
        myitem = MyModelFactory.create()
        myitem.flag = True
        myitem.save()
        assert myitem.flag is True

When I run these tests, the first test works, but the second says NameError: global name 'request' is not defined

The full traceback makes it clear that it is getting to myitem.save() in the test and the error is something to do with passing the request.user into the save() function.

Can anyone help please?

Return variable from Test class to conftest

In my task i need to return a value from my test class to conftest file. is it possible ? if yes than how to do it ?

suppose that i need to return 'element_2' variable from testcase file. if possible, please help.

This is my conftest file..

import pytest
import time
from selenium import webdriver


@pytest.yield_fixture(scope="function")
def oneTimeSetUp(request):

    print "__CONFTEST ONE TIME SETUP BEGIN__"
    driver=webdriver.Chrome()
    driver.maximize_window()    
    yield driver

    print "__CONFTEST YIELD BEGIN__"

    #print "ELEMENT_2 TEXT IS------>",element_2.text
    time.sleep(5)
    driver.close()

This is my testcase file

import pytest


@pytest.mark.usefixtures("oneTimeSetUp")

class TestHomePage():

    @pytest.fixture(autouse=True)
    def setup(self,oneTimeSetUp):
        self.webdriver = oneTimeSetUp            

    def test_run(self):

        print "____ TEST START ____"

    self.webdriver.get("http://ift.tt/Rvp0MX")
    element_1 = self.webdriver.find_element_by_css_selector('input[name="btnI"]')
    print "CLICK ON 'I AM FEELING LUCKY'"   
    element_1.click()
    element_2 = self.webdriver.find_element_by_css_selector('a[href="/doodles/about"]') 
    print "ELEMENT_2 TEXT IS------>",element_2.text
    print "CLICK ON 'ABOUT' "
    #element_2.click()
    #return element_2   

        print "____ TEST END ____"

The above code is example of google home page than click on "I am feeling lucky" on that option i need to return the variable 'element_2' which is the element of "about" option which is present on the top left corner of that page

Angular 5 component test get debugElement by ID

I have a component containing 3 select dropdowns with no css classes attached and a unique Id on each. In my component I want to get the elements as DebugElements so that I can test their states after various events have been triggered. From the Angular website there is debugElement.query(By.css('[attribute]'));. How can I get my dropdowns By.id

in-process component(individual micro-service) testing in microservice architecture

I am exploring individual microservice testing & came across a good guide http://ift.tt/2zQ9dWy. This post suggest there is a way to test the individual microservices "in-process".

Which means the test & service will execute in same process, it also provides the lib which can be used. However I am not able to understand following things 1) How exactly "in-process" testing will work in microservice architecture 2) Any pointers on how to use "inproctester" lib.

Thanks

UI Automation tool for Pixijs

We are using Pixi.js for some of our core rendering in our webapp , but our QA team is finding it difficult to look into pixi container in the webapp. Did anyone knows any UI automation tool that can work with Pixijs?

We had looked into Katalon Studio & Protactor but con't able to detect the elements render by pixijs.

Thanks, Deep

What approach should be used? If client demands to test a web app on IE 9, 8 and 7?

If clients demands to test web app on previous versions for IE. The development has been all on IE 10, Firefox and Google Chrome.

Test method call in promise then

I'm currently developing a react web application. I do testing with jest, babel-rewire-api, and shallow testing.

This test is a simple test with spy's to check if method are called the right amount of times.

Method/Function to test:

handleFoo() {
if (createDialog(`Are you sure you want to delete the record?`)) {
  if (this.props.barId) {
    this.props.deleteBar(this.props.barId).then(result => {
      this.props.deleteFoo(this.props.id);
    });
  }
}

Test written:

test("FooComponent : handleFoo : user confirmed, action called", () => {
  // Arrange
  const fooCompoment = Rewire.__GetDependency__("fooComponent");
  const confirmSpy = jest.fn(() => true);
  const deleteFooSpy = jest.fn(postId => true);
  const deleteBarSpy = jest.fn(fileId => Promise.resolve(true));
  const context = {
    props: {
      deleteBar: deleteBarSpy,
      deleteFoo: deleteFooSpy
    }
  };
  Rewire.__Rewire__("createDialog", confirmSpy);

  // Act
  FooComponent.prototype.handleFoo.call(context, null);

  // Assert
  expect(confirmSpy).toHaveBeenCalledTimes(1);
  expect(deleteFooSpy).toHaveBeenCalledTimes(1);

  Rewire.__ResetDependency__("createDialog");
});

The problem is that this.props.deleteFoo is not run according to the test result. If i run the software i know it works as expected and is called, but i want to have a test for it

web service that I can use to test posting an xml document

I'm considering starting a project that will require me to post an XML document to a web service developed/maintained by someone else. Before I start this project I want to get an idea of how difficult this will be by doing a test run using an existing web service (developed and maintained by someone else).

I'm looking for recommendations of an existing web service to which I could post an xml document and, if my code is right, get a response that verifies that I'm on the right track.

If there are no other good suggestions then my backup plan is to see if I can add a few local cafes using the Google Places API Web Service.

Thanks in advance

mercredi 29 novembre 2017

Setting Source Directories for Jacoco

I am running Jacoco with Gradle. I don't want the unit test and integration tests to be included in the report. The source-pattern is **/source/java which includes:

project/source/java
project/unittest/java
project/inttest/java

How do I change source-pattern to only include project/source/java?

Which is best locator for defining element,Xpath ,Id or Name in selenium?why?

Which is best locator for defining element,Xpath ,Id or Name in selenium?why?

Rspec for conditional code if-else?

I am new to RSpec but here I am trying to create tests based on this code and I am keep on getting this error. Any suggestions?
CODE:

  serialization_scope nil
  before_action :set_list, only: [:show, :destroy, :update]
  before_action :verify_user, only: :show


  def create
    @list = current_user.lists.build(list_params)

    if @list.save
      render json: {message: ['Success']}, status: 200
    else
      render json: {errors:[@list.errors.full_messages]}, status: 400
    end
  end

Here is the RSpec file that I started :

require "rails_helper"

RSpec.describe V1::listsController, :type => :controller do

  describe "POST create" do
    it "returns HTTP status" do
      expect(response).to have_http_status :success #200
    end
  end

  describe 'GET status if its not created' do
    it "return HTTP status - reports BAD REQUEST (HTTP status 400)" do
      expect(response.status).to eq 400
    end
  end
end

And the error that I got is :

.F

Failures:

  1) GET #watchlist status if its not created return HTTP status - reports BAD REQUEST (HTTP status 400)
     Failure/Error: expect(response.status).to eq 400

       expected: 400
            got: 200

       (compared using ==)

Store different multiple Object values when using same Object multiple time

Have created multiple classes, which are being called from the code at different times. The requirement is to store the values/data for each call, as it is later used for verification purposes.

Class/Object being called:

public class NameGenderDoB extends Base {

    private static Logger logger = Logger.getLogger(NameGenderDoB.class);
    DataGen dataGen = new DataGen();

    FamilyAndGivenNames familyGivenName = new FamilyAndGivenNames();

    private String gender = "Female";
    private String dateOfBirth = DataGen.getBirthday(22);

    public String getgender() {
        return gender;
    }

    public void setgender(String gender) {
        this.gender = gender;
    }

    public String getDateOfBirth() {
        return dateOfBirth;
    }

    public void setDateOfBirth(String dateOfBirth) {
        this.dateOfBirth = dateOfBirth;
    }

    public void Gender(){
        System.err.format("@ Fill Page: %s\n", "In Gender");
        choose(gender);
    }

    public void DoB(){
        fill_in("Date of birth", dateOfBirth);
    }

    public void NameGenderAndDoB() {
        FamilyGivenName.Family_And_Given_Names();
        Gender();
        DoB();
    }
}

Caller Code:

public class Application extends Base {

    public Application(){}

    private static Logger logger = Logger.getLogger(Application.class);
    DataGen dataGen = new DataGen();

    FamilyAndGivenNames familyGivenName;
    NamesSexAndDoB nameSexDoB;

    public void fill_Page(){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        assertThat(shouldSeeTextInPage("Application"), equalTo(true));
        System.err.format("@ Fill Page: %s\n", methodName);
        familyGivenName.Family_And_Given_Names();
        nameSexDoB.Gender();
        nameSexDoB.DoB();
        familyGivenName.Family_And_Given_Names();
    }

    public void fill_Page(String formNumber){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        if (formNumber == "10") {
            assertThat(shouldSeeTextInPage("Application Done"), equalTo(true));
            System.err.format("@ Fill Page: %s\n", methodName);
            familyGivenName.Family_And_Given_Names();
            nameSexDoB.Gender();
            nameSexDoB.DoB();
            familyGivenName.Family_And_Given_Names();
        }
    }
}

So in the above, I am calling the methods for DoB(), FamilyAndGivenNames() and Gender() from my code multiple times.

But I wish to store the data for each call, so that I can use it later in another method to verify that the data was entered correctly or not.

Is there some way I can do this, as a call to the method will overwrite the previous called data?

Testing Forms in Robot Framework

I need to write a test for a web service that makes a request like the following:

curl -X POST -v -F 'id=1234' -F 'name=blah.png' -F 'contentType=image/png' -F 'file=@somefile.png' path/to/some/endpoint

The documentation: robot request documentation , doesn't suggest that it has a method to mock forms. I'm I missing something or do I need to write some python code outside of the robot request library to make a request like this?

Thanks!

Testing Redux Thunk Action Creator

I've got a redux action creator that utilizes redux-thunk to do some logic to determine what to dispatch to the store. Its not promise-based, like an HTTP request would be, so I am having some issues with how to test it properly. Ill need a test for when the value meets the condition and for when it doesn't. Since the action creator does not return a promise, I cannot run a .then() in my test. What is the best way to test something like this?

Action Creator

export const handleSelection = (value, cacheKey) => {
return dispatch => {
    if (value === "removeFiles") {
        dispatch(getRemoveFileMetrics(cacheKey));
    }
    dispatch({ type: HANDLE_SELECTION, value });
};

};

Actions

export const getRemoveFileMetrics = cacheKey => {
return dispatch => {
    dispatch({ type: IS_FETCHING_DELETE_METRICS });
    return axios
        .get(`../GetRemoveFileMetrics`, { params: { cacheKey } })
        .then(response => {
            dispatch({ type: GET_REMOVE_FILE_METRICS, payload: response.data });
        })
        .catch(err => console.log(err));
};

};

Jest

it("should dispatch HANDLE_SELECTION when selecting operation", () => {
    const store = mockStore({});
    const value = "switchVersion";
    const expectedAction = [{
        type: MOA.HANDLE_SELECTION,
        value,
    }];
    return store.dispatch(MOA.handleSelection(value)).then(() => {
        const returnedActions = store.getActions();
        expect(returnedActions).toEqual(expectedAction);
    });
});

What is the use case of @TestInstance(Lifecycle.PER_CLASS)?

I thought the purpose of unit tests was to try to isolate units as much as possible. Wouldn't executing all test methods on the same test instance violate this ideal?

Karma tests fail on DatePipe in PhantomJS but not Chrome

Running Karma tests on my angular app return passed tests when I use chrome. But when I use PhantomJS I get a slew of failures for the date pipe as such

Error: InvalidPipeArgument: '2017-01-03 14:09:46' for pipe 'DatePipe'

Why are my tests passing when I run the tests in Chrome, but failing when I run the tests in PhantomJS?

I had some tests failing because of a missing polyfill for phantomjs. Might this also be the case for the datepipe?

java unit test calculation exception error of custom exception

I have to test my code if I don't have errors in it, but when I try to call my class that calculates what I asked, it gives me an error about my HorsLimitException where I said that the limits are the min and the max of double I don't see why I get an error here's the code:

        public class MethodeCalcul {

        public MethodeCalcul(int uneVal1,int uneVal2,double uneValConv ) {
            }

        public static double methodeCalc(int val1, int val2, double valConv) throws Exception { //remonter exception
            int diffIndice;
            String nbZero = "1";
            double resultat;
           // String valConv2= String.valueOf(valConv);

            if(valConv < Double.MIN_VALUE || valConv > Double.MAX_VALUE) throw new HorsLimitException (); //lance exception 

            diffIndice = val1 - val2;
            for (int k = 0; k < Math.abs(diffIndice); k++) { //calcule la valeur absolue de la différence d'indice entre combo box 3 et 2 et ajoute le nombre de zero necessaire
                nbZero += "0";
            }

            if (diffIndice <= 0) {
                resultat = valConv / Double.parseDouble(nbZero); //division 
                nbZero = "1"; //remise a la valeur initial
            } else {
                resultat = valConv * Double.parseDouble(nbZero); //multiplication
                nbZero = "1";  //remise a la valeur initial
            }
            return resultat; //retourne un double
        }
    }
class HorsLimitException  extends  ArithmeticException {

        public HorsLimitException ()      {    //constructeur  par défaut
             super( "Tentative de d\u00e9passement de limite" );
           }

        public HorsLimitException ( String message )     {
             super( message );  
           }
}

that code is made to calculate numbers to convert between option like cm to m and etc. But my testing code doesn't work:

public class TestCalcul {

MethodeCalcul calcul;

public static void main (String args []) throws Exception{
    TestCalcul test= new TestCalcul();
    test.testMethodeCalcul(); 

}

//Test de la méthode  
public void testMethodeCalcul() throws Exception{

    // un premier cas de test
    calcul =  new MethodeCalcul(0, 0, 0);
    if ( calcul.methodeCalc(0,0,0) != 0)    
        System.out.println("Erreur de la methode methodeCalc()");

    // un deuxieme cas de test
    calcul =  new MethodeCalcul(1, 1, 1);
    if ( calcul.methodeCalc(1,1,1) != 0)        
        System.out.println("Erreur de la methode methodeCalc()");

         // un troisieme cas de test
    calcul =  new MethodeCalcul(2, 2, 2);
    if ( calcul.methodeCalc(2,2,2) != 0)        
        System.out.println("Erreur de la methode methodeCalc()");   

}
}

Possible to target specific TestNG.xml files via Maven POM File?

Possible to target only one of the two TestNG xml files listed within my Maven POM File?

My Maven POM file points to two xml files: uat.xml and preprod.xml, how do i target only one of the xml files using maven commands such as mvn clean compile test?

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <fork>true</fork>
                    <!--<executable>C:\Program Files\Java\jdk1.8.0_121\bin\javac.exe</executable> -->
                    <executable>${env.JAVA_HOME}\bin\javac.exe</executable>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20</version>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>uat.xml</suiteXmlFile>
                        <suiteXmlFile>preprod.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <testErrorIgnore>false</testErrorIgnore>
                    <testFailureIgnore>false</testFailureIgnore>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

How to load testing env variables for Laravel guzzle call in unit test

Even though it may not be good practice for a unit/feature test, I like to have a test for ensuring that my Laravel app gives the expected result for:

calling a web route .. that makes an async (Guzzle) call to the same application and returns the modified result.

Unfortunately, for phpunit I can define that the configuration is loaded from .env.testing and it connects to the testing database. However when a new request is done it will call my application with my normal .env variables. Which makes sense as it is a new http request, however it is not desired in the scenario.

I was thinking of changing the Guzzle call based on the environment used and call my endpoint directly when I am testing. However it doesn't feel good to have env based switches in my code, especially when it results in a different method (what if it does work calling it directly but fails when using guzzle, e.g. guzzle got lost from the dependencies).

What would be your method of preference to test the request till response as a whole, without breaking it up to smaller pieces?

Cucumber test can't render full page, only header

I'm fairly new to Cucumber/BDD and I'm kind of stumped. I'm trying to do a simple test of page contents but it seems that my test suite can only "find" the page header.

For example:

Scenario: User sees the menu page
  Given a menu exists
  When I visit the menu
  Then I should see "menu" page title
  And I should see "tuna poke" item name

Step definitions:

Given("a menu exists") do
  user = User.create!(email: "test@valid.email", password: "hello")
  restaurant = Restaurant.create!(name: "eleven tables", user_id: user.id)
  menu = Menu.create!(restaurant_id: restaurant.id)
  category = Category.create!(name: "appetizer")
  menu_item = MenuItem.create!(name: "tuna poke", description: "it's light", price: 9, category: category, menu: menu)
end

When("I visit the menu") do
  visit restaurant_menu_path
end

Then("I should see {string} page title") do |string|
  expect(page).to have_title "#{string}"
end

And("I should see {string} item name") do |item_name|
  expect(page).to have_content "#{item_name}"
end

Gives me the result:

Feature: View Menu
  In order see the menu
  I want to view the menu
  I want to see item name
  I want to see item description
  I want to see item price

  Scenario: User sees the menu page        # features/view_menu.feature:8
    Given a menu exists                    # features/step_definitions/view_menu_steps.rb:1
    When I visit the menu                  # features/step_definitions/view_menu_steps.rb:9
    Then I should see "menu" page title    # features/step_definitions/view_menu_steps.rb:13
    And I should see "tuna poke" item name # features/step_definitions/view_menu_steps.rb:17
      expected to find text "tuna poke" in "menu sign in" (RSpec::Expectations::ExpectationNotMetError)
      ./features/step_definitions/view_menu_steps.rb:18:in `"I should see {string} item name"'
      features/view_menu.feature:12:in `And I should see "tuna poke" item name'

Failing Scenarios:
cucumber features/view_menu.feature:8 # Scenario: User sees the menu page

1 scenario (1 failed)
4 steps (1 failed, 3 passed)
0m1.180s

The thing I find most peculiar is this part of the error:

expected to find text "tuna poke" in "menu sign in"

Which doesn't make a lot of sense to me. The only time those three words appear together is when you're on the /menu page of my application as a logged-out user in the nav bar. Which is precisely the case here. But I can't figure out why it can't read the contents of the entire page.

Testing called function from within a fetch call

I am using jest and enzyme with jest-fetch-mock to try to write a test which asserts that a function is called from within a resolved fetch call, and I am not having much luck.

I have the following function:

function getHeadersClaims(){
  return fetch(headers, Object.assign({}, commonConfig, {method: 'GET'}))
}

I have a component that uses the function in componentWillMount:

componentWillMount() {
  getHeadersClaims()
    .then((res) => {
      return res.json()
    }).then((json) => {
      this.props.omniture(json)
    })
}

I am trying to test to see that this.props.omniture is called:

function generateProps() {
  return {
    omniture: jest.fn()
  }
}    

describe('Home', () => {
  beforeEach(function() {
    fetch.mockResponse(JSON.stringify([{}]))
  })

  it('should call componentWillMount()', () => {
    const props = generateProps()

    const spy = jest.spyOn(Home.prototype, "componentWillMount")
    const wrapper = shallow(<Home  {...props} />)
    expect(spy).toHaveBeenCalledTimes(1)
    expect(props.omniture).toHaveBeenCalled()
    // expect(wrapper.instance().props.omniture).toHaveBeenCalled() *also tried this*
  })
})

My test fails with:

expect(jest.fn()).toHaveBeenCalled()

My question is, how do I assert that this.props.omniture actually gets called. I have put in console log statements and it appears to get to the section of code where the call is made, but it is never called. Any help would be appreciated.

UPDATE:

It seems like jest is expecting the call to happen within the first then(). If I add the call there, the test passes. I also did some step-through debugging in VS Code and I do see that the call is being made.

Testing using an internal class

I have a module in Python to do some parsing. This module uses an internal state class. It looks somewhat like this:

class _State:
    ...

class Parser:
    @staticmethod
    def parse_int(state):
        ...

Now I want to test parse_int. However, I cannot from the test_parser.py function import _State (because it's internal) and therefore I cannot create one to test parse_int. What's the Python way to deal with this?

How to close any system dialog during execution instrumentation tests

I have a farm of about 20 android devices to run instrumentation UI tests. I use Espresso. Sometimes different system dialogs appear and lead tests to fail. E.g. USSD result dialog, dialog of lost internet connection, dialog of request to update OS and etc.

Is there a way to catch any dialog and close the one? This intent doesn't help.

Intent.ACTION_CLOSE_SYSTEM_DIALOGS

What is the Sonar substitute for api/tests?

Sonar api/tests is deprecated since 5.2 version. But documentation does not explain the reason and its substitute.

At least i didn't find it. I'm in 6.4.

I'm able to use it but i want to know if exists a new good way to get this information.

Thanks.

Verifiying time between calls with mockito

I've read a lot of documentation, examples on the net, and still have no idea of how to do it. (if it could be done).

I need to test a method in a object called by other thread and it has a requeriment of time. So my original idea was creating a spy, override the method and do the task, but the problem is, i can't access test method variables from the spy. So i can't get the value returned from System.currentTimeMillis() from the test method and proccess it to get the difference within times.

i will write some abstract code describing the situation so you could understand better the situation.

@Test
public void test()
{
   Objectspied spy = Mockito.spy(new Objectspied(Parameters p));
   long[] timesRetrieved = new long[numberOfCallsIExpect];
   //here goes the tricky part
   Mockito.doAnswer(new Answer<void>(){
       @override
       public methodCalledFromAnotherThread(int index)
       {
          //what i wish to do but can't do it
          timesRetrieved[i] = System.currentTimeMilis();
       }
   }
   ).when(spy).methodCalledFromAnotherThread(anyInt);
   //here initialize the thread who call it
}

public class AnotherThread 
{
   ObjectSpied reference;
   public void run()
   {
      for (int i=0;i<repeat;i++)
      {
         reference.methodCalledFromAnotherThread(i);
         Thread.sleep(1000);
      }
   }
}

I'm new to Mockito so i know sysntax is totally wrong but i can fix that by myself, all i need to know is:

  • Is there any way to do it with mockito?
  • If so, can you point me to the right direction?

Laravel 5.4 ModelNotFoundException when testing database with SQLite

I have encountered a problem with my feature tests in Laravel 5.4. Whenever I try to run my database tests with the SQLite memory configuration I get this error:

1) Tests\Feature\ParseAccountingFilesTest::testExample
│/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\R Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [App\QueuedAction] 1

What I think is strange is the fact that this error is to my knowledge generally encountered only whenever the query builder uses one of the -OrFail() methods. My code works perfectly fine outside the tests when using a database queue driver and MySQL as the database driver. I have debugged the problem and found that it is caused by the following statement in the class constructor below:

$this->scheduledAction = $action;

This error makes no sense to me. There should be no query involved, only a simple allocation. This class is used as a simple parent class for the actual job classes to keep track of what actions have already been queued.

abstract class SchedulesOnce implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $scheduledAction;

    public function __construct(string $id, string $type)
    {
        $action = new QueuedAction();
        $action->id = $id;
        $action->type = $type;
        $action->save();
        $this->scheduledAction = $action;
    }

    // Execute the job
    public function handle()
    {
        $this->execute();

        // Delete the queue reservation
        $this->scheduledAction->delete();
    }

    // Child functionality
    protected abstract function execute();
}

Here are the relevant lines in my phpunit.xml

<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"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>

How to test a new user activation in Django?

I am trying to test django.contrib.auth-based user signup view with django-nose, where an activation link is being sent to a new user:

def signup(request):
    if request.method == 'POST':
        user_form = SignUpForm(request.POST)
        profile_form = ProfileForm(request.POST)
        if user_form.is_valid() and profile_form.is_valid():
            user = user_form.save(commit=False)
            user.is_active = False
            user.save()

            user.profile.user_type = profile_form['user_type'].data
            user.save()

            current_site = get_current_site(request)
            subject = 'activation email'
            message = render_to_string('registration/account_activation_email.html', {
                'user': user,
                'domain': current_site.domain,
                'uid': urlsafe_base64_encode(force_bytes(user.pk)),
                'token': account_activation_token.make_token(user),
            })
            user.email_user(subject, message)
            return redirect('account_activation_sent')
    else:
        user_form = SignUpForm()
        profile_form = ProfileForm()
    return render(request, 'registration/signup.html', {
        'user_form': user_form,
        'profile_form': profile_form
    })

Currently I use Django built-in email back-end, so that activation email is being sent to the server terminal.

I want to test the activation view which requires uid and token. Is there any way to access the email sent to the user? Is there any other way to test that?

Regenerating token in the test does not work, because hash value is generated using timestamp.

how to test AR/VR apps - Any frameworks?

we have an AR app for our client . is there any frameworks available for AR/VR appe testing

MOBILE TESTING FRAMEWORKS: APPIUM,ROBOTIUM are available and we are with APPIUM now but there are a lot of limitation

Are any one aware of such testing frameworks ?

Unable to startup Hibernate

I'm trying to write some integration tests on some legacy code. When I run the test it complains with those errors.

org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:267) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:231) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:240) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:691) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]

.....

Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
    at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:100) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
    at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:54) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:137) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:257) ~[hibernate-core-5.2.3.Final.jar:5.2.3.Final]
    ... 52 common frames omitted

I cannot get whats going on. Probably the hibernate.cfg.xml is not loaded, but no matter where I put it in /src/test/resources or /src/test/java it will not change. Using hibernate 5.23. What is this about? There is something going on between 4 and 5 version in hibernate. Something with the need to call StandardServiceRegistryBuilder().applySettings(...). The code executed throught main looks running okay. Any hints???

Unit Test return observables

Is the method I'm testing. The thing I'm trying to test is if the return next.handle(req); is returning a correct value. I'm not quiet sure how to do this.

intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {

        console.log(req);
        if(req['url'].indexOf('/token') > -1 ){
            return next.handle(req);
        }
        const authHeader = this.tokenService.getToken();    
        if(authHeader){
            const authReq = req.clone({headers: req.headers.set('Authorization', 'Bearer ' + authHeader)});
            return next.handle(authReq);
        }else{
            this.router.navigate([Config.authenticatePage]);
            return next.handle(req);
        }
    }

Test

it(('(intercept) should get token '), () => {
        sut.intercept(req, next);
        req['url'] = '/token';
        expect(sut.intercept(req, next)).toEqual(next.stub(req));               
    });

WebdriverIO config file for multiple browsers

I need to run test cases on multiple browsers, while using webdriverIO. Despite going through several articles and documentation of WDIO, I couldn't find a way in which works.

this is my wdio.conf.js.

var path = require("path");

exports.config = {
    baseUrl: 'http://127.0.0.1:8100/',
    path: '/wd/hub',
    specs: [
        './e2e/**/*-wdio.e2e-spec.ts'
    ],
    exclude: [],
    inspect: true,
    maxInstances: 10,
    // capabilities: [
    //   {
    //       browserName: 'Chrome',
    //   }
    //   // , {
    //   //     browserName: 'Firefox',
    //   // }
    // ],
    capabilities: {
        myChromeBrowser: {
            desiredCapabilities: {
                browserName: 'Chrome',
                // maxInstances: 1,
                // port: 8100
            }
        },
        myFirefoxBrowser: {
            desiredCapabilities: {
                browserName: 'Firefox',
                // maxInstances: 1,
                // port: 8100
            }
        }
    },
    
    sync: true,
    // Level of logging verbosity: silent | verbose | command | data | result | error
    logLevel: 'verbose',
    coloredLogs: true,
    deprecationWarnings: true,.
    bail: 0,
    screenshotPath: './errorShots/',
    waitforTimeout: 10000,
    connectionRetryTimeout: 60000,  // Default timeout in milliseconds for request if Selenium Grid doesn't send response
    connectionRetryCount: 3, // Default request retries count
    services: ['selenium-standalone'],
    framework: 'jasmine', // Make sure you have the wdio adapter package for the specific framework installed
    reporters: ['spec'],  // see also: http://ift.tt/2AGROPU
    reporterOptions: {
        outputDir: './'
    },
    // Options to be passed to Jasmine.
    jasmineNodeOpts: {
        defaultTimeoutInterval: 50000,
        expectationResultHandler: function(passed, assertion) {  }
    },
    before: function () {
        require('ts-node/register');
        require('ts-node').register({
            project: 'e2e'
        });
    },
    onPrepare: function() { },
    onComplete: function() { },
}

Can anybody point out, what have i missed or wrongly configured? Currently two instances of google Chrome launches and the test cases run on them, while I want the test cases to run in chrome and firefox respectively

mardi 28 novembre 2017

Create SOAP request in UFT API from Excel

I have an Excel file with the Soap request parameter values, I need to generate soap request using those values. I have done a normal request using c# which is hard coded.

public void StServiceCallActivity4_OnAfterGenerateRequest(object sender, HP.ST.Ext.WebServicesActivities.ActivityProcessXmlMessageEventArgs args)
    {
        string action = GetDataSource("InputSheet!Sheet1").GetValue(this.Loop2.CurrentIterationNumber-1, "action").ToString();
        //string action = "modify";
        string actionXpath = "/*[local-name(.)='Envelope'][1]/*[local-name(.)='Body'][1]/*[local-name(.)='captureInteractionRequest'][1]/*[local-name(.)='interaction'][1]/*[local-name(.)='body'][1]/*[local-name(.)='item'][1]/*[local-name(.)='service'][1]/*[local-name(.)='action'][1]";

        this.StServiceCallActivity4.InputEnvelope.SelectSingleNode(actionXpath).InnerText = action;



        string nameXpath="/*[local-name(.)='Envelope'][1]/*[local-name(.)='Body'][1]/*[local-name(.)='captureInteractionRequest'][1]/*[local-name(.)='interaction'][1]/*[local-name(.)='body'][1]/*[local-name(.)='item'][1]/*[local-name(.)='parameter'][1]/*[local-name(.)='value'][1]";
        this.StServiceCallActivity4.InputEnvelope.SelectSingleNode(nameXpath).InnerText = GetDataSource("InputSheet!Sheet1").GetValue(this.Loop2.CurrentIterationNumber-1, "NAME").ToString();


    }

I need to create each parameter with code (here i done manually)

   <invbi:parameter>
      <invbi:name>NAME</invbi:name>
      <invbi:value xsi:type="xs:string"></invbi:value>
   </invbi:parameter>

Schema testing using Mocha Timeout Error

This is my Schema:

const mongoose = require('mongoose');
const Schema = mongoose.Schema;

//INDEX PAGE SCHEMA
const IndexSchema = new Schema({
  bio: String
});
const IndexPageData = mongoose.model('indexpagedata', IndexSchema);
module.exports = IndexPageData;

this is my mocha code:

const assert = require('assert');
const mocha = require('mocha');
const MarioChar = require('../models/model');

// Describe our tests
describe('Saving records', function(){

  // Create tests
  it('Saves a record to the database', function(done){

var index = new IndexPageData({
  bio: 'Mario ENTER BIO HERE'
});

char.save().then(function(){
  assert(char.isNew === false);
  done();
});

});

});

`

Everytime I run this I get an error stating " Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves."

mongoDB is already running in the background so I don't know what could be causing this issue.

Passing more values under same prop name and test it with Jest

I am using Jest and Enzyme to test my React-Mobx app. I have come to a problem where I am accessing different values under the same prop name. As you can see I am accessing different properties under the same FilterssAction prop name.

@inject('RootStore', 'FiltersAction')
@observer
class ExpenseListFilters extends Component {
  state = {
    calendarFocused: null
  }

  onDatesChange = ({startDate, endDate}) => {
    this.props.FiltersAction.setStartDate(startDate)
    this.props.FiltersAction.setEndDate(endDate)
  }

  onTextChange = (e) => {
    this.props.FiltersAction.setTextFilter(e.target.value)
  }

...

When I write my test it fails. I need to pass props to shallow rendered component. So I am passing different values under same. This is not working, I keep getting an error TypeError: _this.props.FiltersAction.setTextFilter is not a function How do I test this?

let setStartDateSpy, setEndDateSpy, setTextFilterSpy, sortByDateSpy, sortByAmountSpy, FiltersStore, wrapper

beforeEach(() => {
  setStartDateSpy = {setStartDate: jest.fn()}
  setEndDateSpy = {setEndDate: jest.fn()}
  setTextFilterSpy = {setTextFilter: jest.fn()}

  FiltersStore = {FiltersStore: {filters: filters}}

  wrapper = shallow(
    <ExpenseListFilters.wrappedComponent 
      FiltersAction = { 
        setStartDateSpy,
        setEndDateSpy,
        setTextFilterSpy
      }
      RootStore = {FiltersStore}
    />
  )
})

test('should handle text change', () => {
  const value = 'rent'
  wrapper.find('input').at(0).simulate('change', {
    target: {value}
  })
  expect(setTextFilterSpy).toHaveBeenLastCalledWith(value)
})

Java template project for Automation Testing for a new WebApp? In any framework

Can anybody suggest me any preset template project for a new web application?

Using Java and Selenium Webdriver I’m looking for a skeleton project with preset pages and basic methods for automation. For pages like LoginPage, BasePage etc. With list of web elements, which will be corrected and specified of course.

Framework could be like Gauge, Sahi, TestNG or something similiar.

What I need is a template project, to not start from absolute scratch. Thank you for any help.

Testing - How this common scenario is classified and handled

I’m just diving into testing/test driven development in php, and am a bit confused about how to handle a very typical scenario in our legacy codebase. Our codebase does not have many classes, it’s very functional programming oriented.

In this example code, which is pseudocode, I want to write a test for getAndOrderUsersByAge(). As you can see it first gets all the users from our database (in a giant array lets say, because we don’t have objects/classes) then sorts them. This is of course a VERY common occurrence in our code, manipulating or analyzing data gotten from the database; not objects, but an array of database rows basically.

Note that I've added an error in the if statement to simulate an error I want my tests to catch.

//gets all users in our db into an array, then sorts them by age
function getAndOrderUsersByAge(){
     //get all users from the db
     $all_users = getAllUsers();

     //sort
     $all_users_sorted = sortUsers($all_users)

     //notice I've made a mistake here on purpose, left the "d" off of "$all_users_sorted"
     //so the function will always return false, a mistake...which I want tests to catch
     if(!empty($all_users_sorte){
         return $all_users_sorted;
     }
     else{
         return false;
     }
}

My questions are:

1.) Is testing the function getAndOrderUsersByAge() unit testing, integration testing, or …?

2.) In my (unit?) test(s) of getAndOrderUsersByAge(), I want to assume that getAllUsers (the function which gets things from the db) behaves correctly because I only want to test getAndOrderUsersByAge() right? I’m not really sure what “concept” this falls under when I’m reading the two books I have on testing. Is this where I would “mock”, e.g. create some fake data for getAllUsers() to return?

3.) What tests would you write for getAndOrderUsersByAge()? I think I would write one that ensures a non-empty array is returned when getAllUsers() returns a non-empty array, as this would catch the error I've created. I'm not sure what else though.

Any tips, recommended reading material, etc. is very welcomed.

Capybara not working with mini-test and rails. Keep getting "uninitialized constant Capybara::Minitest::Capybara"

I know this usually means something is missing by way of a require, but I can't figure it out. Here's my test_helper.rb:

ENV["RAILS_ENV"] = "test"
require File.expand_path("../../config/environment", __FILE__)
require "rails/test_help"
require "minitest/rails"
require 'capybara/rails'
require 'capybara/minitest'

# To add Capybara feature tests add `gem "minitest-rails-capybara"`
# to the test group in the Gemfile and uncomment the following:

require 'minitest/rails/capybara'

and a portion of my Gemfile.lock

minitest-capybara (0.8.2)
  capybara (~> 2.2)
  minitest (~> 5.0)
  rake
minitest-metadata (0.6.0)
  minitest (>= 4.7, < 6.0)
minitest-rails (3.0.0)
  minitest (~> 5.8)
  railties (~> 5.0)
minitest-rails-capybara (3.0.1)
  capybara (~> 2.7)
  minitest-capybara (~> 0.8)
  minitest-metadata (~> 0.6)
  minitest-rails (~> 3.0)

If I comment out this line:

require 'minitest/rails/capybara'

I get:

undefined method `feature' for main:Object (NoMethodError)

While trying to test a feature.

Anyone have any ideas?

Full trace for gigs:

ruby test/features/can_access_home_test.rb
/usr/local/bundle/gems/minitest-capybara-0.8.2/lib/capybara/assertions.rb:37:in `<module:Assertions>': uninitialized constant Capybara::Minitest::Capybara (NameError)
    from /usr/local/bundle/gems/minitest-capybara-0.8.2/lib/capybara/assertions.rb:2:in `<module:Capybara>'
    from /usr/local/bundle/gems/minitest-capybara-0.8.2/lib/capybara/assertions.rb:1:in `<top (required)>'
    from /usr/local/bundle/gems/minitest-capybara-0.8.2/lib/minitest/capybara.rb:23:in `<top (required)>'
    from /usr/local/bundle/gems/minitest-capybara-0.8.2/lib/minitest-capybara.rb:2:in `<top (required)>'
    from /usr/local/bundle/gems/minitest-rails-capybara-3.0.1/lib/minitest/rails/capybara.rb:3:in `<top (required)>'
    from /usr/src/app/test/test_helper.rb:11:in `<top (required)>'
    from test/features/can_access_home_test.rb:1:in `require_relative'
    from test/features/can_access_home_test.rb:1:in `<main>'

Python - Recursively edit a dmp file to csv using text as a stop and start point

Object : test Type : test LastChange : test Owner : test Alias : test CreateTime : test TimeLocked : test InstanceId : test ActivationDate : test CardType : test SiteCode : test CardNumber : 1234 CardNumber2 : 0 Department : test DepartmentCode : 1234 EmpNumber : 1234 ExpirationDate : test FirstName : test FullName : test Info1 : test Info3 : S Info4 : M JobTitle : test LastName : test OfficeLocation : test Sex : Female StartDate : test Supervisor : test AreaLinks : test test test test test test test
EndObject

Using Object and EndObject as starting and stopping points

How can i check if a class has a atribute?

Need some help for homework. How do i check if a class has a atribute? the method reprodukujZvuk is overrided from a abstract class Racunarthe method there is virtual void.

class Desktop : Racunar
{
    public string zvucnaKartica { get; set; }

    public Desktop() { }
    public Desktop(double RAM, string grafickaKartica, string maticnaPloca, string procesor,string zvucnaKartica)
    {
        this.RAM = RAM;
        this.grafickaKartica = grafickaKartica;
        this.maticnaPloca = maticnaPloca;
        this.procesor = procesor;
        this.zvucnaKartica = zvucnaKartica;

    }
    public void Detalji()
    {
        Console.WriteLine("Desktop racunar:\n\nKolicina RAM-a: {0} gb\nModel Graficke kartice: {1}\nModel Maticne Ploce: {2}\nModel Procesora: {3}\nModel zvucne kartice:{4}", RAM, grafickaKartica, maticnaPloca, procesor,zvucnaKartica);
    }
    public override double cenaUredjaja()
    {
        Random rnd = new Random();
        return rnd.Next(500, 3789);
    }
    public override void reprodukujZvuk()
    {
       // in this method i need to check if in the class i have a atribute zvucnaKartica
        //if it does it needs to 
            Console.WriteLine("Biip");
        else
            Console.WriteLine("Reprodukcija zvuka nije moguca jer racunar nema zvucnu karticu");

    }

How get training and test(predicting) time for fitcensemble

I use this code for training and testing my database:

train = fitcensemble(data,'normal','Method','Bag');
test = predict(train,database);
cp = classperf(truelables,classout);

but I want my test and train Time, please help me

tic;toc;

dosn't work well, and give me all time of read and write from workspace and fitcensemble, I need just self time of fitcensemble, this part is my training time , this problem is for predict time too, please please help me( I got my answer just in 'Run and Time' bottom in MATLAB but I need code, Thanks a lot

maven-surefire-plugin:2.12.4:test failed Error occurred in starting fork

Trying to run the following maven command:

mvn test -X

Result:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-
plugin:2.12.4:test (default-test) on project unit4-api-message-hub: Error 
occurred in starting fork, check output in log -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project unit4-api-message-hub: Error occurred in starting fork, check output in log
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
        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:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error occurred in starting fork, check output in log
        at org.apache.maven.plugin.surefire.SurefirePlugin.assertNoException(SurefirePlugin.java:159)
        at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:148)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:650)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:586)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 20 more
Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: Error occurred in starting fork, check output in log
        at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:284)
        at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:116)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:740)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAllProviders(AbstractSurefireMojo.java:682)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:648)
        ... 23 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://ift.tt/1bGwP7h
The system cannot find the path specified.

When i change the pom.xml to explicitly use maven-surefire-plugin:2.20.1 it gives kind of error as with maven-surefire- plugin:2.12.4. What makes it even more strange is that I use the same installation set as my colleague and his works out of the box. Same OS (Windows 10) , same JAVA and Maven version same Git Repo. We already tried delete .m2 repo to relieve the system of cache.

I have a feeling that there is something wrong with CMD like like the problem is with cmd /C exit /B 0 When trying to run a part of the command in windows CMD i get the following result: The system cannot find the path specified.

C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub>C:\myPath\Java\jdk1.8.0_152\jre\bin\java -jar C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub\target\surefire\surefirebooter4393690082191226141.jar C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub\target\surefire\surefire2387848635455087535tmp C:\dev\workspace\MessageHub.JavaSdk\lucas-api-hub\target\surefire\surefire_08471100731569808288tmp
I,1,java.runtime.name,Java(TM) SE Runtime Environment
I,1,sun.boot.library.path,C:\\myPath\\Java\\jdk1.8.0_152\\jre\\bin
I,1,java.vm.version,25.152-b16
I,1,user.country.format,NL
I,1,java.vm.vendor,Oracle Corporation
I,1,java.vendor.url,http:\/\/java.oracle.com\/
I,1,path.separator,;
I,1,java.vm.name,Java HotSpot(TM) 64-Bit Server VM
I,1,file.encoding.pkg,sun.io
I,1,user.script,
I,1,user.country,US
I,1,sun.java.launcher,SUN_STANDARD
I,1,sun.os.patch.level,
I,1,java.vm.specification.name,Java Virtual Machine Specification
I,1,user.dir,C:\\dev\\workspace\\MessageHub.JavaSdk\\lucas-api-hub
I,1,java.runtime.version,1.8.0_152-b16
I,1,java.awt.graphicsenv,sun.awt.Win32GraphicsEnvironment
I,1,basedir,C:\\dev\\workspace\\MessageHub.JavaSdk\\lucas-api-hub
I,1,java.endorsed.dirs,C:\\myPath\\Java\\jdk1.8.0_152\\jre\\lib\\endorsed
I,1,os.arch,amd64
I,1,surefire.real.class.path,C:\\dev\\workspace\\MessageHub.JavaSdk\\lucas-api-hub\\target\\surefire\\surefirebooter4393690082191226141.jar
I,1,java.io.tmpdir,C:\\Users\\secretuser\\AppData\\Local\\Temp\\
I,1,line.separator,\r\n
I,1,java.vm.specification.vendor,Oracle Corporation
I,1,user.variant,
I,1,os.name,Windows 10
I,1,sun.jnu.encoding,Cp1252
I,1,java.library.path,C:\\myPath\\Java\\jdk1.8.0_152\\jre\\bin;C:\\WINDOWS\\Sun\\Java\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\wbin;C:\\Program Files\\Docker\\Docker\\Resources\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\CCM;C:\\Program Files\\PuTTY\\;C:\\dev\\bin;C:\\dev\\apache-maven-3.5.0\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Git\\mingw64\\bin;C:\\Program Files\\Git\\usr\\bin;C:\\myPath\\Java\\jdk1.8.0_152\\bin;C:\\Users\\secretuser\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Program Files\\Microsoft VS Code\\bin;.
I,1,surefire.test.class.path,C:\\dev\\workspace\\MessageHub.JavaSdk\\lucas-api-hub\\target\\test-classes;C:\\dev\\workspace\\MessageHub.JavaSdk\\lucas-api-hub\\target\\classes;C:\\Users\\secretuser\\.m2\\repository\\com\\fasterxml\\jackson\\core\\jackson-databind\\2.8.4\\jackson-databind-2.8.4.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\fasterxml\\jackson\\core\\jackson-annotations\\2.8.0\\jackson-annotations-2.8.0.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\fasterxml\\jackson\\core\\jackson-core\\2.8.4\\jackson-core-2.8.4.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\inject\\guice\\4.1.0\\guice-4.1.0-no_aop.jar;C:\\Users\\secretuser\\.m2\\repository\\javax\\inject\\javax.inject\\1\\javax.inject-1.jar;C:\\Users\\secretuser\\.m2\\repository\\aopalliance\\aopalliance\\1.0\\aopalliance-1.0.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\guava\\guava\\19.0\\guava-19.0.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\code\\gson\\gson\\2.8.0\\gson-2.8.0.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\oauth-client\\google-oauth-client\\1.22.0\\google-oauth-client-1.22.0.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\http-client\\google-http-client\\1.22.0\\google-http-client-1.22.0.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\code\\findbugs\\jsr305\\1.3.9\\jsr305-1.3.9.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\http-client\\google-http-client-jackson\\1.15.0-rc\\google-http-client-jackson-1.15.0-rc.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\codehaus\\jackson\\jackson-core-asl\\1.9.11\\jackson-core-asl-1.9.11.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\microsoft\\azure\\azure-servicebus\\0.9.7\\azure-servicebus-0.9.7.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\microsoft\\azure\\azure-core\\0.9.7\\azure-core-0.9.7.jar;C:\\Users\\secretuser\\.m2\\repository\\commons-codec\\commons-codec\\1.10\\commons-codec-1.10.jar;C:\\Users\\secretuser\\.m2\\repository\\commons-lang\\commons-lang\\2.6\\commons-lang-2.6.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\apache\\httpcomponents\\httpclient\\4.3.6\\httpclient-4.3.6.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\apache\\httpcomponents\\httpcore\\4.3.3\\httpcore-4.3.3.jar;C:\\Users\\secretuser\\.m2\\repository\\javax\\mail\\mail\\1.4.5\\mail-1.4.5.jar;C:\\Users\\secretuser\\.m2\\repository\\javax\\activation\\activation\\1.1\\activation-1.1.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\sun\\jersey\\jersey-client\\1.19\\jersey-client-1.19.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\sun\\jersey\\jersey-core\\1.19\\jersey-core-1.19.jar;C:\\Users\\secretuser\\.m2\\repository\\javax\\ws\\rs\\jsr311-api\\1.1.1\\jsr311-api-1.1.1.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\sun\\jersey\\jersey-json\\1.19\\jersey-json-1.19.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\codehaus\\jettison\\jettison\\1.1\\jettison-1.1.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\sun\\xml\\bind\\jaxb-impl\\2.2.3-1\\jaxb-impl-2.2.3-1.jar;C:\\Users\\secretuser\\.m2\\repository\\javax\\xml\\bind\\jaxb-api\\2.2.2\\jaxb-api-2.2.2.jar;C:\\Users\\secretuser\\.m2\\repository\\javax\\xml\\stream\\stax-api\\1.0-2\\stax-api-1.0-2.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\codehaus\\jackson\\jackson-mapper-asl\\1.9.2\\jackson-mapper-asl-1.9.2.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\codehaus\\jackson\\jackson-jaxrs\\1.9.2\\jackson-jaxrs-1.9.2.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\codehaus\\jackson\\jackson-xc\\1.9.2\\jackson-xc-1.9.2.jar;C:\\Users\\secretuser\\.m2\\repository\\commons-logging\\commons-logging\\1.1.1\\commons-logging-1.1.1.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\microsoft\\azure\\azure-storage\\4.4.0\\azure-storage-4.4.0.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\slf4j\\slf4j-api\\1.7.12\\slf4j-api-1.7.12.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\apache\\commons\\commons-lang3\\3.4\\commons-lang3-3.4.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\microsoft\\azure\\azure-keyvault-core\\0.8.0\\azure-keyvault-core-0.8.0.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\core4j\\core4j\\0.6\\core4j-0.6.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\bouncycastle\\bcprov-jdk15on\\1.55\\bcprov-jdk15on-1.55.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\apache\\qpid\\qpid-jms-client\\0.11.1\\qpid-jms-client-0.11.1.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\apache\\geronimo\\specs\\geronimo-jms_1.1_spec\\1.1.1\\geronimo-jms_1.1_spec-1.1.1.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\apache\\qpid\\proton-j\\0.14.0\\proton-j-0.14.0.jar;C:\\Users\\secretuser\\.m2\\repository\\io\\netty\\netty-buffer\\4.0.41.Final\\netty-buffer-4.0.41.Final.jar;C:\\Users\\secretuser\\.m2\\repository\\io\\netty\\netty-common\\4.0.41.Final\\netty-common-4.0.41.Final.jar;C:\\Users\\secretuser\\.m2\\repository\\io\\netty\\netty-handler\\4.0.41.Final\\netty-handler-4.0.41.Final.jar;C:\\Users\\secretuser\\.m2\\repository\\io\\netty\\netty-codec\\4.0.41.Final\\netty-codec-4.0.41.Final.jar;C:\\Users\\secretuser\\.m2\\repository\\io\\netty\\netty-transport\\4.0.41.Final\\netty-transport-4.0.41.Final.jar;C:\\Users\\secretuser\\.m2\\repository\\io\\netty\\netty-codec-http\\4.0.41.Final\\netty-codec-http-4.0.41.Final.jar;C:\\Users\\secretuser\\.m2\\repository\\junit\\junit\\4.11\\junit-4.11.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\hamcrest\\hamcrest-core\\1.3\\hamcrest-core-1.3.jar;
I,1,java.specification.name,Java Platform API Specification
I,1,java.class.version,52.0
I,1,sun.management.compiler,HotSpot 64-Bit Tiered Compilers
I,1,os.version,10.0
I,1,user.home,C:\\Users\\secretuser
I,1,user.timezone,
I,1,java.awt.printerjob,sun.awt.windows.WPrinterJob
I,1,java.specification.version,1.8
I,1,file.encoding,Cp1252
I,1,user.name,secretuser
I,1,java.class.path,C:\\dev\\workspace\\MessageHub.JavaSdk\\lucas-api-hub\\target\\test-classes;C:\\dev\\workspace\\MessageHub.JavaSdk\\lucas-api-hub\\target\\classes;C:\\Users\\secretuser\\.m2\\repository\\com\\fasterxml\\jackson\\core\\jackson-databind\\2.8.4\\jackson-databind-2.8.4.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\fasterxml\\jackson\\core\\jackson-annotations\\2.8.0\\jackson-annotations-2.8.0.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\fasterxml\\jackson\\core\\jackson-core\\2.8.4\\jackson-core-2.8.4.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\inject\\guice\\4.1.0\\guice-4.1.0-no_aop.jar;C:\\Users\\secretuser\\.m2\\repository\\javax\\inject\\javax.inject\\1\\javax.inject-1.jar;C:\\Users\\secretuser\\.m2\\repository\\aopalliance\\aopalliance\\1.0\\aopalliance-1.0.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\guava\\guava\\19.0\\guava-19.0.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\code\\gson\\gson\\2.8.0\\gson-2.8.0.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\oauth-client\\google-oauth-client\\1.22.0\\google-oauth-client-1.22.0.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\http-client\\google-http-client\\1.22.0\\google-http-client-1.22.0.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\code\\findbugs\\jsr305\\1.3.9\\jsr305-1.3.9.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\google\\http-client\\google-http-client-jackson\\1.15.0-rc\\google-http-client-jackson-1.15.0-rc.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\codehaus\\jackson\\jackson-core-asl\\1.9.11\\jackson-core-asl-1.9.11.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\microsoft\\azure\\azure-servicebus\\0.9.7\\azure-servicebus-0.9.7.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\microsoft\\azure\\azure-core\\0.9.7\\azure-core-0.9.7.jar;C:\\Users\\secretuser\\.m2\\repository\\commons-codec\\commons-codec\\1.10\\commons-codec-1.10.jar;C:\\Users\\secretuser\\.m2\\repository\\commons-lang\\commons-lang\\2.6\\commons-lang-2.6.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\apache\\httpcomponents\\httpclient\\4.3.6\\httpclient-4.3.6.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\apache\\httpcomponents\\httpcore\\4.3.3\\httpcore-4.3.3.jar;C:\\Users\\secretuser\\.m2\\repository\\javax\\mail\\mail\\1.4.5\\mail-1.4.5.jar;C:\\Users\\secretuser\\.m2\\repository\\javax\\activation\\activation\\1.1\\activation-1.1.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\sun\\jersey\\jersey-client\\1.19\\jersey-client-1.19.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\sun\\jersey\\jersey-core\\1.19\\jersey-core-1.19.jar;C:\\Users\\secretuser\\.m2\\repository\\javax\\ws\\rs\\jsr311-api\\1.1.1\\jsr311-api-1.1.1.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\sun\\jersey\\jersey-json\\1.19\\jersey-json-1.19.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\codehaus\\jettison\\jettison\\1.1\\jettison-1.1.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\sun\\xml\\bind\\jaxb-impl\\2.2.3-1\\jaxb-impl-2.2.3-1.jar;C:\\Users\\secretuser\\.m2\\repository\\javax\\xml\\bind\\jaxb-api\\2.2.2\\jaxb-api-2.2.2.jar;C:\\Users\\secretuser\\.m2\\repository\\javax\\xml\\stream\\stax-api\\1.0-2\\stax-api-1.0-2.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\codehaus\\jackson\\jackson-mapper-asl\\1.9.2\\jackson-mapper-asl-1.9.2.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\codehaus\\jackson\\jackson-jaxrs\\1.9.2\\jackson-jaxrs-1.9.2.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\codehaus\\jackson\\jackson-xc\\1.9.2\\jackson-xc-1.9.2.jar;C:\\Users\\secretuser\\.m2\\repository\\commons-logging\\commons-logging\\1.1.1\\commons-logging-1.1.1.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\microsoft\\azure\\azure-storage\\4.4.0\\azure-storage-4.4.0.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\slf4j\\slf4j-api\\1.7.12\\slf4j-api-1.7.12.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\apache\\commons\\commons-lang3\\3.4\\commons-lang3-3.4.jar;C:\\Users\\secretuser\\.m2\\repository\\com\\microsoft\\azure\\azure-keyvault-core\\0.8.0\\azure-keyvault-core-0.8.0.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\core4j\\core4j\\0.6\\core4j-0.6.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\bouncycastle\\bcprov-jdk15on\\1.55\\bcprov-jdk15on-1.55.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\apache\\qpid\\qpid-jms-client\\0.11.1\\qpid-jms-client-0.11.1.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\apache\\geronimo\\specs\\geronimo-jms_1.1_spec\\1.1.1\\geronimo-jms_1.1_spec-1.1.1.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\apache\\qpid\\proton-j\\0.14.0\\proton-j-0.14.0.jar;C:\\Users\\secretuser\\.m2\\repository\\io\\netty\\netty-buffer\\4.0.41.Final\\netty-buffer-4.0.41.Final.jar;C:\\Users\\secretuser\\.m2\\repository\\io\\netty\\netty-common\\4.0.41.Final\\netty-common-4.0.41.Final.jar;C:\\Users\\secretuser\\.m2\\repository\\io\\netty\\netty-handler\\4.0.41.Final\\netty-handler-4.0.41.Final.jar;C:\\Users\\secretuser\\.m2\\repository\\io\\netty\\netty-codec\\4.0.41.Final\\netty-codec-4.0.41.Final.jar;C:\\Users\\secretuser\\.m2\\repository\\io\\netty\\netty-transport\\4.0.41.Final\\netty-transport-4.0.41.Final.jar;C:\\Users\\secretuser\\.m2\\repository\\io\\netty\\netty-codec-http\\4.0.41.Final\\netty-codec-http-4.0.41.Final.jar;C:\\Users\\secretuser\\.m2\\repository\\junit\\junit\\4.11\\junit-4.11.jar;C:\\Users\\secretuser\\.m2\\repository\\org\\hamcrest\\hamcrest-core\\1.3\\hamcrest-core-1.3.jar;
I,1,java.vm.specification.version,1.8
I,1,sun.arch.data.model,64
I,1,java.home,C:\\myPath\\Java\\jdk1.8.0_152\\jre
I,1,sun.java.command,C:\\dev\\workspace\\MessageHub.JavaSdk\\lucas-api-hub\\target\\surefire\\surefirebooter4393690082191226141.jar C:\\dev\\workspace\\MessageHub.JavaSdk\\lucas-api-hub\\target\\surefire\\surefire2387848635455087535tmp C:\\dev\\workspace\\MessageHub.JavaSdk\\lucas-api-hub\\target\\surefire\\surefire_08471100731569808288tmp
I,1,java.specification.vendor,Oracle Corporation
I,1,user.language,en
I,1,user.language.format,nl
I,1,awt.toolkit,sun.awt.windows.WToolkit
I,1,java.vm.info,mixed mode
I,1,java.version,1.8.0_152
I,1,java.ext.dirs,C:\\myPath\\Java\\jdk1.8.0_152\\jre\\lib\\ext;C:\\WINDOWS\\Sun\\Java\\lib\\ext
I,1,sun.boot.class.path,C:\\myPath\\Java\\jdk1.8.0_152\\jre\\lib\\resources.jar;C:\\myPath\\Java\\jdk1.8.0_152\\jre\\lib\\rt.jar;C:\\myPath\\Java\\jdk1.8.0_152\\jre\\lib\\sunrsasign.jar;C:\\myPath\\Java\\jdk1.8.0_152\\jre\\lib\\jsse.jar;C:\\myPath\\Java\\jdk1.8.0_152\\jre\\lib\\jce.jar;C:\\myPath\\Java\\jdk1.8.0_152\\jre\\lib\\charsets.jar;C:\\myPath\\Java\\jdk1.8.0_152\\jre\\lib\\jfr.jar;C:\\myPath\\Java\\jdk1.8.0_152\\jre\\classes
I,1,sun.stderr.encoding,cp437
I,1,java.vendor,Oracle Corporation
I,1,localRepository,C:\\Users\\secretuser\\.m2\\repository
I,1,file.separator,\\
I,1,java.vendor.url.bug,http:\/\/bugreport.sun.com\/bugreport\/
I,1,sun.cpu.endian,little
I,1,sun.io.unicode.encoding,UnicodeLittle
I,1,sun.stdout.encoding,cp437
I,1,sun.desktop,windows
I,1,sun.cpu.isalist,amd64
1,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestHashMapExtensions,null,null,null
5,1,com.lucas.java.util.TestHashMapExtensions,testTryGet(com.lucas.java.util.TestHashMapExtensions),null,null,null
6,1,com.lucas.java.util.TestHashMapExtensions,testTryGet(com.lucas.java.util.TestHashMapExtensions),null,null,null
2,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestHashMapExtensions,null,null,null
1,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestIterableUtilities,null,null,null
5,1,com.lucas.java.util.TestIterableUtilities,testGetSize(com.lucas.java.util.TestIterableUtilities),null,null,null
6,1,com.lucas.java.util.TestIterableUtilities,testGetSize(com.lucas.java.util.TestIterableUtilities),null,null,null
2,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestIterableUtilities,null,null,null
1,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestU4String,null,null,null
5,1,com.lucas.java.util.TestU4String,testIsNullOrEmpty(com.lucas.java.util.TestU4String),null,null,null
6,1,com.lucas.java.util.TestU4String,testIsNullOrEmpty(com.lucas.java.util.TestU4String),null,null,null
5,1,com.lucas.java.util.TestU4String,testIsNullOrWhiteSpace(com.lucas.java.util.TestU4String),null,null,null
6,1,com.lucas.java.util.TestU4String,testIsNullOrWhiteSpace(com.lucas.java.util.TestU4String),null,null,null
2,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestU4String,null,null,null
1,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestU4URLDecoder,null,null,null
5,1,com.lucas.java.util.TestU4URLDecoder,testDecode(com.lucas.java.util.TestU4URLDecoder),null,null,null
6,1,com.lucas.java.util.TestU4URLDecoder,testDecode(com.lucas.java.util.TestU4URLDecoder),null,null,null
2,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestU4URLDecoder,null,null,null
1,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestU4URLEncoder,null,null,null
5,1,com.lucas.java.util.TestU4URLEncoder,testEncode(com.lucas.java.util.TestU4URLEncoder),null,null,null
6,1,com.lucas.java.util.TestU4URLEncoder,testEncode(com.lucas.java.util.TestU4URLEncoder),null,null,null
2,1,org.apache.maven.surefire.jlucas.JlucasProvider,com.lucas.java.util.TestU4URLEncoder,null,null,null
Z,0,BYE! 

Is there a known problem with CMD? or am i looking in the wrong direction?

Tell Cypress to wait on an ajax request to a different origin than the app

The Cypress documentation is filled with examples where you can set an alias to a particular web request, and then you can instruct cypress to wait on it. Like for instance, this one:

cy.route('POST', '/login').as('postLogin')

cy.get('input[name=username]').type('jane.lae')
cy.get('input[name=password]').type('password123{enter}')

// we should always explicitly wait for
// the response for this POST to come back
// so our tests are not potentially flaky or brittle
cy.wait('@postLogin')

The thing is I'm trying to use this exact technique in my app's tests, but I need to wait on a request that is not made against the same server where the app is hosted. Therefore I am assuming that I can type in the full URL of the backend endpoint, so that cy.route does not prepend the baseUrl, which is the host of where the frontend app is hosted.

// The following URL points to a backend rails app
// The frontend app I'm testing with cypress is at http://localhost:8080
cy.route('POST', 'http:/localhost:3000/session').as('postLogin')
// ... fill login form
cy.wait('@postLogin')
// The test never reaches this point

However, when I run my test, I get a timeout because cypress never realizes the request was performed, it continues to wait on it until it timeouts. Turns out when I inspect the test script on the left sidebar in the browser where cypress is running, the route ignored the explicit host I set, and assumed only the path, which leads me to believe it was waiting for a request to my frontend app host, instead of the one I set explicitly.

The question is: can I make cypress aware of cross-origin requests so that it can wait for them? If so, how?

Fill input fields of the form with random values from an array (testing)

I have some long forms, and multi page forms too which I want fill automatically, by pressing a quick key. I want to do it with javascript/jquery, I've already found good plugins to do quick keys. What is the best approaching to fill input fields (name, phone, email etc...), with values from an array randomly? I didn't find any reasonable source on the web, or I just simply don't know what I'm exactly looking for, thats's why I can't find it :D Could you please give me some link, or anything?

Difference between various verifySignatures functions in Corda flow unit testing

What's the difference between those three methods in Corda flow unit testing?

ptx.verify(servicehub)
ptx.verifyRequiredSignatures()
ptx.verifySignaturesExcept(vararg allowedToBeMissed)

Because now I cannot use ptx.verifySignatures() as before and I have those three options! Thanks

Postman Tests: Assert several possible response status

When testing in Postman, you can use pm.response.to.have.status(200) to assert that the response status should be 200.

Is there any simple way to assert multiple statuses? I tried pm.response.to.have.status(200||404) and it didn't work.

I'm looking at the Postman Sandbox API Reference and there doesn't seem to be a straightforward solution for this, although maybe something can be worked out.

Since it's rather bizarre, I'll explain why I want this: it's a DELETE request that will standardize the database for later requests and I don't care which is returned as long as it's either.

Tests for DRF with MongoDB

I would like to ask about testing approach to DRF with MongoDB. I am interested in test my endpoints, but modules like APIRequestFactory() or APIClient() don't work with NoSQL database. Maybe someone knows how to test endpoint using some DRF module? Thanks in advance

How to implement an integration test to check if my circuit breaker fallback is called?

In my application, I need to call an external endpoint and if it is too slow a fallback is activated.

The following code is an example of how my app looks like:

@FeignClient(name = "${config.name}", url = "${config.url:}", fallback = ExampleFallback.class)
public interface Example {
@RequestMapping(method = RequestMethod.GET, value = "/endpoint", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
    MyReturnObject find(@RequestParam("myParam") String myParam);
}

And its fallback implementation:

@Component
public Class ExampleFallback implements Example {

    private final FallbackService fallback;

    @Autowired
    public ExampleFallback(final FallbackService fallback) {
        this.fallback = fallback;
    }

    @Override
    public MyReturnObject find(final String myParam) {
        return fallback.find(myParam);
    }

Also, a configured timeout for circuit breaker: hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 5000

How can I implement an integration test to check if my circuit break is working, i.e, if my endpoint (mocked in that case) is slow or if it returns an error like 4xx or 5xx?

I'm using Spring Boot 1.5.3 with Spring Cloud (Feign + Hystrix)

Non-deterministic exceptions when running truffle tests

I have been writing automated tests to test my crowdsale functionality in Truffle using their test service (which I believe uses Mocha and Chai). I am having trouble understanding why the tests fail non-deterministically (i.e. they seem to fail at random points, with random exceptions).

Eg/ I run my tests and sometimes they all pass

I run my tests and sometimes get this error message:

✓ deadline is set when beneficiary clicks start
✓ should return a State of 'Funding' after start is clicked (101ms)
✓ should allow someone to invest and record balance
✓ should send 1 ERC20 token to participant (184ms)
✓ softcap should not return reached when amountRaised is smaller
✓ softcap should return reached when amountRaised is bigger
✓ hardcap should not return reached when amountRaised is smaller
✓ hardcap should return reached when amountRaised is bigger
1) should give 1 ETH in change as hard cap was exceeded
> No events were emitted
✓ should return a State of 'Successful' when hardcap reached
✓ beneficiary should be able to withdraw funds
✓ should return a State of 'Finished' when beneficiary has funds


22 passing (2s)
1 failing

1) Contract: Sale should give 1 ETH in change as hard cap was exceeded:
 Uncaught AssertionError: deadline was not set after start pressed by beneficiary: expected '0' to not equal 0
  at test/2Crowdsale_Test.js:119:14
  at <anonymous>
  at process._tickDomainCallback (internal/process/next_tick.js:228:7)



 1
 truffle(develop)> 
 /usr/local/lib/node_modules/truffle/build/cli.bundled.js:320098
    throw reason;
    ^

 TypeError: Cannot read property 'currentRetry' of undefined
at 

/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/runner.js: 
552:28
at done 
(/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/runnable.js 
:295:5)
at 
/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/runnable.js: 
359:11
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)

This is confusing as the Assertion does not match the error message - the change assert fails however, the message that is returned is part of an earlier test which passed (deadline is set when beneficiary clicks start).

Running the tests again I got:

✓ approves contract by beneficiary
✓ should return a State of 'Not Started' before start is clicked (134ms)
✓ deadline is set when beneficiary clicks start
✓ should return a State of 'Funding' after start is clicked (98ms)
✓ should allow someone to invest and record balance
✓ should send 1 ERC20 token to participant (143ms)
✓ softcap should not return reached when amountRaised is smaller
✓ softcap should return reached when amountRaised is bigger
✓ hardcap should not return reached when amountRaised is smaller
✓ hardcap should return reached when amountRaised is bigger
1) should give 1 ETH in change as hard cap was exceeded
> No events were emitted
2) should return a State of 'Successful' when hardcap reached

Events emitted during test:
---------------------------

Transfer(_from: <indexed>, _to: <indexed>, _value: 5)
FundTransfer(backer: 0xf17f52151ebef6c7334fad080c5704d77216b732, amount: 5000000000000000000, isContribution: true)
reachedSoftCap(recipient: 0x627306090abab3a6e1400e9345bc60c78a8bef57, totalAmountRaised: 6000000000000000000)

---------------------------
✓ beneficiary should be able to withdraw funds
✓ should return a State of 'Finished' when beneficiary has funds


21 passing (2s)
2 failing

1) Contract: Sale should give 1 ETH in change as hard cap was exceeded:
 Uncaught AssertionError: deadline was not set after start pressed by beneficiary: expected '0' to not equal 0
  at test/2Crowdsale_Test.js:119:14
  at <anonymous>
  at process._tickDomainCallback (internal/process/next_tick.js:228:7)

2) Contract: Sale should return a State of 'Successful' when hardcap reached:
 Uncaught AssertionError: hardcap was not met when amountRaised was bigger: expected false to equal true
  at test/2Crowdsale_Test.js:195:14
  at <anonymous>
  at process._tickDomainCallback (internal/process/next_tick.js:228:7)



  2
  truffle(develop)> 
  /usr/local/lib/node_modules/truffle/build/cli.bundled.js:320098
    throw reason;
    ^

  TypeError: Cannot set property 'state' of undefined
  at 
  /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/runner.js: 
  576:20
  at done 
(/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/runnable.js 
:295:5)
at /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/runnable.js:353:11
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)

I now have the previous error message, and now another one throws when again, the error message does not match the assertion error.

Running the tests for a fourth time I got:

✓ should allow someone to invest and record balance
✓ should send 1 ERC20 token to participant (120ms)
✓ softcap should not return reached when amountRaised is smaller
✓ softcap should return reached when amountRaised is bigger
✓ hardcap should not return reached when amountRaised is smaller
✓ hardcap should return reached when amountRaised is bigger
✓ should give 1 ETH in change as hard cap was exceeded (275ms)
✓ should return a State of 'Successful' when hardcap reached (61ms)
✓ beneficiary should be able to withdraw funds
1) should return a State of 'Finished' when beneficiary has funds
> No events were emitted


 22 passing (2s)
 1 failing

 1) Contract: Sale should return a State of 'Finished' when beneficiary has funds:
 AssertionError: State of contract was not 'Finished': expected '4' to equal 6
  at test/2Crowdsale_Test.js:243:14
  at <anonymous>
  at process._tickDomainCallback (internal/process/next_tick.js:228:7)

Which is a completely different error to the previous two. This one again is also confusing as the previous test (beneficiary should be able to withdraw funds) also tests for the state to equal 6 and this test passes.

Each time before the tests, I exit the truffle console, delete my build folder from the project, re-enter the truffle console and test(so that I can assume the chain has been reset), yet I still receive errors that firstly, don't make sense as I do not get these results when testing it myself through the Dapp and secondly, dont show up everytime, it seems to be random times with random errors.

Has anyone else had trouble with this?

Perform assertions on new tab in zombie.js

I'm trying to test a webpage with Zombie.js In my test case I want to click a button, which will open a new tab, an the check that the new page contains a certain text. At the moment I have this:

browser.click("button .btn");
assert.strictEqual(browser.tabs.length, 2);
browser.tabs.current = browser.tabs[1];
browser.assert.text("#status", "This text should exits");

Everything works correctly when clicking the button, and, as expected, a new tab is added (checked by the assert), however, when executing I get this error:

AssertionError [ERR_ASSERTION]: No open window with an HTML document

My best guess is that I'm trying to check the text before the new tab is done loading. I have no idea how to wait for it to load or if I'm using tabs in zombie.js correctly.

Thanks

How to write the junit test case for following:

i am new to java and trying to write junit test cases for this. kindly help me out.

    public static String getObjectString(Object obj)
    {

    String jsonRequestString = null;
    ObjectMapper mapper = new ObjectMapper();
    try{
        jsonRequestString = mapper.writeValueAsString(obj);
    }catch (Exception ex1) {
        StringBuilder buff = new StringBuilder();
        buff = new StringBuilder();

        buff.append("\n***********************ERROR************************\n")
            .append("JSONException OCCURED IN CommonUtil.getObjectString(Object obj): Error Details =>").append(ex1.getMessage())
            .append("\n****************************************************\n");
        log.error(buff.toString(),ex1);
    }
    return jsonRequestString;

NullPointerException in Java Test when you Read a File

This class reads a file CSV.

public class ReadCSVFile {

    private static final String SEMICOLON_DELIMITER = ";";


    public Map<Integer,Company> listFromFile(String csvFile) throws IOException {

        BufferedReader br = null;

        br = new BufferedReader(new 
        InputStreamReader(ReadCSVFile.class.getResourceAsStream(csvFile)));

        Map<Integer,Company> companyHashMap = new HashMap();

        String line;

        br.readLine();

        while ((line = br.readLine()) != null) {

            int pos = line.indexOf(SEMICOLON_DELIMITER);
            String companyCode = line.substring(0,pos);
            String companyName = line.substring(pos +1, line.length());

            companyHashMap.put(Integer.parseInt(companyCode), new Company(Integer.parseInt(companyCode), companyName));
        }

        return companyHashMap;
    }
}

This is the test for the class ReadCSVFile:

public class ReadCSVFileTest {

private ReadCSVFile readCSVFile;

@Before
public void before(){

    readCSVFile = new ReadCSVFile();
}

@Test
public void shouldExtractCompanyFromCSV() throws IOException {

    Map<Integer, Company> result = readCSVFile.listFromFile("test_company_list.csv");
    Assert.assertEquals(2,result.size());
    Assert.assertEquals("Goldman Sachs Group Inc",result.get(65).getCompanyName());
    Assert.assertEquals("Repsol YPF SA (Please refer to Repsol SA and YPF SA)",result.get(66).getCompanyName());
}

at the end this is the file to read test_company_list.csv and that I used to compare the result of the test:

 RepRisk Company ID;Company Name
65;Goldman Sachs Group Inc
66;Repsol YPF SA (Please refer to Repsol SA and YPF SA)

The test fails, I have this message:

java.lang.NullPointerException
    at java.io.Reader.<init>(Reader.java:78)
    at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
    at app.ReadCSVFile.listFromFile(ReadCSVFile.java:21)
    at ReadCSVFileTest.shouldExtractCompanyFromCSV(ReadCSVFileTest.java:23)

What is wrong in my program? I think JUnit is correct as set up.

The line ReadCSVFile.java:21is this one:

br = new BufferedReader(new InputStreamReader(ReadCSVFile.class.getResourceAsStream(csvFile)));

instead the line (ReadCSVFileTest.java:23):

 Map<Integer, Company> result = readCSVFile.listFromFile("test_company_list.csv");

Show test names

Background


So I thought a little background would be useful. I've been upgrading from react 0.14.2 to 16.1.1. Everything has been going quite smoothly up to this point, but I've suddenly run into the problem that when a test fails it will not show which test failed. This used to work before I started the upgrade to react 16.1.1.

What have I tried?


I've tried a couple of things to get this working again. First of all of course searches on Google and Stack Overflow, but I can't seem to find any results about this. Like I'm the only one having the issue.

I thought maybe the progress reporter I had specified in my karma.conf.js changed somewhere between React versions, so I thought I'd try to use a few different ones. I tried karma-spec-reporter and karma-nyan-reporter but they both showed similar outputs.

progress and karma-nyan-reporter do show me where the test is going wrong, but not which test is going wrong. Example output from both: progress:

bono@bono-Vostro-460:~/dev/git_repos/superfly$ karma start --browsers PhantomJS
28 11 2017 11:04:58.026:INFO [framework.browserify]: registering rebuild (autoWatch=true)
28 11 2017 11:05:08.997:INFO [framework.browserify]: 7163387 bytes written (10.21 seconds)
28 11 2017 11:05:09.057:INFO [framework.browserify]: bundle built
28 11 2017 11:05:09.075:WARN [karma]: No captured browser, open http://localhost:9876/
28 11 2017 11:05:09.081:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
28 11 2017 11:05:09.092:INFO [launcher]: Starting browser PhantomJS
28 11 2017 11:05:09.329:INFO [PhantomJS 1.9.8 (Linux 0.0.0)]: Connected on socket FFVxi0L468wFvrKNAAAA with id 71406772

PhantomJS 1.9.8 (Linux 0.0.0) ERROR: 'Warning: React depends on requestAnimationFrame. Make sure that you load a polyfill in older browsers.

PhantomJS 1.9.8 (Linux 0.0.0): Executed 12 of 114 SUCCESS (0 secs / 0.011 secs)
ERROR: 'Warning: Each child in an array or iterator should have a unique "key" prop. See url for more information.----,
    in div (created by Checklist)\ 
    in section (created by Checklist)
    in div (created by Checklist)
    in Checklist'
PhantomJS 1.9.8 (Linux 0.0.0): Executed 46 of 114 SUCCESS (0 secs / 0.23 secs)
PhantomJS 1.9.8 (Linux 0.0.0): Executed 63 of 114 SUCCESS (0 secs / 0.415 secs)
PhantomJS 1.9.8 (Linux 0.0.0) ERROR
  TypeError: 'undefined' is not an object (evaluating 'map.forEach')
  at /tmp/41fcee3a13c4f48409a143865f24ec82.browserify:958 <- /home/bono/dev/git_repos/superfly/superfly/webapp/js/checks.js:103:8
PhantomJS 1.9.8 (Linux 0.0.0): Executed 67 of 114 ERROR (0.745 secs / 0.559 secs)

nyan:

##########_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-__,------,
#########-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-__|  /\_/\ 
########_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_~|_( ^ .^) 
#######-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ ""  "" 
######
#####
####
###
##
#

PhantomJS 1.9.8 (Linux 0.0.0)
TypeError: 'undefined' is not an object (evaluating 'map.forEach')
at http://localhost:9876/absolute/tmp/41fcee3a13c4f48409a143865f24ec82.browserify?b49d273453b34e281facad2d1a9aa72247785268:958

#
##
###
####
#####
######
#######
########
#########
##########

Checking the output of nyan basically pointed me to the same file as progress did. Which just points me to the place where it's going wrong, but not the specific test.

Config


I've got the following set up in my karma.conf.js:
// Karma configuration
// Generated on Fri Aug 28 2015 10:29:02 GMT+0200 (CEST)

module.exports = function(config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',


    // frameworks to use
    // available frameworks: http://ift.tt/1ft83uu
    frameworks: ['browserify', 'jasmine'],


    // list of files / patterns to load in the browser
    files: [
      './node_modules/babel-polyfill/browser.js',
      './node_modules/phantomjs-polyfill/bind-polyfill.js',
      './superfly/webapp/js/**/__tests__/**/*.js'
    ],


    // list of files to exclude
    exclude: [
    ],


    // preprocess matching files before serving them to the browser
    // available preprocessors: http://ift.tt/1gyw6MG
    preprocessors: {
      './superfly/webapp/js/**/__tests__/**/*.js': ['browserify']
    },


    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: http://ift.tt/1ft83KQ
    reporters: ['progress', 'nyan'],


    // web server port
    port: 9876,


    // enable / disable colors in the output (reporters and logs)
    colors: true,


    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,


    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,


    // start these browsers
    // available browser launchers: http://ift.tt/1ft83KU
    browsers: ['Chrome', 'Firefox', 'PhantomJS'],


    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    browserify: {
      debug: true,
      // Runtime is needed for PhantomJS
      transform: [ ['babelify', {optional: ['runtime'], plugins: ['babel-plugin-rewire']}] ]
    }
  })
};

My package.json:

{
  "name": "superfly",
  "version": "0.0.0",
  "description": "Superfly application",
  "repository": "xxx",
  "private": true,
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "xxx",
  "dependencies": {
    "babel": "~5.8.23",
    "babel-core": "~5.8.24",
    "babel-eslint": "~4.1.8",
    "babel-plugin-rewire": "~0.1.22",
    "babel-runtime": "~5.8.20",
    "babelify": "^6.1.2",
    "browserify": "^10.2.3",
    "d3": "3.5.6",
    "del": "^2.2.0",
    "gulp": "^3.8.11",
    "gulp-rename": "^1.2.2",
    "gulp-streamify": "0.0.5",
    "gulp-uglify": "^1.2.0",
    "gulp-util": "~3.0.6",
    "history": "^2.0.0",
    "immutable": "^3.7.5",
    "marked": "~0.3.5",
    "nvd3": "^1.8.1",
    "object-assign": "~3.0.0",
    "qs": "~3.1.0",
    "query-string": "^3.0.0",
    "react": "~16.1.1",
    "immutability-helper": "~1.0.0",
    "react-dom": "~16.1.1",
    "rx": "^2.5.3",
    "rx-dom": "^7.0.3",
    "through2": "~2.0.0",
    "vinyl-source-stream": "^1.1.0",
    "watchify": "^3.2.1",
    "prop-types": "~15.6.0"
  },
  "devDependencies": {
    "eslint": "~1.10.3",
    "eslint-plugin-react": "~2.6.4",
    "karma": "~0.13.9",
    "karma-browserify": "~4.3.0",
    "karma-chrome-launcher": "~0.2.0",
    "karma-firefox-launcher": "~0.1.6",
    "karma-jasmine": "~0.3.6",
    "karma-phantomjs-launcher": "~0.2.1",
    "jasmine-ajax": "~3.1.1",
    "jasmine-core": "~2.3.4",
    "phantomjs": "~1.9.18",
    "phantomjs-polyfill": "0.0.1",
    "babel-polyfill": "~6.26.0",
    "karma-nyan-reporter": "~0.2.5"
  }
}

Question


How can I make sure my tests show the test names again when the tests fail?

If you need any more information please let me know.

P.s. I don't think this gets triggered because of the warnings in the output, but if it is let me know.