Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
There are enough posts about how to use MockK and Mockito, but what's the import difference between them, what's your preference when using a Mocking framework in Kotlin and why?
MockK introduces itself as a "mocking library for Kotlin".
Mockito states "Tasty mocking framework for unit tests in Java" (and as a side-note: Mockito existed already before Kotlin).
So, already on the first page you have the most important difference. That being said, if you want to use mocks and you are using Kotlin, I would suggest you look up MockK... if the issues there do not affect you, you are relatively safe. If you are familiar with Mockito and it isn't too cumbersome for you to use with Kotlin (e.g. try to use when), then that might be ok too.
(Finally... I don't use mocks anymore... most of the time I find too many things are mocked, that shouldn't even be mocked at all... but those are just my 2 cents here)
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Hi I know that BDD with selenium can be used to test user interfaces.
I also know that APIs could be tested using Gherkin.
My question is, should APIs be tested using Gherkin? Is it the right tool for the job?
BDD aims to create a shared understanding of how an application should behave by discovering new features based on concrete examples. Key examples are then formalized with natural language following a Given/When/Then structure
For that you use Gherkin. On which layer you then automate is another decision.
This can be the UI layer, or some API service layer below.
So yes, Gherkin is the right tool for the job.
Source: https://specflow.org/bdd/
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I read about OOP and Function programming. And I found both have pros and cons.
Such as:
OOP: have side effect, and sometimes it is very usefull
Function: easy to code and think. But don't have side effect and loop.
And I wonder if I can using both OOP and Function paradigm in one project. Is it be recommended in practice?
There's nothing preventing both paradigms from being used together. Arguments on each side sometimes can be misleading as people tend to focus on languages and their features as opposed to the paradigms themselves. OOP doesn't need to have state/side effects, and functional programming doesn't always make things easier or faster. The good engineer will use the right tools for the right task, which means getting a good understanding of both.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
My company is thinking about upgrading from angular 1.5.x to angular 2. The codebase is written in ES5, so a move to either ES6 or TypeScript is also in discussion.
TypeScript adds some OOP features over basic JavaScript and as the current code is more of a functional programming approach rather than use of OOP style (classes etc), I am wondering what are other benefits of switch from JS to TS when migrating to angular 2?
How much OOP is there in angular 2?
Typescript isn't really about OOP. OOP is orthogonal to types (think Java vs. Smalltalk). Typescript is about static type verification: are you using a string where you think you're using an array? I actually fixed a bug in a co-worker's code along those lines just last Friday where he was using a for loop over the length of what he thought was an array (Array.prototype.forEach makes that an easy to find error).
Is static type-checking worth the effort of adding type annotations all over your codebase? That's a judgement call.
ES6/ESNext on the other hand just flat-out offers you better ways to write code. I don't see how anyone can make the argument that
function(arr) {
var foo = arr[0];
var bar = arr[1];
return foo + bar;
}
is better than
([foo, bar]) => foo + bar
Same for lots of other features, if you write in a functional style your codebase (like mine) is probably littered with
Object.keys(someObj)
.map(k => someObj[k])
.filter...
Now you just have Object.values. Plus about a million other features.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Is it a good practice to go the PageFactory way when writing testcases in Selenium2? If yes why?
To be frank I have never used them when writing test-cases and have not missed it either. But I would to know what are the advantages of using PageFactory over not using it.
From my point of view the advantages are on the one hand, all the ids and xpaths at only one place in code, on the other hand the abstraction layer between the implementation an the test itself.
This will allow non- programmers to test the websites what's useful for me, because some people know exactly what the workflows are and which functionality is the most important but are not part of the development teams or engineers at all.
Last but not least, the PageFactory term is quite useful.
Based on these reasons we decided to switch from over 500 Selenium 1 testcases to Selenium 2 with PageObjects. And try to compensate the effort of creating POs, which will surely exceed the effort for std test executions, by increased maintainability, usability and scalability
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have a set of Visual Studio Team System unit (integration really) tests that talk to a remote database. The tests are getting too slow and unwieldy. I'd like to replace the entire set of tests with mocked out versions. The problem is it's painful to write all the expect statements that mimic what an entire database does.
Does anyone know of a tool or add-on that will run an existing test, figure out what the non-mocked version actually returns and write out the Expect.Call's to duplicate the functionality? I know this is a long shot, but I feel like it should be possible.
Ok, I ended up writing it myself. Here is the blog post overview:
Write My Rhino Mocks Expect Statement
And here is the CodePlex project:
WriteMyExpectStatement
Hope this helps someone somewhere.