 
 class SFTPChannelTests: SFTPTests {
     // TODO add a script to reset sftp test env(file.txt,rename.txt,remove.txt,ls/1,ls/2)
+    let filePathForTest = "./file.txt"
+    let folderPathForTest = "./folder"
+    let newFolderPathForTest = "./newFolder"
+    
+    override func setUp() {
+        super.setUp()
+        createEmptyFile(filePathForTest)
+        mkdir(folderPathForTest)
+        rmdir(newFolderPathForTest)
+    }
+    
+    override func tearDown() {
+        // Put teardown code here. This method is called after the invocation of each test method in the class.
+        super.tearDown()
+        unlink(filePathForTest)
+        rmdir(folderPathForTest)
+    }
+    
+    func createEmptyFile(filename: String) {
+        do {
+            let file = try channel?.openFileForWrite(filename, shouldResume: false, mode: 0o755)
+            file?.close()
+        } catch let error as NSError {
+            if error.code != SSHKitSFTPErrorCode.FileAlreadyExists.rawValue {
+                XCTFail(error.description)
+            }
+        }
+    }
+    
+    func unlink(path: String) {
+        let error = channel!.unlink(path)
+        if let error=error {
+            if error.code != SSHKitSFTPErrorCode.NoSuchFile.rawValue {
+            }
+        }
+    }
+    
+    func rmdir(path: String) {
+        let error = channel!.rmdir(path)
+        if let error=error {
+            if error.code != SSHKitSFTPErrorCode.NoSuchFile.rawValue {
+                XCTFail(error.description)
+            }
+        }
+    }
+    
+    func mkdir(path: String) {
+        let error = channel!.mkdir(path, mode: 0o755)
+        
+        if let error=error {
+            if error.code != SSHKitSFTPErrorCode.FileAlreadyExists.rawValue {
+                XCTFail(error.description)
+            }
+        }
+    }
+    
+    func testUnlik() {
+        let path = filePathForTest
+        var error = channel!.unlink(path)
+        
+        if let error=error {
+            XCTFail(error.description)
+        }
+        
+        error = channel!.unlink(path)
+        XCTAssertEqual(error.code, SSHKitSFTPErrorCode.NoSuchFile.rawValue)  // folder existed
+    }
 
     func testOpenDirectorySucc() {
         do {

    }
    
    func testChmod() {
        let path = "./file.txt"
        let error = channel!.chmod(path, mode: 0o700)
        
        if let error=error {
            // TODO remove folder
            XCTFail(error.description)
        }
        

    }
    
    func testRename() {
        let oldName = filePathForTest
        let newName = "./renamed.txt"
        let error = channel!.rename(oldName, newName: newName)
        
        if let error=error {
            XCTFail(error.description)
        }
        
        unlink(newName)  // clean test file
    }
    
    func testMkdir() {
        let path = newFolderPathForTest
        
        var error = channel!.mkdir(path, mode: 0o755)
        if let error=error {
            XCTFail(error.description)
        }
        
        error = channel!.mkdir(path, mode: 0o755)
        XCTAssertEqual(error.code, SSHKitSFTPErrorCode.FileAlreadyExists.rawValue)  // folder existed
    }
    
    func testRmdir() {
        let path = folderPathForTest
        var error = channel!.rmdir(path)

        if let error=error {
            XCTFail(error.description)
        }
