Folder structure for test cases of Action classes in struts project, /WEB-INF/web.xml was not found why? - struts

I'm using struts1.3.8, AJAX and spring jdbc.
I developed the code as per the requirement.Now I have to test the developed code.
Where i have to write the testcases and what would be the folder structure for testing the Struts Action classes.
Should i have to use web.xml and struts-config.xml in the project?? I used the same but i'm getting web.xml not found.
Struts Testcases have to take along with the project or for the testcases i have to create a new project????
Some sample File structure with test cases can be helpful a lot.
Thanks in Advance.
Laxman chowdary

Related

XSLT Reports in Selenium

How to create XSLT reports in Selenium project bases on Java and Ant.
I have already added that to my project but the result is not as per my expectation. All Testcases are passing but some are showing failed in reports
XSLT reports can be generated based on the results of your TestNG.XML file. if you are using TestNG as unit testing framework make sure to place -output directory of the TestNG should be available in home directory.
Read this (http://learn-automation.com/generate-xslt-report-in-selenium/) post you will get better Idea.

Selenium Maven Project

I am new to automated testing. I am trying to set up a Maven project for my Selenium test automation work. I put all the packages pertaining to envVariables, library, settings, resultLog, errScreenshots etc under src/test/java.
I have a couple of questions here
i)I showed this framework to my developer and he asked me to move some of the packages under src/test/resources. I am not sure whether this needs to be done or whatever I have configured is correct. If I need to move the packages to resources folder, what packages should I move? Can somebody please advise me on how to configure this?
ii) what should the src/main/java folder contain? I thought it will contain the src code of my application and test folder would contain unit tests and selenium tests. But my developer says the test folder will contain only unit test that test the classes in the src/main/java. It should not contain my selenium tests. Can somebody please explain this to me?
Regards
vasu
I am not sure about the structure of your automation project. I prefer the following hierarchy in MAVEN projects
src
|-----main
| |-----java
| |-----Pages (contains application code arranged as one Class per Page)
| |-----Steps (calls the page objects and methods called in Pages)
|-----test
|------java
| |-----Test (Opens browser and calls steps to perform test - TestNG)
|------resources
|-----InputSheets
|-----Environment Variables
The results are saved in C or D drive and are time stamped to avoid getting overwritten.
The automation helper library is created as a separate Maven project and is added as a dependency to the test project. In this way the helper library is independent from the test project and can be used across all projects if need arises.
All this being said, much of the structure is a matter of choice and varies according to your project requirements.
"src/main/" is for production code or test automation framework, not for test cases. "src/test/" is for testing stuff, including selenium tests. "java" folders are for classes, "resource" folders are for configuration and test data.
I suggest creating a separate maven module for your testing stuff: test framework and test cases.
Please refer maven directory layout page for more information.
UPDATE: I have created sample maven project to show how run selenium test with selenide.

Loading test namespaces

I have a Clojure project where I want to programatically examine all namespaces to see if they contain tests (as defined by clojure.test/deftest)
I can successfully identify the tests if they are loaded (via the :test metadata tag on the vars) but many of the tests are ini .clj files that are not automatically loaded by the project and these don't get detected.
Is there a way to load all namespaces in the current project in order to do this?
Why not just look at the source for lein test? IIRC it uses builtitude to find and load all namespaces on the classpath.

MSpec and testing class using appsettings within an app.conf issues

I'm very new to MSpec and BDD in general and are currently having trouble having mspec pass a Search class that looks up employee data via an XML feed. The parameters for the url are held in an app.config file and seems as if the app.config is not being accessed to obtain the config setting.
Otherwise mspec is running fine for all other tests so far its just this one particular.
How do I write a test to utilise or mimic if thats needed, for the config file access please ?
Thanks
You probably have app.config in your production code project (project which is being tested), try adding the same app.config in Tests (project with MSpecs).

How do I avoid having to manually tweak Import-Package headers with Maven bundle-plugin?

I'm happily using the Maven bundle-plugin to create OSGi manifest headers for my modules. However, when there are configuration files that pull in classes which aren't referenced directly in the code, the plugin can't tell which packages it's going to need.
One example is a bundle with domain models that constitute a Persistence Unit for JPA. The driver class is part of the PU configuration and either set in an XML file or at runtime when the EntityManager is instantiated. I have to manually add an Import-Package header for the driver class that I want to load, or I get CNF errors.
Another example is a Struts war, where the web.xml pulls in the Struts dispatcher that's otherwise not found anywhere in the code and has to be manually added to the headers.
How can I avoid this?
I tried adding the required packages as dependencies with a provided scope, but that didn't help.
In the plug-in section of the bnd configuration you can specify plug-ins to analyze these files and contribute to the import-package header. For spring it looks like this:
<_plugin>aQute.lib.spring.SpringComponent</_plugin>
I am not sure, what descriptors are supported on top of spring. Just take a look at the source (it's in the Apache Felix SVN) and see for yourself. In the worst case you have to write your own plug-in, but at least it is possible! Also peter kriens site about the bnd explains the usage and some internals.
Other then that I am not aware of any simple solution.