HTTP Basic Auth via URL in Firefox does not work?

I have a solution for Firefox and Internet Explorer. For Firefox, you need to go into about:config and create the integer network.http.phishy-userpass-length with a length of 255. This tells Firefox not to popup an authentication box if the username and password are less than 255 characters. You can now use http://user:[email protected] to authenticate. For Internet … Read more

How to test a function’s output (stdout/stderr) in unit tests

One thing to also remember, there’s nothing stopping you from writing functions to avoid the boilerplate. For example I have a command line app that uses log and I wrote this function: func captureOutput(f func()) string { var buf bytes.Buffer log.SetOutput(&buf) f() log.SetOutput(os.Stderr) return buf.String() } Then used it like this: output := captureOutput(func() { … Read more

Gradle: How to Display Test Results in the Console in Real Time?

Here is my fancy version: import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent tasks.withType(Test) { testLogging { // set options for log level LIFECYCLE events TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.STANDARD_OUT exceptionFormat TestExceptionFormat.FULL showExceptions true showCauses true showStackTraces true // set options for log level DEBUG and INFO debug { events TestLogEvent.STARTED, TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.STANDARD_ERROR, TestLogEvent.STANDARD_OUT exceptionFormat TestExceptionFormat.FULL } info.events … Read more

In Karate API mocking not working as expected for me

Karate cannot automatically intercept calls. The recommended approach is when you boot the application running at localhost:8080 you change the configuration so that instead of calling http://dev-stg/userservice/v1/findUser it calls something like http://localhost:8001/v1/findUser. This is what most teams do, and is easy because you should anyway be defining external URL-s as application.properties (or equivalent) as a … Read more

Order of execution of tests in TestNG

This will work. @Test(priority=1) public void Test1() { } @Test(priority=2) public void Test2() { } @Test(priority=3) public void Test3() { } priority encourages execution order but does not guarantee the previous priority level has completed. test3 could start before test2 completes. If a guarantee is needed, then declare a dependency. Unlike the solutions which declare … Read more

How to get Sikuli working in headless mode

I successfully got sikuli running in headless mode (no physical monitor connected) Ubuntu: check Xvfb. Windows: install display driver on the machine (to be headless) from virtualbox guest additions display drivers and use TightVNC to remotely set resolution from another machine. Detailed steps for windows 7 Assume that: Machine A: to be headless machine, windows … Read more

How do I control the order of execution of tests in Maven?

You can’t specify the run order of your tests. A workaround to do this is to set the runOrder parameter to alphabetical. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <runOrder>alphabetical</runOrder> </configuration> </plugin> and then you need to have rename your tests to obtain the expected order. However it isn’t a good idea to have dependent tests. Unit tests … Read more

How to explain sorting (numerical, lexicographical and collation) with examples to non technical testers?

Here are some explanations: Lexicographical In this case, you sort text without considering numbers. In fact, numbers are just “letters”, they have no numeric combined meaning. This means that the text “ABC123” is sorted as the letters A, B, C, 1, 2 and 3, not as A, B, C and then the number 123. This … Read more