background preloader

What is JBehave?

What is JBehave?
Related:  BDD, TDD & ScaffoldingTools

Behat — BDD for PHP ATDD, Cucumber and Scala Acceptance Test Driven Development (ATDD) is a practice in which the whole team collaboratively discusses acceptance criteria, with examples, and then distills them into a set of concrete acceptance tests before development begins. If you notice the keywords here then they are whole team discussion acceptance criteria with examples concrete acceptance tests before development begins Hence, just like we do TDD for development, ATDD is an important practice to get your test cases in place before beginning the development of a user story. These acceptance tests are then shown to the stakeholders and the functionality is verified. Well, as you guessed you are right in most scenarios. Cucumber separates out the features which the stakeholders understand from the mapping code which binds these features to the corresponding acceptance test code which tests the software functionality. A typical feature file would look like this So we define a feature called multiplication. Like this: Related

NUnit - Home Using junit for something else junit != unit test Junit is the Java unit testing framework. I have seen examples in production code when the junit framework was used to execute system tests, where the execution chain of the test included external service call over the network. After having all that said, let me tell you a different story and join the two threads later. We speak languages… many Our programs have user interface, most of the time. For example we have the files and in the Java code we were accessing these via the Spring MessageSource calling We, programmers are kind of lazy The problems came when we did not have some of the translations of the texts. All temporary solutions become final. The temporary strings, which were just the English version got into the release. Process and discipline: failed To avoid that we implemented a process. We concluded that not having a translation into the properties files is not the real big issue. Light-way process and control Checking would have been cumbersome manually.

etorreborre/specs2 @ GitHub Specify your software using both text and Scala code class HelloWorldSpec extends Specification { def is = s2""" This is a specification for the 'Hello world' string The 'Hello world' string should contain 11 characters $e1 start with 'Hello' $e2 end with 'world' $e3 """ def e1 = "Hello world" must haveSize(11) def e2 = "Hello world" must startWith("Hello") def e3 = "Hello world" must endWith("world") } Use different styles of specifications /** This is the "Unit" style for specifications */class HelloWorldSpec extends Specification { "This is a specification for the 'Hello world' string".txt "The 'Hello world' string should" >> { "contain 11 characters" >> { "Hello world" must haveSize(11) } "start with 'Hello'" >> { "Hello world" must startWith("Hello") } "end with 'world'" >> { "Hello world" must endWith("world") } }} Document your APIs with compiler-checked examples Manage contexts for integration testing

ScaTDD: Casting an eye over three major Test frameworks in Scala | Scalabound Testing has traditionally been the gateway process for Scala development at a number of Java shops looking to evolve their tech stack with minimal disruption or committment. This posts hopes to cover three of the main testing frameworks in the Scala landscape, (Specs2, Scalatest and Scalacheck) with an example of the classic FizzBuzz test, for how they can be used for fun and profit. So, the brief outline of the FizzBuzz requirement are that given a sequence of numbers: Any number divisible by 3 should return the String “Fizz”Any number divisible by 5 should return the String “Buzz”Any number divisible by both 3 and 5 should return the String “FizzBuzz”Otherwise the number should be returned as a String In a nutshell A meta framework for writing unit and acceptance tests by specification. Link Version v2.9.2_v1.10 Ohloh Active community Yes. Example Feedback Generally the pain points I encountered were with Scala IDE rather than Specs2. Comparisons v1.7.2 Yes. v2.9.0-1-1.9 Conclusion

GitHub - teamcapybara/capybara: Acceptance test framework for web applications Integration testing done right with Embedded MongoDB Introduction Unit testing requires isolating individual components from their dependencies. Dependencies are replaced with mocks, which simulate certain use cases. This way, we can validate the in-test component behavior across various external context scenarios. Web components can be unit tested using mock business logic services. Services can be tested against mock data access repositories. Integration testing database options Ideally, our tests should run against a production-like database. Lesson 1: We need a forked test-suite bound database When a test suite runs, a database must be started and only made available to that particular test-suite instance. An in-memory embedded databaseA temporary spawned database process The fallacy of in-memory database testing Java offers multiple in-memory relational database options to choose from: Embedding an in-memory database is fast and each JVM can run it’s own isolated database. Spawning a production-like temporary database Conclusion

ScalaTest Gauge | ThoughtWorks Tips for (unit testing) JavaBeans If you’re writing Java code chances are you’re writing at least a few classes that adhere to the JavaBean conventions, i.e., classes that have private properties with public getter and setter methods, contain a no-arguments constructor, are serializable, and comply with the Equals and HashCode contract. And on top of that you’ll probably also throw in a useful toString() implementation. If, e.g., we take a very simple class called MyBean that contains two fields named id and name, we’ll end up with the following code: MyBean – a JavaBean example So for a class with just two fields, we’ve ended up with 70 lines of code. Project Lombok to the rescue Luckily, there is a nice open source tool that aims to reduce just the type of boilerplate code we’re dealing with in our MyBean class. Project Lombok contains alot of different annotations but for our example we’re only going to need one: @Data. MyBean – our JavaBean example with Project Lombok Help, my code coverage is down

Integrating Cucumber and Play | Sebastian Nozzi In this post I want to show you how to integrate Cucumber into a Play (2.2.3) application. It assumes some previous Play experience and that you know what Cucumber is about. The example is minimal, but hopefully it is enough to get you started for bigger projects. Let’s start by setting up the SBT plugin. Add to “project/plugins.sbt” the following lines: resolvers += "Templemore Repository" at " addSbtPlugin("templemore" % "sbt-cucumber-plugin" % "0.8.0") This will make it possible for SBT to find and load the plugin. cucumberSettings cucumberFeaturesLocation := ". Note If you ever need to clone the github project and publish locally it could be that Play does not find your local Ivy2 (as it was in my case). resolvers += Resolver.file("Local repo", file(System.getProperty("user.home") + "/.ivy2/local"))(Resolver.ivyStylePatterns) Until now we just added the ability to SBT to find and deal with cucumber files. We’ll be using the snapshot versions, so add: Feature

GXUnit GXUnit Es un intento de crear una herramienta con funcionalidad similar a Nunit o Junit, adaptada a la realidad de Genexus. Por ahora podria utilizarse para crear TEST de objetos Procedure. El la version YI, podriamos testear Transacciones. WEBPanels sin campos de entrada, podrian testearse con el webwrapper. Workpanels, serian complicados de testear, pues mezclan mucho la interfaz con la logica. La primera etapa seria, hacer un framework de pruebas, para procedimientos La segunda, seria ayudar a generar los programas de test, con Patterns (Simple Test Pattern) La tercera, para la que hay que esperar a la Version YI, de Genexus, seria probar las transacciones. Para lograr mejores resultados y no tener que programar en codigo nativo con genexus, seria bueno contar con comandos del tipo dentro de los disponibles con Genexus. Algo mas de info, aqui Comentarios GXUnit es una herramienta super necesaria para adaptar Extreme Programming a GeneXus , muy buena la idea. Proyecto GxUnit 1) Alcance 3.1.

Pure Scala BDD made easy with SBT and Cucumber. - Funció Notes Pure Scala BDD made easy with SBT and Cucumber. You may probably already know about BDD and Cucumber. Well, Cucumber allows you to program the steps in your scenario in Ruby… and now in Java and Scala, too. Therefore, I evaluated Cucumber as a BDD solution for an upcoming Scala project. And it did really well, compared to other solutions that were quite more difficult to set up. This post is almost unnecessary. If you want the complete picture, check the example project I just created at Bitbucket: . Ingredients Directions Conclusions There is no excuse to not be using BDD in your Scala projects. Ah! P.S.