Skip to content

Content Tagged "test"

Page 1 of 2

Content Tagged "test"

Consistent Testing electron-settings

April 6, 2017Categories: Software, Tutorial
TL;DR : Delete the settings file before starting the test. Today I implemented a simple wrapper over the electron-settings functionality to gibe me access to a set of properties via get/set methods. My scenario is simple: I have a property named path.backup and I want to be able to get , set…

Poor Man's Mocks in TypeScript

March 7, 2017Categories: Software, Tutorial
Today I went against my better judgement of usign a mock framework and decided to create my own mocks to allow coverage testing for an IPC-calling code. My reference code I wanted to test is: The code would use an angular service named PathService which, for the purpose of this test only has a…

Use "toThrowError" and "toThrow" in TypeScript with Objects

March 2, 2017Category: Software
TL;DR: wrap your method call in the expect() statement. Instead of expect(obj.method()).toThrow() , write expect( () => { obj.method() }).toThrow() . While in the process of improving the code coverage, I needed to write a test for a method throwing an exception. My initial code would have been…

Fix Angular 2 Tests with Karma

March 1, 2017Category: Software
Below are some fixes I had to apply in order to make Angular 2 tests work with karma . Binding Error : Can't bind to 'ngModel' since it isn't a known property of 'input' Solution : Import FormsModule in your test: Unknown component Error : 'custom-component' is not a known element Solution…

Skip the EPSO Online Test

December 5, 2016Categories: EPSO, Tutorial
TL;DR: : Replace the end of the application URL from e.g. 1947_en to 1947/apply_en . These days, EPSO is in the habit of launching calls with multiple fields with a twist: each field has its own application page. So, if you just want to browse the fields for more details (e.g. Talent Screener…

Access Data Files for Local Tests in Android

March 9, 2016Category: Software
TL;DR: Put your data files in test/resources and access it with: I've got an android application with a module performing data processing (HTML scraping in fact). This part is pure java and all its tests are in the src/test path. My particular problem is that I have a set of (large-ish) files…

Manually Create a Retrofit/OkHttp Response for Testing

September 21, 2015Category: Software
I've got a method in an use case which requires a Retofit Response object as parameter and I need to test it. Now, I can use the Retrofit itself and build one with the network, but it would require the full android shebang. I've opted instead for building a Retrofit Response manually. My method is…

MVP in Android - A Summary

September 14, 2015Category: IT
These days I'm reading on architectures. I had a look at MVC, MVP, MVVM and how they are applied (adapted to?) to Android applications. Here are some short points about MVP. Model-View-Presenter has been adapted to Android and is advocated by more experienced people than I. It is interesting to…

Android: Provide Local Asset in Testing

March 13, 2015Category: Software
In the past few days I had a little bit of a problem: InstrumentationTestCase gives access to local assets while AndroidTestCase gives access to getAssets() for assets specific to testing. I had a scenario to test where I get a file from my local src/androidTest/assets directory while the code…

NullPointerException - getInstrumentation().getContext()

March 11, 2015Category: Software
Here's a beginner mistake... The following code: Throws an exception: Attempt to invoke virtual method 'android.content.Context android.app.Instrumentation.getContext()' on a null object reference It took me some time to find out why: getInstrumentation() returns null in the constructor :) The…
Next

All tags