Welcome to SF Stack Exchange.
First you need to set your instantiation
ProductTable__c testproduct = ProductTableCmpController.getProducts();
in your test to a List. The method you are calling is a list, so the test method needs to also be a list.
Your method also receive a parameter of type string.
public static List < ProductTable__c > getProducts (String
searchKeyWord)
So you need to pass also a string to your test method.
Something like this:
List<ProductTable__c> testproduct = ProductTableCmpController.getProducts(serachString);
It is telling you that it doesn't exist because you don't have a method in that controller that don't accept parameters, which it is true. But you have the one accepting a string as parameter which it is the correct method you are using.
Something like this should work:
@isTest
public class TestProductTableApplication {
@testSetup static void setup() {
ProductTable__c product = new ProductTable__c (Name = 'carrot',
Price__c = 10, Amount__c = 1500 );
INSERT product;
}
@isTest static void getProducts (){
String searchString = 'Whatever';
List<ProductTable__c> testproduct = ProductTableCmpController.getProducts(searchString);
// put your asserts here
}
}
FOR DELETE:
@AuraEnabled
public static void deleteProductTable (List<Id> productIds) {
List<ProductTable__c> productsToDelete = [SELECT Id FROM
ProductTable__c WHERE Id in :productIds];
delete productsToDelete;
}
The method deleteProductTable accepts a List of Ids List productIds
That means that you need to pass the exact data type to you test method in order to make it work.
So you can do something like this:
@isTest static void deleteProductTable (){
List<Id> productTableIds = new List<Id>();
// Lest just add two Ids to keep this simple.
ProductTable__c pTableOne = new ProductTable__c();
ProductTable__c pTableTwo = new ProductTable__c();
// You need to add those mandatory fields before inserting a record
// In this case we use the Name field as the only mandatory field
// but you need to figurate out the ones you need for your
// ProductTable__c record
pTableOne.Name = 'POne';
insert pTableOne;
pTableTwo.Name = 'PTwo';
insert pTableTwo;
// After inserting the records we have access to their Ids
// Now we add the ids to our list
productTableIds.add(pTableOne.Id);
productTableIds.add(pTableOne.Id);
// Now we can pass our list to the method as parameter
List<ProductTable__c> testproduct =
ProductTableCmpController.deleteProductTable(productTableIds);
// put your asserts here
}