Support

Forums

Contact Me

Posts Tagged 'testcases'

Install PHPUnit and PHPDocumentor in XAMPP

phpunit-logoselenium-logoxampp.logo

Open XAMPP Shell (start c:\xampp\xampp-control.exe and click on the button XAMPP-Shell), and run:

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install --alldeps phpunit/PHPUnit
pear install phpunit/DbUnit phpunit/PHPUnit_Selenium
pear install phpunit/PHPUnit_SkeletonGenerator
pear install phpunit/PHPUnit_Story phpunit/PHP_CodeCoverage
pear install PhpDocumentor

Read more: Install PHPUnit and PHPDocumentor in XAMPP

Record testcases with Selenium IDE

open.qa.logo Selenium is a test tool for web applications. Selenium tests run directly in a browser, just like real users do. It runs in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh, Safari on the Mac.  They have plans to target Safari on the iPhone in some months. The tool is free and available under Apache 2.0.


  • Install the firefox plugin, note the latest version work only in Firefox 2.0 not in 3.0Beta!
  • Install also XPather another Firefox extension, very helpful to get the elements  XAPTH in pages.
  • Of course restart Firefox
  • Open either the sidebar (go to menu View, Sidebar, Selenium IDE) or the floating windows
    (go to menu Tools - Selenium IDE)
  • Go to the page where you wan to test something
  • Put the right Base URL (A) and press button (B) when ready
    doYourFirstSeleniumTest

Read more: Record testcases with Selenium IDE

Using PHPUnit to test-develop Joomla extensions in PhpStorm

Since I did not find any clear how to on the internet how to run test cases for 3rd party extensions that use Joomla CMS, here is my version of it.

Prerequisites

Having PHPUnit properly install, if you use XAMPP you may want to read this post.

Read more: Using PHPUnit to test-develop Joomla extensions in PhpStorm

maven2 Unit Test code reuse and dependencies

apache_maven

In a multi modules project where you have write API or common code for unit tests in one project and want to reuse these in the tests for another project. Maven will crash during the compile phase if you do not make the following.

Maven rules of the game:

  • The main code in src/main/java is visible across modules if you did specify project
    dependencies in pom.xml.
  • Test code reside in src/test/java and is not shared across modules, moreover
  • Test code can use any code from src/main/java but not the other way around, which
    make sense as we want to clearly separate test code (junit testcases) from code shipped.

The solution is to create additional test jar for each module, this is done by putting in the
parent pom (lets call it parent-pom.xml)

inside the <build></build> tags the following:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <executions>
      <execution>
        <goals>
          <goal>test-jar</goal>
        </goals>
      </execution>
    </executions>
</plugin>

This will create for each modules an additional jar named {artifactId}-{version}-tests.jar
during the goal test-jar

Now for every modules where you want to reuse test classes, all you have to do in to put in every
modules pom.xml a dependency to that test jar by adding the tests classifier

 <dependency>
     <groupId>yourGroup</groupId>
     <artifactId>yourReusableModuleArtifact</artifactId>
     <version>0.1-SNAPSHOT</version>
     <classifier>tests</classifier>
     <scope>test</scope>
 </dependency>

 

This has work for me with Maven 2.0.8

Donations

Thank You for supporting my work