Running JUnit tests from AWT Event Quene

Anyone know how to run JUnit tests from the AWT Event Queue? JFCUnit is overkill; I'm just looking for a TestRunner that runs on a different thread. I can delve into the JUnit documentation but, with luck, someone who's been through this before can spare me the trouble. Also, anyone else get a server error when searching for "JUnit event dispatch" on this forum?

JUnit 3 version:
import java.util.concurrent.atomic.AtomicReference;
import javax.swing.SwingUtilities;
import junit.framework.TestCase;
public abstract class EDTTestCase extends TestCase {
     * Overriding this method guarantees that setUp(), tearDown(), and all
     * tests run on the EDT.
    @Override
    public void runBare() throws Throwable {
        final AtomicReference<Throwable> problem = new AtomicReference<Throwable>();
        if (!SwingUtilities.isEventDispatchThread()) {
            SwingUtilities.invokeAndWait(new Runnable() {
                public void run() {
                    try {
                        runBare();
                    catch (Throwable throwable) {
                        problem.set(throwable);
            if (problem.get() != null) {
                throw problem.get();
        else {
            super.runBare();
}

Similar Messages

  • Running Unit Test from test manager that run bat file from command line

    Hi ,
    I am trying to run Jsystem (java framewotk) from command line using runScenario.bat thru unit test that i associated to test in test manager.
    the idea is that when i ran the automated test  from MTM - it will run the the unit test that will run the appropriate test case in java.
    i wrote the code like this : 
    using System;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    namespace UnitTestProject3
    [TestClass]
    public class UnitTest1
    [TestMethod]
    public void TestMethod1()
    try
    String command = "c:\\JSYSTEM\\runner\\runScenario.bat
    c:\\Users\\ryeshua\\Source\\Workspaces\\Auto1\\my-tests-project\\target\\classes scenarios\\feature1 RoeySetup.xml ";
    System.Diagnostics.ProcessStartInfo procStartInfo =
    new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
    procStartInfo.RedirectStandardOutput = true;
    procStartInfo.UseShellExecute = false;
    //procStartInfo.CreateNoWindow = true;
    System.Diagnostics.Process proc = new System.Diagnostics.Process();
    proc.StartInfo = procStartInfo;
    proc.Start();
    string result = proc.StandardOutput.ReadToEnd();
    Console.WriteLine(result);
    catch (Exception objException)
    // Log the exception
    and when i ran it from visual studio it worked perfect. and update  the Jsystem logs of the junit test in the jsystem/runner/log folder.
    but when i added it to associated test and ran it from MTM - it pass but it does not update  the logs in jsystem folder.
    the problem that i dont know what is not working. i cant see the output of it when i ran from mtm but can see when i ran from VS.
    i am using VS 2013 Pro with MTM 2013.
    please advice
    Roey

    Hi Roey,
    Thank you for posting in MSDN forum.
    Based on your issue, could you please tell me how you generate the log file under the jsystem folder?
    Generally, I know that when we run unit test from VS IDE, the file will be saved into the local machine. But when we run unit test from MTM, the unit test method will be run on the test agent machine, so the file will be saved into the test agent machine.
    Therefore, I suggest you could check if you did not see the updated logs file in jsystem folder on the test agent machine.
    In addition, I suggest you could try to copy this unit test project on this test agent machine and then run the unit test method using mstest.exe in command line and then check if you can update the logs file.
    https://msdn.microsoft.com/en-us/library/ms182489.aspx?f=255&MSPPError=-2147217396
    If you have any updated message about this issue, please tell me.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Can you run Hardware Test from older DVD?

    Hello,
    My mini2,1 came with OS 10.4. I have the two original system discs. SInce I bought it right before 10.5 was released, Apple sent me a single Leopard Upgrade disc. Does anyone know if the Apple Hardware Test is on the 10.5 upgrade disc? If it isn't, can I run the test from Disc 1 of the original 10.4 DVD's even though the mini is now running 10.5?
    Thanks in advance.

    Excellent. I found the hardware test on the original 10.4 OS X Install Disc 1. Glad to know that the test on the DVD is for my specific computer hardware, and that the current OS on that machine does not matter.This was not clear to me and I could not find an answer on Apple's help pages. And that explains why the hardware test isn't on the 10.5 upgrade DVD.
    Thanks BD and Niel.
    Dr. Rock

  • Unable to establish loopback connection when running junit tests

    Hello,
    I just started using jrockit (jrockit-jdk1.6.0_20-R28.1.0-4.0.1) and I encounter a problem running junit tests.
    I have 2 tests in the same junit suite, both do binding to 127.0.0.1.
    The first test succeeds in the binding. Once it finishes, the second one tries to bind to same address and fails due to IOException, Unable to establish loopback connection (logs below)
    If I run them using sun's hotspot jvm they work fine.
    If I run them separately, i.e, only one test per suite, each works fine.
    It seems that only when switching to jrockit I get the problem.
    Any idea?
    Thanks,
    Edo
    Logs:
    ERROR [Main Thread_1] Failed to start ConnectionFullVirtualServer[server.traffix.com/127.0.0.1:3868]
    [org.jboss.netty.channel.ChannelException: Failed to bind to: server.traffix.com/127.0.0.1:3868 ] thrown
         org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:303)
         com.traffix.openblox.core.transport.ConnectionFullVirtualServer.listen(ConnectionFullVirtualServer.java:60)
         com.traffix.openblox.core.transport.VirtualServerTable.listen(VirtualServerTable.java:143)
         com.traffix.openblox.core.transport.StackImpl.doStart(StackImpl.java:772)
         com.traffix.openblox.core.transport.TransportStack.doStart(TransportStack.java:156)
         com.traffix.openblox.core.transport.StackStateMachineImpl.doStart(StackStateMachineImpl.java:75)
         com.traffix.openblox.core.transport.StackStateMachine$StackStateConfigured.processEvent(StackStateMachine.java:60)
         com.traffix.openblox.core.fsm.StateMachine.processEvent(StateMachine.java:90)
    Caused by: java.io.IOException: Unable to establish loopback connection
         sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:106)
         sun.nio.ch.PipeImpl.<init>(PipeImpl.java:122)
         sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27)
         java.nio.channels.Pipe.open(Pipe.java:133)
         sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:41)
         sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:26)
         java.nio.channels.Selector.open(Selector.java:209)
         org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.<init>(NioServerSocketPipelineSink.java:219)
    Caused by: java.nio.channels.ClosedByInterruptException
         java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
         sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:518)
         java.nio.channels.SocketChannel.open(SocketChannel.java:146)
         sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:78)
         sun.nio.ch.PipeImpl.<init>(PipeImpl.java:122)
         sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27)
         java.nio.channels.Pipe.open(Pipe.java:133)
         sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:41)[ com.traffix.openblox.core.transport.VirtualServerTable.listen(VirtualServerTable.java:146) ][22/12/2010 11:05:57:511]
    ERROR [Main Thread_1] Failed to start Endpoint Stack(server.traffix.com Configured)
    [org.jboss.netty.channel.ChannelException: Failed to bind to: server.traffix.com/127.0.0.1:3868 ] thrown
         org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:303)
         com.traffix.openblox.core.transport.ConnectionFullVirtualServer.listen(ConnectionFullVirtualServer.java:60)
         com.traffix.openblox.core.transport.VirtualServerTable.listen(VirtualServerTable.java:143)
         com.traffix.openblox.core.transport.StackImpl.doStart(StackImpl.java:772)
         com.traffix.openblox.core.transport.TransportStack.doStart(TransportStack.java:156)
         com.traffix.openblox.core.transport.StackStateMachineImpl.doStart(StackStateMachineImpl.java:75)
         com.traffix.openblox.core.transport.StackStateMachine$StackStateConfigured.processEvent(StackStateMachine.java:60)
         com.traffix.openblox.core.fsm.StateMachine.processEvent(StateMachine.java:90)
    Caused by: java.io.IOException: Unable to establish loopback connection
         sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:106)
         sun.nio.ch.PipeImpl.<init>(PipeImpl.java:122)
         sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27)
         java.nio.channels.Pipe.open(Pipe.java:133)
         sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:41)
         sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:26)
         java.nio.channels.Selector.open(Selector.java:209)
         org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.<init>(NioServerSocketPipelineSink.java:219)
    Caused by: java.nio.channels.ClosedByInterruptException
         java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
         sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:518)
         java.nio.channels.SocketChannel.open(SocketChannel.java:146)
         sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:78)
         sun.nio.ch.PipeImpl.<init>(PipeImpl.java:122)
         sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27)
         java.nio.channels.Pipe.open(Pipe.java:133)
         sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:41

    Have you tracked down if the phone actually sends the TCP connection to the desktop? I'm feeling that this is a firewall issue that shows itself when the firewall zone changes (public/private/domain).
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • Target to execute multiple junit tests from jar file

    I have written a custom selenium framework using JUnit and Selenium, problem I am having right now is our team wants to run the tests inside HP Quality Center (I have no idea or any experience with Quality Center) but if I provide a jar file the them they can execute it inside the Quality Center (Reason to run it in Quality Center is for reporting purpose).
    Problem is that I have created my framework in away that You can create multiple JUnit base test files for different tests also keep in mind that these classes dont need main method (This is where the problem when it comes to jaring up ). I have introduced following ant target to run all the test cases.
         <target name="test.selenium" depends="jar" description="target to execute all the selenium tests.">
              <junit printsummary="yes">
                   <classpath>
                        <path refid="classpath"/>
                        <path refid="application"/>
                   </classpath>
                   <batchtest fork="yes">
                        <fileset dir="${src.dir}" includes="**/Test*Selenium.java"/>
                   </batchtest>
              </junit>
         </target>above ant target runs without any problem, but when you jar it up you need a manifest and main class, is there away I cant introduce some attribute that can execute all my tests without adding main method to each of them.
    Here is my ant target for jar
         <target name="jar" depends="compile"
                   description="Generates final jar">
              <copy todir="${build.jar}">
                   <fileset dir="lib" excludes="**/*.java"/>
              </copy>
              <jar jarfile="${build.jar}/yukonSelenium.jar"
                        basedir="${build.classes}">
                   <manifest>
                        <attribute name="Main-Class" value="com.somepackage.selenium.test.TestAuthenticationSelenium"/>
                        <attribute name="Class-Path"
                             value=". /c:/build/jar/log4j-1.2.15.jar /c:/build/jar/junit-4.6.jar /c:/build/jar/selenium-java-client-driver.jar /c:/build/jar/dom4j-1.6.1.jar"/>
                   </manifest>
              </jar>
         </target>And this is how the Test Class looks like, I have added main method in this but once i do this after jaring java -jar myJarfile.jar will only execute just the class i have main method init.
    public class TestAuthenticationSelenium extends SomePrivateFrameWorkClass {
         private void init() {
              start();
         @Test
         public void testProductNav() {
                //somecode
         @Test
         public void multipleLogin() throws FileNotFoundException, InterruptedException {
                             //Some Code
         public static void main(String[] args) {
              org.junit.runner.JUnitCore.main("com.somepackage.selenium.test.TestAuthenticationSelenium");
    }Please let me know if i should put the entire ant build file.
    Thanks for any help.
    anuradha.uduwage
    Edited by: Tilter on Aug 24, 2009 10:05 PM
    Edited by: Tilter on Aug 24, 2009 10:06 PM

    What i mean is if i have 3 class files in my jar file, and each one of those classes has a main method, how will i be able to execute a class of my choice from that jar file. In manifest files, you specify the main class, but how would i specify multiple classes with main methods, or achieve my objective here.

  • Problem with JUnit Testing from Command Prompt

    Hi There,
    Related Info:
    OS - Windows 7 32 Bit, IDE Used: Eclipse
    I'm using the following command to compile the java file from the command prompt:
    C:\Users\J\Desktop> javac -classpath .:junit.jar check4PrimeTest.java
    I get the error: "package junit.framework does not exist import junit.framework.*;"
    How can i fix this?
    I have downloaded junit from junit.org the 'junit4.10' and extracted in my Java Folder along side jdkjdk1.7.0_03, jre6, jre7.
    I will post my code below for the 'check4PrimeTest.java' file which im trying to test from the command prompt.
    package check4prime;
    // check4PrimeTest.java
    //Imports
    import junit.framework.*;
    public class check4PrimeTest extends TestCase {
         //Initialize a class to work with.
         private check4Prime check4prime = new check4Prime();
         //constructor
         public check4PrimeTest (String name) {
              super(name);
         //Main entry point
         public static void main(String[] args) {
              System.out.println("Starting test...");
              junit.textui.TestRunner.run(suite());
              System.out.println("Test finished...");
         } // end main()
         //Test case 1
         public void testCheckPrime_true() {
              assertTrue(check4prime.primeCheck(3));
         //Test cases 2,3
         public void testCheckPrime_false() {
              assertFalse(check4prime.primeCheck(0));
              assertFalse(check4prime.primeCheck(1000));
         //Test case 7
         public void testCheck4Prime_checkArgs_char_input() {
              try {
                   String [] args= new String[1];
                   args[0]="r";
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
              } catch (Exception success) {
                   //successful test
         } //end testCheck4Prime_checkArgs_char_input()
         //Test case 5
         public void testCheck4Prime_checkArgs_above_upper_bound() {
              try {
                   String [] args= new String[1];
                   args[0]="10001";
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
              } catch (Exception success) {
                   //successful test
         } // end testCheck4Prime_checkArgs_upper_bound()
         //Test case 4
         public void testCheck4Prime_checkArgs_neg_input() {
              try {
                   String [] args= new String[1];
                   args[0]="-1";
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
              } catch (Exception success) {
                   //successful test
         } // end testCheck4Prime_checkArgs_neg_input()
         //Test case 6
         public void testCheck4Prime_checkArgs_2_inputs() {
              try {
                   String [] args= new String[2];
                   args[0]="5";
                   args[1]="99";
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
               } catch (Exception success) {
                   //successful test
         } // end testCheck4Prime_checkArgs_2_inputs
         //Test case 8
         public void testCheck4Prime_checkArgs_0_inputs() {
              try {
                   String [] args= new String[0];
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
              } catch (Exception success) {
                   //successful test
         } // end testCheck4Prime_checkArgs_0_inputs
         //JUnit required method.
         public static Test suite() {
              TestSuite suite = new TestSuite(check4PrimeTest.class);
              return suite;
         } //end suite()
    } //end check4PrimeTestEdited by: 963042 on Oct 3, 2012 8:57 PM
    Edited by: 963042 on Oct 3, 2012 10:07 PM

    963042 wrote:
    C:\Users\J\Desktop> javac -classpath .:junit.jar check4PrimeTest.javaThat's the Linux way to do it. On windows there is a different list separator. Use this:
    javac -cp .;junit.jar check4PrimeTest.java
    And use -cp to save you some typing ;) If you want to incorporate unit testing into your builds I would suggest looking into automating it a little more through tool such as ant, maven, etc.

  • Running FlexUnit tests from command line

    Sorry if that has been posted before: I searched best I could and nothing came up.
    I am interested in building and running my unit tests from the command line so we can add it to a nightly build process.
    I am *very* new to all this: basically I picked up Adobe Flash Builder 4 a month ago and I have done *everything* inside that IDE: writing code, building, testing, running.
    I looked into at least how to build something from the command line, I found this:
    http://help.adobe.com/en_US/flashbuilder/using/WSbde04e3d3e6474c4-59108b2e1215eb9d5e4-8000 .html
    Can't get past this error:
    Buildfile: /Users/dbanks/build_test.xml
    BUILD FAILED
    Target "FlexUnitApplication" does not exist in the project "null".
    Total time: 0 seconds
    Adobe Flash Builder 4:
    An error has occurred. See the log file
    /Users/dbanks/Documents/Adobe Flash Builder 4/.metadata/.log.
    Plus, even if I got this going, I am just building the swf.  I also want to run it and capture the output in some meaningful way that can be read/evaluated/acted on.
    FWIW, the script/xml I am using to try to build:
    build_test.xml:
    <?xml version="1.0"?>
    <project default="main">
        <target name="main">
            <fb.exportReleaseBuild project="NightclubMogul" />
        </target>
    </project>
    execute_build_test.sh:
    WORKSPACE="$HOME/Documents/AdobeFlashBuilder4"
    # works with either FlashBuilder.app or Eclipse.app
    "/Applications/AdobeFlashBuilder4" \
        --launcher.suppressErrors   \
        -noSplash   \
        -application org.eclipse.ant.core.antRunner   \
        -data "$WORKSPACE"    \
        -file "/Users/dbanks/build_test.xml" FlexUnitApplication
    I am not clear what in here is actually supposed to point to where my project lives: it's off in some directory somewhere.  I see that I am pointing to a workspace (Documents/AdobeFlashBuilder4) but when I poke around in there I don't see anything connecting back to the directories where the code lives.
    Any help would be great: getting the tests to build from command line, then getting them to run.

    C:\>sqlplus @myscript
    That would be the easiest variation
    C:\>sqlplus user/passwd@tns_alias @myscript
    would be an often used variation
    And then there is of course the version with parameter passing:
    C:\>sqlplus user/passwd@tns_alias @myscript param1 ... paramx
    Dunno about MSBuild

  • Exceptions trying to run Junit test thro Jdev. Test uses Application module

    Hi,
    my junit test works through the OraTst frame work. But I want to debug the code and If I try to run the same test through Jdev I am running into a following exception. Can somebody tell me how to fix this issue.
    I am a consumer of the Application module, I have not created it. I am using it by referencing it through the jar file provided by the owner.
    oracle.jbo.DMLException: JBO-27200: JNDI failure. Unable to lookup Data Source at context jdbc/EMReposDS
    at oracle.jbo.server.DBTransactionImpl.lookupDataSource(DBTransactionImpl.java:1414)
    at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:309)
    at oracle.jbo.common.ampool.DefaultConnectionStrategy.connect(DefaultConnectionStrategy.java:203)
    at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolConnect(ApplicationPoolMessageHandler.java:553)
    at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:409)
    at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:8534)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4392)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2388)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareResource(ApplicationPoolImpl.java:3621)
    at oracle.jbo.pool.ResourcePool.useResource(ResourcePool.java:344)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2200)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3088)
    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:460)
    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:431)
    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:426)
    at oracle.jbo.client.Configuration.getApplicationModule(Configuration.java:1494)
    at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1399)
    at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1370)
    -Sidd

    Sidd,
    No idea what OraTst is, but based upon the name of your data source, I'd guess you are an Oracle employee using an internal framework. I understand that there are some internal Oracle forums that you can use.
    John

  • Running Hardware Test from second Mac?

    My wife has a 2.4 GHz Intel Core 2 Duo iMac. It has a faulty DVD drive - actually a disc has been stuck in there for some time and we haven't been able to get it out. That is not our current issue, although it makes troubleshooting much harder.
    Her iMac is getting slower and slower and I promised I'd run some tests. I can't run the Hardware Test on that machine from the original install disc because of the faulty DVD drive. I'd like to run the test remotely from my MacBook Pro but can't work out how to do that. I have tried booting her Mac in Target mode where I can run Disk Utility on my machine and repair her hard drive but when I insert her original Install Disc in my laptop there is no Hardware Test visible on it. I have tried to get access to my DVD drive from her iMac but 'DVD or CD Sharing' being turned on in 'Sharing Prefs' on my machine doesn't seem to bring up any shared discs on her computer. Maybe it's still trying to access her faulty DVD drive?
    Is there anything I can do here to run some hardware tests on her machine? I'd like to do that before I start doing clean installs of the Mac OS on hard drives etc. I'm a bit stuck.
    Thank you

    Five ways to eject a stuck CD or DVD from the optical drive
    Ejecting the stuck disc can usually be done in one of the following ways:
      1. Restart the computer and after the chime press and hold down the
          left mouse button until the disc ejects.
      2. Press the Eject button on your keyboard.
      3. Click on the Eject button in the menubar.
      4. Press COMMAND-E.
      5. If none of the above work try this: Open the Terminal application in
          your Utilities folder. At the prompt enter or paste the following:
            /usr/bin/drutil eject
    If this fails then try this:
    Boot the computer into Single-user Mode. At the prompt enter the same command as used above. To restart the computer enter "reboot" at the prompt without quotes.
    Running the AHT doesn't make much sense for fixing slowness. If the computer is working, then there is no hardware failure. See the following:
    Things You Can Do To Resolve Slow Downs
    If your computer seems to be running slower here are some things you can do:
    Start with visits to:     OS X Maintenance - MacAttorney;
                                      The X Lab: The X-FAQs;
                                      The Safe Mac » Mac Performance Guide;
                                      The Safe Mac » The myth of the dirty Mac;
                                      Mac maintenance Quick Assist.
    Boot into Safe Mode then repair your hard drive and permissions:
    Repair the Hard Drive and Permissions Pre-Lion
    Boot from your OS X Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities menu. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.
    Repair the Hard Drive - Lion/Mountain Lion/Mavericks
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the Utilites Menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD disk icon and click on the arrow button below.
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported, then click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu. Select Restart from the Apple menu.
    Restart your computer normally and see if this has helped any. Next do some maintenance:
    For situations Disk Utility cannot handle the best third-party utility is Disk Warrior;  DW only fixes problems with the disk directory, but most disk problems are caused by directory corruption; Disk Warrior 4.x is now Intel Mac compatible.
    Note: Alsoft ships DW on a bootable DVD that will startup Macs running Snow Leopard or earlier. It cannot start Macs that came with Lion or later pre-installed, however, DW will work on those models.
    Suggestions for OS X Maintenance
    OS X performs certain maintenance functions that are scheduled to occur on a daily, weekly, or monthly period. The maintenance scripts run in the early AM only if the computer is turned on 24/7 (no sleep.) If this isn't the case, then an excellent solution is to download and install a shareware utility such as Macaroni, JAW PseudoAnacron, or Anacron that will automate the maintenance activity regardless of whether the computer is turned off or asleep.  Dependence upon third-party utilities to run the periodic maintenance scripts was significantly reduced since Tiger.  These utilities have limited or no functionality with Snow Leopard or later and should not be installed.
    OS X automatically defragments files less than 20 MBs in size, so unless you have a disk full of very large files there's little need for defragmenting the hard drive.
    Helpful Links Regarding Malware Protection
    An excellent link to read is Tom Reed's Mac Malware Guide.
    Also, visit The XLab FAQs and read Detecting and avoiding malware and spyware.
    See these Apple articles:
      Mac OS X Snow Leopard and malware detection
      OS X Lion- Protect your Mac from malware
      OS X Mountain Lion- Protect your Mac from malware
      About file quarantine in OS X
    If you require anti-virus protection I recommend using VirusBarrier Express 1.1.6 or Dr.Web Light both from the App Store. They're both free, and since they're from the App Store, they won't destabilize the system. (Thank you to Thomas Reed for these recommendations.)
    Troubleshooting Applications
    I recommend downloading a utility such as TinkerTool System, OnyX, Mavericks Cache Cleaner, or Cocktail that you can use for removing old log files and archives, clearing caches, etc. Corrupted cache, log, or temporary files can cause application or OS X crashes as well as kernel panics.
    If you have Snow Leopard or Leopard, then for similar repairs install the freeware utility Applejack.  If you cannot start up in OS X, you may be able to start in single-user mode from which you can run Applejack to do a whole set of repair and maintenance routines from the command line.  Note that AppleJack 1.5 is required for Leopard. AppleJack 1.6 is compatible with Snow Leopard. Applejack does not work with Lion and later.
    Basic Backup
    For some people Time Machine will be more than adequate. Time Machine is part of OS X. There are two components:
    1. A Time Machine preferences panel as part of System Preferences;
    2. A Time Machine application located in the Applications folder. It is
        used to manage backups and to restore backups. Time Machine
        requires a backup drive that is at least twice the capacity of the
        drive being backed up.
    Alternatively, get an external drive at least equal in size to the internal hard drive and make (and maintain) a bootable clone/backup. You can make a bootable clone using the Restore option of Disk Utility. You can also make and maintain clones with good backup software. My personal recommendations are (order is not significant):
      1. Carbon Copy Cloner
      2. Get Backup
      3. Deja Vu
      4. SuperDuper!
      5. Synk Pro
      6. Tri-Backup
    Visit The XLab FAQs and read the FAQ on backup and restore.  Also read How to Back Up and Restore Your Files. For help with using Time Machine visit Pondini's Time Machine FAQ for help with all things Time Machine.
    Referenced software can be found at MacUpdate.
    Additional Hints
    Be sure you have an adequate amount of RAM installed for the number of applications you run concurrently. Be sure you leave a minimum of 10% of the hard drive's capacity as free space.
    Add more RAM. If your computer has less than 2 GBs of RAM and you are using OS X Leopard or later, then you can do with more RAM. Snow Leopard and Lion work much better with 4 GBs of RAM than their system minimums. The more concurrent applications you tend to use the more RAM you should have.
    Always maintain at least 15 GBs or 10% of your hard drive's capacity as free space, whichever is greater. OS X is frequently accessing your hard drive, so providing adequate free space will keep things from slowing down.
    Check for applications that may be hogging the CPU:
    Pre-Mavericks
    Open Activity Monitor in the Utilities folder.  Select All Processes from the Processes dropdown menu.  Click twice on the CPU% column header to display in descending order.  If you find a process using a large amount of CPU time (>=70,) then select the process and click on the Quit icon in the toolbar.  Click on the Force Quit button to kill the process.  See if that helps.  Be sure to note the name of the runaway process so you can track down the cause of the problem.
    Mavericks and later
    Open Activity Monitor in the Utilities folder.  Select All Processes from the View menu.  Click on the CPU tab in the toolbar. Click twice on the CPU% column header to display in descending order.  If you find a process using a large amount of CPU time (>=70,) then select the process and click on the Quit icon in the toolbar.  Click on the Force Quit button to kill the process.  See if that helps.  Be sure to note the name of the runaway process so you can track down the cause of the problem.
    Often this problem occurs because of a corrupted cache or preferences file or an attempt to write to a corrupted log file.

  • Run e-tester from a server and have staff remotely update scripts

    Can we run the floating e-tester from a server and have staff remotely access the server to run and update scripts instead of installing the client on everyone's workstation?

    Original Question:
    Can we run the floating e-tester from a server and have staff remotely access the server to run and update scripts instead of installing the client on everyone's workstation?
    There are different alternatives to consider and different ways to answer the question.
    1) You can run e-Tester with a floating license from a server and have people to use remote desktop to run and create scripts.
    Pros:
    * Multiple users can be updating scripts in the server at the same time.
    * There is no need to install e-Tester in any other computer.
    Cons:
    * If the max number of floating licenses is reached no other person can open another instance of e-Tester.
    * Having multiple people running scripts in the Job scheduler will create conflicts therefore is not recommended. Running multiple instances of e-Tester manually shouldn't cause problems, but it is a slow way to do regression testing. The job scheduler can run a script after another without user intervention. Teamwork can be affected if the default settings are changed by different users.
    * Running thru remote desktop(or any other remote tool such as vnc) is slower than having etester in the computer. The refresh rate of the screen tends to be slower.
    * If multiple users are using the server resources at the same time it can slow down the work of others. The server can run out of memory or it will be slow because the CPU running near max capacity.
    2) You can run eTester with a node lock license from a server and have people to use remote desktop to run and create scripts.
    Pros:
    * Multiple users can be updating scripts in the server at the same time.
    * There is no need to install eTester in any other computer.
    * Only one license is required.
    Cons:
    * Having multiple people running scripts in the Job scheduler will create conflicts therefore is not recommended. Running multiple instances of etester manually shouldn't cause problems, but it is a slow way to do regression testing. The job scheduler can run a script after another without user intervention. Teamwork can be affected if the default settings are changed by different users.
    * Running thru remote desktop(or any other remote tool such as vnc) is slower than having etester in the computer. The refresh rate of the screen tends to be slower.
    * If multiple users are using the server resources at the same time it can slow down the work of others. The server can run out of memory or it will be slow because the CPU running near max capacity.
    Notes:
    1) Having eTester installed in each individual's computer will allow the person to run tests with no worries about conflicts of server resources or job schedules trying to start an etester instance. Installing etester is a one time thing that takes in general less than 10 minutes.
    2) Instead of sharing the server resources you can share the place where the scripts reside. You can place the scripts in a central location and and configure etester to read the scripts from there. Instructions on how to do this should be in the knowledge base (if not please let me know)(Don't be lazy Zuriel, paste the link here).
    3) You can consider to have eManager Enterprise if you want to have better organization of the scripts. In eManager Enterprise you can relate your test cases to your scripts, you can run the scripts from a central location, it is less limited for scheduling scripts than the JobScheduler, and it can be accessed from anywhere inside the company with a web browser (for security reasons requires username and password). eManager Enterprise doesn't have the ability to create or update scripts, it uses scripts that were created in eTester already.
    eManager can also create schedules conflicts if multiple runs are attempted. There are ways to deal with this situation by having multiple computers to run the tests. (Please post in another thread if more information is necessary).
    I hope this helps.
    Regards,
    Zuriel

  • Run PowerShell Script from a Event Receiver

     Hi,
    Just looking around on the net for some documentation for running a PowerShell script via an Event Receiver. We want to be able to make changes to the script and not change anything in the ER.
    Sadly using a workflow isn't an option here.
    Looking for websites that give some examples really, or if anyone has done this.
    Regards
    If this is helpful please mark it so. Also if this solved your problem mark as answer.

    Hi TemPart:
    string cmdArg = “C:\\Scripts\\test.ps1″;
    Runspace runspace = RunspaceFactory.CreateRunspace();
    runspace.Open();
    Pipeline pipeline = runspace.CreatePipeline();
    pipeline.Commands.AddScript(cmdArg);
    Collection [PSObject] results = pipeline.Invoke(); // please Update [] bracket with less then and greater then bracket
    runspace.Close();
    Had to modify this slightly:
    string cmdArg = “Powershell.exe -file C:\\Scripts\\test.ps1″;
    Runspace runspace = RunspaceFactory.CreateRunspace();
    runspace.Open();
    Pipeline pipeline = runspace.CreatePipeline();
    pipeline.Commands.AddScript(cmdArg);
    Collection [PSObject] results = pipeline.Invoke(); // please Update [] bracket with less then and greater then bracket
    runspace.Close();
    If this is helpful please mark it so. Also if this solved your problem mark as answer.

  • Can not run flexunit tests from ant

    Hello,
    I'm trying to script test execution in order to integrate tests in Jenkins. I followed the wiki article here http://docs.flexunit.org/index.php?title=Ant_Task
    The tests run successfully with Flash Builder but not with ant. I'm getting the following error:
    Error
    VerifyError: Error #1014: The class flash.filesystem::FileStream could not be found
    I think that this occurs because I'm using the flashplayer_11 as suggested in the wiki article and flashplayer does not load the airglobal.swc component.
    I noticed that Flash Builder launches the ADL.exe process; whereas flexunit within ant tests launches flashplayer.exe.
    Should I use ADL.exe with flexunit instead of Flash player ? In that case how to use adl argument in flexunnit ? I saw that Richard Lee has committed a fix to make flexunit support ADL arguments, how ?
    Is there a solution to my problem ?
    Thanks in advance.
    Ygor

    Thank you Michael,
    I resolved my problem by adding the the player attribute in the flexunit task as follow:
    <flexunit
               player="air"
                workingDir="${bin.loc}"
                toDir="${report.loc}"
                haltonfailure="false"
                verbose="true"
                localTrusted="true"
                >

  • Ical alert to  run script disappears from the event

    A few seconds after I set an  alert for an event  to run a script, the Run Script designation disappears and defaults to  alert Message. I cannot make the Run Script designation stick. So, when the alert triggers, no script is run. 

    Hi kimal,
    Are you syncing the calendars? Run Script alarms only work on local calendars, those under "On My Mac" in iCal.
    Best wishes
    John M

  • Check if an exception is thrown during my JUnit test

    Hi all,
    I've been writing unit tests for the application I'm writing.
    I'm trying to write one very generic test which will simply open up the application, press some buttons, and close it back down, and confirm that no exceptions were thrown at any time during the test.
    Unfortunately, while I figured I could just wrap the whole thing in a try/catch block, it seems that I have an exception that is being thown in the AWT-EventQueue which isn't being caught. The test passes fine, but I want it to fail.
    What is the best way to go about checking for this? Should I be running the test in the event queue? Or should I have my own error handler to catch the exceptions?
    Thanks!
    Tim

    jschell wrote:
    TimQuinn wrote:
    I'm not trying to fix the bug. I'm trying to make my JUnit tests catch the exception. I think we're going around in circles here.Yep. Because the problem was stated incorrectly.
    Exceptions are returned up the call stack within the thread of execution.
    You have two threads. The one that the test runs in A, and another B.
    You can't catch or even see an exception in A that originated in B as an exception (you can't catch it.)
    So you need to find some other way, some other place, to put a catch, in thread B and then create data which indicates whether it worked or not. Or find some other existing data that changes state because of that.Well, the question that I asked in my original post was exactly that: how do I find out about an exception that is thrown in another thread? If something got stated incorrectly, maybe it was in the later posts?
    It can't be impossible: I can think of one very simple solution to my question, but it isn't very good. I can simply replace the Standard Error writer with one that sets a"fail" flag every time it is called. Then my test can fail every time Standard Error is written to, no matter which thread it's in. Obviously, this isn't a great solution, because, while it would fail the test every time an exception was printed, it would fail other times as well.
    So with a bit more work I could parse what's written to stderr myself, to check if it's a real exception. But this really seems like re-inventing the wheel. Is there no standard pattern for creating a test that confirms that you can run something without generating exceptions?

  • Tried to add JUnit Test in Eclipse -- "Test type does not exist" error

    Hi guys,
    I'm developing an assignment whose details I won't bother going into -- it's enough to say that we were introduced to JUnit testing a couple of weeks ago in university tutorials, and I've stupidly tried to add one to my project without fully understanding it all. This is in eclipse 3.1.1.
    Basically, I followed eclipse's built-in tutorial called "Writing and running JUnit tests ".
    1) Created class "TestFailure" with method "testFailure".
    public void testFailure() throws Exception {
        fail();
    } 2) This then appeared as a .java file in my project (as well as on my UML diagram, courtesy of Omondo's UML plugin).
    3) I decided it was too risky mucking around with this stuff in a "live" project, so went ahead and deleted the TestFailure icon on my class diagram.
    4) I closed down eclipse.
    5) I went ahead and deleted TestFailure.java and TestFailure.class from my project folders.
    6) I opened my project again, and tried to execute...
    ... and now I keep getting a Test type does not exist error when I try and run it.
    How on earth do I get rid of this?
    Any advice/guidance is greatly appriciated -- oh, how I wish I'd not started messing with JUnit testing!!! :)

    Um, okay -- I fully hold my hands up and admit that I don't know what I'm doing with JUnit testing (we only had a half hour intro to it) but figured I may as well learn by using the official tutorials. It's always a good place to start! Although obviously using a current assignment isn't the best idea ;)
    I was executing my main class (obviously with my main method in there) to execute the program after I'd deleted test case classes, but strangely I've just shut down my machine and restarted and it's working fine. I'm not sure what the deal is here -- lesson learnt though, study new topics on a dummy project! :)
    Anyway, if I waited until I understood the software and code I'm producing to its fullest, I think hell'd freeze over before I executed any code! :) Using a tutorial to learn a new aspect of software I'm already familiar with wasn't a bad move, IMHO. Just using it on this particular project was... Needless stress and all that.

Maybe you are looking for

  • Need help with XML Coding

    I'm trying to write an IF statement similar to <?if:QUANTITY='0'?> but would like to say 'is greater than' 0. I'm not very familiar with the coding in XML and what characters I'm able to use since I can't use <> in the coding. Can anyone help? Thanks

  • How can I disappear the lines of the grid from the picture?

    Please help! This photo was made through a grid. http://www.flickr.com/photos/apexivision/4468964280/sizes/o/in/photostream/ My question is: how can I disappear the lines of the grid from the picture with Photoshop CS2?  Thanks!!!

  • Combining iso files

    I have some software that I downloaded and it came as 2 .iso files. I need to combine these into one iso file in order to mount and install. Any advice on how to do this would be helpful. Thanks.

  • MobileMe Gallery video playback

    I've already posted this issue on the iPad forum but I get no response, maybe one of you guys has an answer to my question. I've uploaded a Quicktime movie to MobileMe Gallery and it plays fine on my Mac and iPhone but it won't play on my iPad. Does

  • I want to add local cryptographic algorithms to firefox. What I must modify except NSS?

    I want to add some local cryptographic algorithms to Firefox. I know, that I must modify NSS. I can, for example, modify only NSS and use this libraries in browser, or I must do something else with Firefox?