 // Copyright AudioKit. All Rights Reserved. Revision History at http://github.com/AudioKit/AudioKit/
 @testable import AudioKit
-import XCTest
 import AVFoundation
 import CAudioKit
-
-class AKNodeTests: AKTestCase {
+import XCTest
+
+class AKNodeTests: XCTestCase {
 
     let osc = AKOscillator()
 
     func testNodeBasic() {
-        duration = 0.1
+        let engine = AKEngine()
+        let osc = AKOscillator()
         XCTAssertNotNil(osc.avAudioUnit)
         osc.start()
         engine.output = osc
-        AKTest()
+        let audio = engine.startTest(totalDuration: 0.1)
+        audio.append(engine.render(duration: 0.1))
+        testMD5(audio)
     }
 
     func testNodeConnection() {
+        let engine = AKEngine()
+        let osc = AKOscillator()
         osc.start()
         let verb = AKCostelloReverb(osc)
         engine.output = verb
-        AKTest()
+        let audio = engine.startTest(totalDuration: 0.1)
+        audio.append(engine.render(duration: 0.1))
+        testMD5(audio)
     }
 
     func testRedundantConnection() {


    func testDynamicOutput() {

        duration = 2.0

        let osc1 = AKOscillator()
        osc1.start()
        engine.output = osc1

        AKStartSegmentedTest(duration: 1.0)

        let osc2 = AKOscillator(frequency: 880)
        osc2.start()
        engine.output = osc2

        AKAppendSegmentedTest(duration: 1.0)

        AKFinishSegmentedTest()

    }

    func testDynamicConnection() {

        duration = 2.0

        let osc = AKOscillator()
        let mixer = AKMixer(osc)
        engine.output = mixer

        osc.start()

        AKStartSegmentedTest(duration: 1.0)

        let osc2 = AKOscillator(frequency: 880)
        osc2.start()
        mixer.addInput(osc2)

        AKAppendSegmentedTest(duration: 1.0)

        AKFinishSegmentedTest()
    }

    func testDynamicConnection2() {

        duration = 2.0

        let osc = AKOscillator()
        let mixer = AKMixer(osc)

        engine.output = mixer
        osc.start()

        AKStartSegmentedTest(duration: 1.0)

        let osc2 = AKOscillator(frequency: 880)
        let verb = AKCostelloReverb(osc2)
        osc2.start()
        mixer.addInput(verb)

        AKAppendSegmentedTest(duration: 1.0)

        AKFinishSegmentedTest()
    }

    func testDynamicConnection3() {

        duration = 3.0

        let osc = AKOscillator()
        let mixer = AKMixer(osc)
        engine.output = mixer

        osc.start()

        AKStartSegmentedTest(duration: 1.0)

        let osc2 = AKOscillator(frequency: 880)
        osc2.start()
        mixer.addInput(osc2)

        AKAppendSegmentedTest(duration: 1.0)

        mixer.removeInput(osc2)

        AKAppendSegmentedTest(duration: 1.0)

        AKFinishSegmentedTest()
    }

    func testDisconnect() {

        duration = 2.0

        let osc = AKOscillator()
        let mixer = AKMixer(osc)
        osc.start()
        engine.output = mixer

        AKStartSegmentedTest(duration: 1.0)

        mixer.removeInput(osc)

        AKAppendSegmentedTest(duration: 1.0)

        AKFinishSegmentedTest()

    }

    func testNodeDetach() {

        duration = 2.0

        let osc = AKOscillator()
        let mixer = AKMixer(osc)
        engine.output = mixer
        osc.start()

        AKStartSegmentedTest(duration: 1.0)

        osc.detach()

        AKAppendSegmentedTest(duration: 1.0)

        AKFinishSegmentedTest()

    }

    func testTwoEngines() {

        let engine2 = AKEngine()

        let osc = AKOscillator()

        let verb = AKCostelloReverb(osc)
        engine.output = verb

        let audio = engine.startTest(totalDuration: 0.1)
        audio.append(engine.render(duration: 0.1))
        testMD5(audio)

    }

    func testManyMixerConnections() {

        let engine = AKEngine()

        var oscs: [AKOscillator] = []
        for _ in 0..<16 {
            oscs.append(AKOscillator())
